Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category Codecs
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Rainer Sinsch - 2006-04-26
Last edited by Dave Chapman - 2008-03-03

FS#5241 - MOD player codec (not based on dumb)

This is an experimental MOD player codec. It is based on an old open source module player for gravis ultrasound (unfortunately I forgot the name, if anyone finds out please inform me). I added a fast mixing routine and did a quick rockbox port. Yet the source is quite unpolished, but it plays fine on my h320.

Current features:
* Plays startracker/protracker modules (4-8 Channels)
* Unfortunately only modules up to 486kbytes (due to codec memory limitation)

Song length calculation is not implemented (should be no real problem though)

Closed by  Dave Chapman
2008-03-03 21:37
Reason for closing:  Rejected
Additional comments about closing:  

The original version of this patch can't be included in Rockbox due to the unclear license.

A written-from-scratch MOD codec released under the GPL is at http://www.rockbox.org/tracker/ task/8680

Rainer Sinsch commented on 2006-04-26 22:38

Corrected a bug within the 0d00 effect and readded the 0e00 effect. Most songs should sound normal now.

Apply the mod_v0.1.diff from above and replace the apps/codecs/mod.c with the new one

   mod.c (35.9 KiB)
Eli Sherer commented on 2006-04-27 16:31

I’m pissing my pants right now…can’t wait to test it!!!

Eli Sherer commented on 2006-04-27 19:07

it really works!!!!

download experimental 2.4.17 with this patch

http://plugbox.rockbox-lounge.de/rockbox-2-4-17-mod.zip

Mathieu Stempell commented on 2006-06-17 16:52

Nice work, but a codec not limited to MOD files would be so much more interesting. :)

Rainer Sinsch commented on 2006-06-27 14:28

Implementing other tracker-formats is theoretically possible, but we have to solve memory limitations first. Currently we can not realiably store more than 512kbyte sample data. And this is a killer for many XM/S3M files.

Rainer Sinsch commented on 2006-07-18 21:34

Here is an update for the latest CVS. It now merges fine together with SID codec.

Travis Hayes commented on 2006-07-22 03:48

how exactly does this audio format work? is it like MIDI, which just store “notes” into a file and requires special software to decode and “mix” the notations into “music”

Dominik Riebeling commented on 2006-07-22 06:51
Travis Hayes commented on 2006-07-22 16:54

thanks

Norbert Preining commented on 2006-08-29 09:08

JFYI: Does no apply to the new codec system. I guess it needs some rework.

Ciao
Norb

Robert Kukla commented on 2006-08-30 18:05

Adapted to current CVS. It works fine - hope I haven’t missed anything.

Norbert Preining commented on 2006-10-30 10:06

Can someone please update this to go with current CVS? THere are two problems: The one is that the definition of the metadata extraction routine must be moved a bit. But the bigger problem I couldn’t solve is what with DSP_DITHER which is undefined.

Thanks a lot and all the best

Norbert

Robert Kukla commented on 2006-10-30 10:49

DSP_DITHER is not needed anymore and the line that uses it can be removed.

I have attached the patch I am using - I have moved all the mod stuff away from the end of the queue, so it doesn’t constantly get out sync when new codecs are added.

Without any guarantees. ;)

Norbert Preining commented on 2006-10-30 12:10

Thanks, this did work.

Robert Kukla commented on 2006-11-10 13:29

updated to work with current CVS

Dan commented on 2006-11-13 18:07

Works with the Nov 13 build too. God bless you for this patch hehe.

Dan commented on 2006-11-14 06:38

Doh, except any mod you play gets stuck on repeat, so they’ll hold up a playlist you put them in.

Rainer Sinsch commented on 2006-12-11 13:03

Here is an updated mod.c for the latest CVS. Just apply the mod_v0.5.patch and replace the mod.c with this one.

   mod.c (35.7 KiB)
Dominik Riebeling commented on 2006-12-11 22:08

I just tried it on h120, current cvs – I get hard lockups of my player :(

Robert Kukla commented on 2006-12-12 00:07

fixed :)

Robert Kukla commented on 2006-12-12 17:37

I modified the patch, so that the titles only get played one time and don’t loop automatically. Intentional loops (mod effect 0x0b) are only done once. This makes it finally possible to play multiple mods in a playlist.

