Rockbox

Tasklist

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

Attached to Project: Rockbox
Opened by Rainer Sinsch (myth) - Wednesday, 26 April 2006, 20:59 GMT
Last edited by Dave Chapman (linuxstb) - Monday, 03 March 2008, 21:37 GMT
Task Type Patches
Category Codecs
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

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)
This task depends upon

Closed by  Dave Chapman (linuxstb)
Monday, 03 March 2008, 21:37 GMT
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
2008-04-23: A request to re-open the task has been made. Reason for request: In the license you can ask that the author or someones that knows the source, to report it, and then if he/she/it wants to, then take it down, or if he/she/it does not mind, then keep it. IMHO, i think there should be no probs.
Comment by Rainer Sinsch (myth) - Wednesday, 26 April 2006, 22:38 GMT
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)
Comment by Eli Sherer (elisherer) - Thursday, 27 April 2006, 16:31 GMT
I'm pissing my pants right now...can't wait to test it!!!
Comment by Eli Sherer (elisherer) - Thursday, 27 April 2006, 19:07 GMT
it really works!!!!

download experimental 2.4.17 with this patch

http://plugbox.rockbox-lounge.de/rockbox-2-4-17-mod.zip
Comment by Eli Sherer (elisherer) - Thursday, 27 April 2006, 20:57 GMT Comment by Mathieu Stempell (dma) - Saturday, 17 June 2006, 16:52 GMT
Nice work, but a codec not limited to MOD files would be so much more interesting. :)
Comment by Rainer Sinsch (myth) - Tuesday, 27 June 2006, 14:28 GMT
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.
Comment by Rainer Sinsch (myth) - Tuesday, 18 July 2006, 21:34 GMT
Here is an update for the latest CVS. It now merges fine together with SID codec.
Comment by Travis Hayes (travishayes89) - Saturday, 22 July 2006, 03:48 GMT
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"
Comment by Dominik Riebeling (bluebrother) - Saturday, 22 July 2006, 06:51 GMT Comment by Travis Hayes (travishayes89) - Saturday, 22 July 2006, 16:54 GMT
thanks
Comment by Norbert Preining (norbusan) - Tuesday, 29 August 2006, 09:08 GMT
JFYI: Does no apply to the new codec system. I guess it needs some rework.

Ciao
Norb
Comment by Robert Kukla (roolku) - Wednesday, 30 August 2006, 18:05 GMT
Adapted to current CVS. It works fine - hope I haven't missed anything.
Comment by Norbert Preining (norbusan) - Monday, 30 October 2006, 10:06 GMT
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
Comment by Robert Kukla (roolku) - Monday, 30 October 2006, 10:49 GMT
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. ;)
Comment by Norbert Preining (norbusan) - Monday, 30 October 2006, 12:10 GMT
Thanks, this did work.
Comment by Robert Kukla (roolku) - Friday, 10 November 2006, 13:29 GMT
updated to work with current CVS
Comment by Dan (Skyly) - Monday, 13 November 2006, 18:07 GMT
Works with the Nov 13 build too. God bless you for this patch hehe.
Comment by Dan (Skyly) - Tuesday, 14 November 2006, 06:38 GMT
Doh, except any mod you play gets stuck on repeat, so they'll hold up a playlist you put them in.
Comment by Rainer Sinsch (myth) - Monday, 11 December 2006, 13:03 GMT
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)
Comment by Dominik Riebeling (bluebrother) - Monday, 11 December 2006, 22:08 GMT
I just tried it on h120, current cvs -- I get hard lockups of my player :(
Comment by Robert Kukla (roolku) - Tuesday, 12 December 2006, 00:07 GMT
fixed :)
Comment by Robert Kukla (roolku) - Tuesday, 12 December 2006, 17:37 GMT
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.
Comment by Rainer Sinsch (myth) - Tuesday, 12 December 2006, 18:17 GMT
You guys rock!
Comment by Robert Kukla (roolku) - Wednesday, 10 January 2007, 18:49 GMT
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.
Comment by Chris (decayed.cell) - Sunday, 28 January 2007, 02:08 GMT
Needs updating for today's SVN. Is it possible to also implement a FastTracker player (i.e. xmz)?
Comment by Robert Kukla (roolku) - Sunday, 28 January 2007, 13:05 GMT
Updated patch.
Comment by Robert Kukla (roolku) - Wednesday, 07 February 2007, 16:16 GMT
synched
Comment by Robert Kukla (roolku) - Saturday, 10 February 2007, 17:13 GMT
synched again
Comment by Michael Sevakis (MikeS) - Saturday, 10 February 2007, 17:24 GMT
That was quick :)
Comment by Robert Kukla (roolku) - Monday, 26 February 2007, 18:09 GMT
incorporated MikeS' replaygain fix
Comment by denis (perldiver) - Saturday, 10 March 2007, 06:09 GMT
needs an update. amazing patch by the way.
Comment by Robert Kukla (roolku) - Saturday, 10 March 2007, 10:44 GMT
what do you mean by update? It works with current svn?
Comment by denis (perldiver) - Saturday, 10 March 2007, 15:08 GMT
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.
Comment by Robert Kukla (roolku) - Thursday, 29 March 2007, 18:42 GMT
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.
Comment by Dominik Riebeling (bluebrother) - Thursday, 29 March 2007, 19:27 GMT
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 ;-)
Comment by Robert Kukla (roolku) - Thursday, 29 March 2007, 22:45 GMT
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.
Comment by denis (perldiver) - Tuesday, 10 April 2007, 00:21 GMT
out of sync as of 04092007.
Comment by Robert Kukla (roolku) - Tuesday, 10 April 2007, 06:58 GMT
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
Comment by denis (perldiver) - Tuesday, 10 April 2007, 12:27 GMT
gives multiply "previous definition of "..." was here" errors in mod.c while compiling.
Comment by Robert Kukla (roolku) - Tuesday, 10 April 2007, 12:36 GMT
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.
Comment by denis (perldiver) - Tuesday, 10 April 2007, 15:41 GMT
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.
Comment by Robert Kukla (roolku) - Tuesday, 10 April 2007, 15:45 GMT
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.
Comment by Flake (Flake) - Friday, 13 April 2007, 03:43 GMT
What about .xm (Mad Tracker) and .it (Impulse Tracker) support?
Comment by Chris (decayed.cell) - Friday, 13 April 2007, 03:46 GMT
Aye me wants that too
Comment by Robert Kukla (roolku) - Friday, 20 April 2007, 15:56 GMT
sync'ed
Comment by mind trip (mindtrip) - Wednesday, 16 May 2007, 08:00 GMT
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?
Comment by Oleg G (MadCow15) - Tuesday, 29 May 2007, 11:52 GMT
It's just the makefile, open the .rej file and change it yourself, it should only be one or two lines.
Comment by Adam Polkosnik (apolkosnik) - Tuesday, 05 June 2007, 05:11 GMT
I've updated the patch and created a little workaround for problem with strncasecmp.
Comment by Adam Polkosnik (apolkosnik) - Tuesday, 05 June 2007, 05:13 GMT
Should compile against the latest svn.
Comment by Adam Polkosnik (apolkosnik) - Wednesday, 06 June 2007, 03:11 GMT
The previous patch broke after ape.c was added. Fixed patch.
Comment by Robert Kukla (roolku) - Sunday, 17 June 2007, 12:03 GMT
synced after metadata.c split
Comment by Robert Kukla (roolku) - Wednesday, 15 August 2007, 09:43 GMT
synced after changes to get_metadata
Comment by Paul Spark (Sparky74) - Sunday, 07 October 2007, 03:00 GMT
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"