I also implemented a crude form of seeking. It is done in the “pattern order” table, so the wps will display the the position in this table as current time and the size of the table as song length. As a result we get some sort of progress bar as well. Expect some funny effects, as some mods don’t use the full table or use it out-of sequence with the effect 0x0b. Also set-tempo effects and such like may be skipped leading to a wrong speed of the mod. But better than no seeking at all, IMO.

Rainer Sinsch commented on 2006-12-12 18:17

You guys rock!

Robert Kukla commented on 2007-01-10 18:49

Copy sample text (greetings etc) to title meta tag which is then displayed in WPS (provided %s is on %it line). Also file size (in kb) is displayed instead of bitrate. Slightly improved progress bar accuracy.

Chris commented on 2007-01-28 02:08

Needs updating for today’s SVN. Is it possible to also implement a FastTracker player (i.e. xmz)?

Robert Kukla commented on 2007-01-28 13:05

Updated patch.

Robert Kukla commented on 2007-02-07 16:16

synched

Robert Kukla commented on 2007-02-10 17:13

synched again

Michael Sevakis commented on 2007-02-10 17:24

That was quick :)

Robert Kukla commented on 2007-02-26 18:09

incorporated MikeS’ replaygain fix

denis commented on 2007-03-10 06:09

needs an update. amazing patch by the way.

Robert Kukla commented on 2007-03-10 10:44

what do you mean by update? It works with current svn?

denis commented on 2007-03-10 15:08

nevermind me. it does. somehow it didnt want to compile with the patch removed and applied again later on. i actually had to delete mod.c and start anew.

Robert Kukla commented on 2007-03-29 18:42

The ipod mini 2g doesn’t have enough IRAM. So this version of the patch doesn’t put any code in IRAM. It may mean that it is not fast enough now. Maybe someone with that target can report.

Dominik Riebeling commented on 2007-03-29 19:27

Just tried it on my mini 2g with a couple of mods, works fine. If you have any stress test files let me know – I got boost levels up to ~30%, so it’s quite fast on the mini. The file might have been too easy for the decoder though ;-)

Robert Kukla commented on 2007-03-29 22:45

Proper fix according to NLS’ advice in http://forums.rockbox.org/index.php?topic=9064.msg70064#msg70064

While I was at it I changed it so it displays the mod type (number of channels) as the genre string.

denis commented on 2007-04-10 00:21

out of sync as of 04092007.

Robert Kukla commented on 2007-04-10 06:58

What seems to be the problem? Works fine for me:

$ patch -p0 < mod_v0.14.patch
patching file apps/codecs/Makefile
patching file apps/codecs/mod.c
patching file apps/codecs/SOURCES
patching file apps/metadata.c
patching file apps/tree.c
patching file firmware/export/id3.h
patching file firmware/id3.c

denis commented on 2007-04-10 12:27

gives multiply “previous definition of “…” was here” errors in mod.c while compiling.

Robert Kukla commented on 2007-04-10 12:36

My guess is you didn’t properly undo the patch (revert is not enough) and now have the source code twice within mod.c. Have a look.

denis commented on 2007-04-10 15:41

thats what i thought at the beginning but i did the svn revert and applied it to the clean code. i’ll look into it more.

Robert Kukla commented on 2007-04-10 15:45

Like I said in my previous comment “svn revert” is not good enough. It will only deal with already existent files and not touch added files like mod.c.

Flake commented on 2007-04-13 03:43

What about .xm (Mad Tracker) and .it (Impulse Tracker) support?

Chris commented on 2007-04-13 03:46

Aye me wants that too

Robert Kukla commented on 2007-04-20 15:56

sync’ed

mind trip commented on 2007-05-16 08:00

anyone able to patch the latest rockbox build?
I fetched it from from csv today and get the following result:
[Code]
debian:/home/root/rockbox# patch -p0 < mod_v0.15.patch
patching file apps/codecs/Makefile
Hunk #1 FAILED at 48.
1 out of 1 hunk FAILED – saving rejects to file apps/codecs/Makefile.rej
patching file apps/codecs/mod.c
patching file apps/codecs/SOURCES
patching file apps/metadata.c
Hunk #1 succeeded at 1764 (offset 50 lines).
Hunk #2 succeeded at 2342 (offset 50 lines).
patching file apps/filetypes.c
Hunk #1 succeeded at 67 (offset -37 lines).
patching file firmware/export/id3.h
patching file firmware/id3.c
[/Code]