Comment by Robert Kukla (roolku) - Monday, 08 October 2007, 12:02 GMT
It still applies fine, but here is a new patch anway
Comment by Paul Spark (Sparky74) - Wednesday, 10 October 2007, 07:21 GMT
:-( 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
Comment by Robert Kukla (roolku) - Wednesday, 10 October 2007, 07:35 GMT
--binary is unnecessary/wrong

and I take it the missing < is just an oversight

patch -p0 < 5241_20.txt
Comment by Paul Spark (Sparky74) - Wednesday, 10 October 2007, 08:04 GMT
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!! :^)
Comment by Paul Spark (Sparky74) - Wednesday, 10 October 2007, 18:00 GMT
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
Comment by Robert Kukla (roolku) - Tuesday, 06 November 2007, 12:42 GMT
sync
Comment by Adam Gashlin (AdamGashlin) - Friday, 09 November 2007, 06:16 GMT
use atomic buffer type (don't blame me!)
Comment by Dave Chapman (linuxstb) - Tuesday, 04 December 2007, 20:33 GMT
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)
Comment by Jason Yu (captainkewl) - Tuesday, 18 December 2007, 15:31 GMT
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
Comment by Rainer Sinsch (myth) - Tuesday, 18 December 2007, 16:19 GMT
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?
Comment by Dave Chapman (linuxstb) - Tuesday, 18 December 2007, 17:46 GMT
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.
Comment by Rainer Sinsch (myth) - Wednesday, 13 February 2008, 10:27 GMT
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.
Comment by Thom Johansen (preglow) - Saturday, 16 February 2008, 00:15 GMT
I can see no reason for it not to be commited if it works well and there are no further licensing issues.
Comment by Rainer Sinsch (myth) - Monday, 18 February 2008, 21:24 GMT
Alright, I have started rewriting the whole player from scratch. A first impression should be ready next week.
Comment by Rainer Sinsch (myth) - Sunday, 24 February 2008, 23:04 GMT
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.
Comment by Robert Kukla (roolku) - Monday, 25 February 2008, 12:58 GMT
adapt change from r16410
Comment by Rainer Sinsch (myth) - Monday, 25 February 2008, 14:58 GMT
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.
Comment by Rainer Sinsch (myth) - Wednesday, 27 February 2008, 22:47 GMT
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)
Comment by Linus Nielsen Feltzing (linusnielsen) - Wednesday, 27 February 2008, 22:59 GMT
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...

Comment by Rainer Sinsch (myth) - Thursday, 28 February 2008, 18:51 GMT
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)
Comment by Linus Nielsen Feltzing (linusnielsen) - Thursday, 28 February 2008, 19:23 GMT
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
Comment by Rainer Sinsch (myth) - Thursday, 28 February 2008, 21:17 GMT
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.
Comment by Rainer Sinsch (myth) - Thursday, 28 February 2008, 21:19 GMT
attachement...
   mod.c (34.3 KiB)
Comment by Rainer Sinsch (myth) - Monday, 03 March 2008, 20:53 GMT
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...