Any ideas?

Oleg G commented on 2007-05-29 11:52

It’s just the makefile, open the .rej file and change it yourself, it should only be one or two lines.

Adam Polkosnik commented on 2007-06-05 05:11

I’ve updated the patch and created a little workaround for problem with strncasecmp.

Adam Polkosnik commented on 2007-06-05 05:13

Should compile against the latest svn.

Adam Polkosnik commented on 2007-06-06 03:11

The previous patch broke after ape.c was added. Fixed patch.

Robert Kukla commented on 2007-06-17 12:03

synced after metadata.c split

Robert Kukla commented on 2007-08-15 09:43

synced after changes to get_metadata

Paul Spark commented on 2007-10-07 03:00

Hi. I’m new to this - I keep getting errors when trying to apply the mod_v0.19.patch. Can somebody please tell me what I’m doing wrong? I believe I have the latest Rockbox source.

Thank you
Paul

“patching file apps/codecs/Makefile
Hunk #1 FAILED at 48.
1 out of 1 hunk FAILED – saving rejects to file apps/codecs/Makefile.rej
patching file apps/codecs/mod.c
patching file apps/codecs/SOURCES
Hunk #1 FAILED at 12.
1 out of 1 hunk FAILED – saving rejects to file apps/codecs/SOURCES.rej
patching file apps/filetypes.c
Hunk #1 FAILED at 67.
1 out of 1 hunk FAILED – saving rejects to file apps/filetypes.c.rej
patching file apps/metadata.c
Hunk #1 FAILED at 293.
1 out of 1 hunk FAILED – saving rejects to file apps/metadata.c.rej”

Robert Kukla commented on 2007-10-08 12:02

It still applies fine, but here is a new patch anway

Paul Spark commented on 2007-10-10 07:21

:-( I just checked out the latest source from SVN and I’m afraid the 0.20 patch doesn’t work either.

Am I doing something wrong? I put the patch into the rockbox folder - the same folder where I can see apps, docs, bootloader folders etc. and tried “patch –binary -p0 5241_20.txt”

Any help would be appreciated. I’d love to get this to work.

Thanks

Robert Kukla commented on 2007-10-10 07:35

–binary is unnecessary/wrong

and I take it the missing < is just an oversight

patch -p0 < 5241_20.txt

Paul Spark commented on 2007-10-10 08:04

Thanks for that. Hehe. Silly me - I just started manually making the changes but thanks - it will help me with future patching attempts. Fingers crossed!! :^)

Paul Spark commented on 2007-10-10 18:00

Yay!! It all compiled fine.. Now which files (other than the .codec files) do I need to put onto the iPod please? Is there a document online somewhere on this site that describes the process of which files are required under the .rockbox folder on the iPod?

I appreciate your help and I’m sure anybody else reading this who is trying to do the same thing will also.
Cheers
Paul

Robert Kukla commented on 2007-11-06 12:42

sync

Adam Gashlin commented on 2007-11-09 06:16

use atomic buffer type (don’t blame me!)

Dave Chapman commented on 2007-12-04 20:33

This has been discussed in IRC a few times, but I thought it was worth adding here. There seems to be some concern over the license of this codec - the main codec file contains the text:

“* Sequencer taken from Gravis Ultrasound open source mod player (forgot the name, if anyone finds out, please insert *g* )”

The general view is that we can’t commit this to SVN and include in the official builds when the license to the source code is unknown - claiming that it was “open source’ isn’t enough. Can anyone identify the original mod player that the code in this codec comes from? Or failing that, maybe the sequencer could be replaced with one from a known (GPL-compatible) source?

(and a minor comment - my name shouldn’t be the (C) holder in apps/metadata/mod.c)

Jason Yu commented on 2007-12-18 15:31

Spent some time looking at the source a couple weeks ago, and it looks like it’s roughly based on an old, pre-commercial version of FMOD.

ftp://ftp.scene.org/mirrors/hornet/code/audio/docs/fmoddoc.zip

Rainer Sinsch commented on 2007-12-18 16:19

That seems to be correct, it is an old fmod version. Now what does that mean? The source states “public domain” - if we properly credit the author can we put it in SVN?

Dave Chapman commented on 2007-12-18 17:46

The license text in fmoddoc.zip seems to contradict itself:

“Legal Notice: This source is public domain. This code cannot be redistributed commercially, in any form whether source code or binary without the prior consent of the author.”

IIUC, by placing a work in the public domain the author is relinquishing all legal rights to it, and hence can’t dictate conditions on its use.

So I’m not sure if this helps us - we’ve moved from having no license, to having a nonsensical license…

I think the safest way is for someone to contact the author of fmod and ask for permission to use the code under a GPL-compatible license - i.e. one which doesn’t prevent commercial use.

Rainer Sinsch commented on 2008-02-13 10:27

Can someone please confirm that this codec will be included in the official branch once the license issues have been solved? I think the best way is to rewrite the sequencer code.

Thom Johansen commented on 2008-02-16 00:15

I can see no reason for it not to be commited if it works well and there are no further licensing issues.

Rainer Sinsch commented on 2008-02-18 21:24

Alright, I have started rewriting the whole player from scratch. A first impression should be ready next week.

Rainer Sinsch commented on 2008-02-24 23:04

Just wanted everyone to know that the new license-free routine made some progress. It can now load and play basic .mod files. More to come in a few days.

Robert Kukla commented on 2008-02-25 12:58

adapt change from r16410

Rainer Sinsch commented on 2008-02-25 14:58

I have a license question: Can we make use of the original amiga period values out of the amiga protracker source code? Or do we have to calculate them on start? Or in general: Can precalced tables be copyrighted (especially if the calculation is not a secret)? What if I precalc them “offline” and include them so they look the same way as the original?

Just to make sure we don’t have any future license issue.

Rainer Sinsch commented on 2008-02-27 22:47

Here we go with the first release of the license free mod codec.

First of all the good news:
- Fresh from my fingers and totally license free. Doesn’t even make use of “magic tables”.
- Support for more file formats (e.g. 15 instrument files)
- Improved mixing routine (sounds by far better!). There was a major bug in the old routine *g*
- Improved playing and effects handling (especially for chip-tunes)

Now the bad news (for now):
- It plays fine in the simulator, but does not on the real machine. I have yet no idea why this is so.
- Seems to have problems with some mod files (requires some more bugfixing)
- There are some enhanced effects (0xe) missing. I will add that later.

For installing simply apply the above patch and replace mod.c with the new one. I tried hard to include lots of comments, so help is welcome.

   mod.c (33 KiB)
Admin
Linus Nielsen Feltzing commented on 2008-02-27 22:59

Good work!

But I think it’s a pity that you spent all this time rewriting from scratch and didn’t follow the coding guidelines in docs/CONTRIBUTING…

Rainer Sinsch commented on 2008-02-28 18:51

The license-free routine now plays fine under both simulator and machine. I also removed the typedefs in order to start following the coding guidelines (thanks Linus).

Still to do:
- Effect bugfixing
- Adding the ID3 features / instrument name display from the old source

   mod.c (33.6 KiB)
Admin
Linus Nielsen Feltzing commented on 2008-02-28 19:23

Good work once more!

I still have issues with the coding style. Here is an excerpt from docs/CONTRIBUTING:


Identifiers


We do not want mixed case identifiers.
Variables and function names should be all lower case.
Struct and enum names should be all lower case.
Preprocessor symbols and enum constants should be all upper case.

Comments


We only use plain old /* C standard comments */.
If you want to comment out large blocks containing other comments, use #if 0.

Style


When changing code, follow the code style of the file you are editing.

When writing new files, you may use the brace placement style of your choice.

Braces for function declarations are put in a new line under the name, as in:

int foo(char *name)
{
   return FOO_NAME:
}

Always indent your code with four spaces. Don’t use TAB characters, as that
will mess up code display in CVS, printing, and a zillion other places.

Keep lines below 80 columns length. Use whitespace and newlines to make the
code easy to browse/read.


I hope you decide to try to follow them, it would be a shame to miss out this new shiny codec because of that.

Regards,

Linus

Rainer Sinsch commented on 2008-02-28 21:17

I promise I will completely follow the guidelines, soon ;) Anyway here is the latest version including effect bugfixes. A lot of modules should play now.

Rainer Sinsch commented on 2008-02-28 21:19

attachement…

   mod.c (34.3 KiB)
Rainer Sinsch commented on 2008-03-03 20:53

I moved the whole license free mod codec to http://www.rockbox.org/tracker/task/8680. I’d suggest we don’t use the old codec anymore and concentrate on bugfixing the new one.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing