Rockbox Technical Forums

Support and General Use => Audio Playback, Database and Playlists => Topic started by: mahen on June 07, 2006, 02:14:29 PM

Title: .mod file format ?
Post by: mahen on June 07, 2006, 02:14:29 PM
Hi everyone !

I'm wondering if anyone is working on a plugin for playing oldschool formats such as the .mod (Amiga), .s3m (pc), .sid (c64) files etc. ?


cheers !
Title: Re: .mod file format ?
Post by: Llorean on June 07, 2006, 02:19:47 PM
There's a working patch in the tracker for .sid, and I *think* a work in progress one for .mod.
Title: Re: .mod file format ?
Post by: theli on June 07, 2006, 02:53:54 PM
and i've created a quick'n'dirty hack for .spc :) ... it is somewhere on tracker ... though it runs at about 20-30% speed.. just hadn't enough enthusiasm and noone seemed interested
Title: Re: .mod file format ?
Post by: adam917 on June 07, 2006, 03:00:54 PM
and i've created a quick'n'dirty hack for .spc :) ... it is somewhere on tracker ... though it runs at about 20-30% speed.. just hadn't enough enthusiasm and noone seemed interested
I'm very interested in listening to SPCs on my RB unit. Unfortunately, I never coded before nor have ever seen source code.
Title: Re: .mod file format ?
Post by: mahen on June 07, 2006, 05:26:35 PM
Wow, thanks for the replies ! :) Sounds promising ;)

Actually I would be much interested in .spc support ;) What lib / player code are you using atm ?
Title: Re: .mod file format ?
Post by: drwowe on June 07, 2006, 07:41:28 PM
+1 for .mod!  There was some awesome protracker music back in the day.  it would be especially cool for those flash memory players.  8 million songs on an iPod nano?

While we're at it, how about a timidity port as well?  :)
Title: Re: .mod file format ?
Post by: fizze on June 08, 2006, 03:10:22 AM
I donno what player you have, but the H300 experimental build I use from misticriver forums plays mod and the likes quite happily. :)

not as cool as, say, inertia tracker, but still... :D tee-hee
Title: Re: .mod file format ?
Post by: mahen on June 08, 2006, 04:18:36 AM
ipod nano here... Doesn' t seem to support .mod's...

BTW, I tried a couple of .mid, it doesn't play properly at all (buffer underflow it seems, and maybe too fast also ;)
Title: Re: .mod file format ?
Post by: rasher on June 08, 2006, 04:38:12 AM
Mod support is available as a patch (http://www.rockbox.org/tracker/task/5241) that is not incorporated in Rockbox yet.

It probably will be when the code freeze is liftet. You may or may not be able to find a precompiled build including this patch for your player.

MIDI support already exists in Rockbox as a viewer plugin, and more than anything else, it needs optimisation to be able to play more smoothly.
Title: Re: .mod file format ?
Post by: theli on June 08, 2006, 04:51:22 AM
Actually I would be much interested in .spc support ;) What lib / player code are you using atm ?
as i've said - a quick and _dirty_ patch is availible on tracker
it is here
http://www.rockbox.org/tracker/task/2727
as you can see it uses openspc
Title: Re: .mod file format ?
Post by: orfax on June 09, 2006, 02:14:05 AM
.mod: I see DUMB is included in the CVS code (in the codecs directory), but not being used yet. What's the status with it?

DUMB=.mod, .s3m, .it, .xm (and a pretty good implementation to boot).
Title: Re: .mod file format ?
Post by: dma on June 17, 2006, 01:14:33 PM
Indeed a DUMB implementation would be muuuch more interesting than just .MOD support. :)

And concerning emu-formats, maybe NezPlug (http://nezplug.sourceforge.net/) could also be impemented?
It would allow replay of so many formats: http://nezplug.sourceforge.net/in_nez.txt

I hope that SID codec will be added to main builds anytime soon. ;D

(i've put all this in the feature requests already ;))


I'm really dying for such formats now. But it seems to be so low priority or maybe not much coders are interested in this, i don't really know. :-[

Everytime i tell about RockBox being based on a codec system, the same question comes up "Oh then does it support tracker / SNES / SID / SNDH / NES / etc... replay?".

"Not yet but it could." ::)
Title: Re: .mod file format ?
Post by: Llorean on June 17, 2006, 02:41:40 PM
Well remember Rockbox is in feature freeze.
SID, and MOD and others CANNOT be included until the freeze ends.
Title: Re: .mod file format ?
Post by: orfax on June 17, 2006, 10:51:44 PM
I'm really dying for such formats now. But it seems to be so low priority or maybe not much coders are interested in this, i don't really know. :-[
I'm interested in using DUMB. I've now played around with it a bit (created a codec), but there are some issues (such as no sound). The version thats in rockbox is an old version. It appears to be modified a little. I have quite a few .xm and .it files so thats why I'm interested in getting something working.

Well remember Rockbox is in feature freeze.
SID, and MOD and others CANNOT be included until the freeze ends.
And once the release has been made I will be on IRC to ask a few questions about DUMB and rockbox.
Title: Re: .mod file format ?
Post by: Llorean on June 17, 2006, 10:56:08 PM
I know the devs are interested in those formats.

You should've seen them when the SID codec showed up in the tracker. :)
Title: Re: .mod file format ?
Post by: Sherv on June 19, 2006, 10:20:27 AM
Actually I would be much interested in .spc support ;) What lib / player code are you using atm ?
as i've said - a quick and _dirty_ patch is availible on tracker
it is here
http://www.rockbox.org/tracker/task/2727
as you can see it uses openspc

Sweet!! It's always been a dream of mine to have portable SPCs and NSFs....one day, hopefully :)
Title: Re: .mod file format ?
Post by: orfax on June 22, 2006, 06:11:13 PM
I've now played around with it a bit (created a codec), but there are some issues (such as no sound). The version thats in rockbox is an old version. It appears to be modified a little.
I have created a working codec using DUMB that plays .mod, .xm, .it & .s3m, BUT (and its a big but) only for the simulator. DUMB uses some floating point functions (floor, pow, log, exp) in order to play these formats. The modified rockbox version had these functions #define'd to something else which breaks playback. As I believe we don't have the floating point functions available for the host devices (ie ipod, iriver, etc)  as there is no FPU, I don't think we can use DUMB in its current form.

I'm now having a look at libmikmod (which is used in the PS2 dev community though I haven't used it before). It looks promising as it appears it doesn't use floating point functions. The added benefits are that it supports even more formats (669, med, plus more), though I'm not sure what the quality is like.
Title: Re: .mod file format ?
Post by: dma on June 23, 2006, 05:57:45 AM
Orfax : Ah great news that you're looking at those replay routs. :)

LibMikMod seems to have been the choice for tracker replay in iPodLinux, so it might be a good one to try indeed.
Its replay is good as far as i recall hearing tunes replayed with it.
Title: Re: .mod file format ?
Post by: orfax on June 27, 2006, 09:25:11 PM
I'm now having a look at libmikmod
I've played around with libmikmod and had a working version of the codec in the simulator.

The following is going to be a little technical...

There are a couple of issues between rockbox and libmikmod (both define BOOL and use it differently) so I've made some changes to libmikmod and created a rockbox driver for it. libmikmod also doesn't provide a way of finding out how long a song is. The codec build in the simulator is a little too big (around 540K) as there is a limit of 512K for a codec, at least for an ipod simulator build. I can strip the debug stuff out and it falls down to ~160K. There are a number of functions that reference FILE * that would never be used so I could remove these and hope the build falls under 512K. Or remove some of the file format loaders, but I don't want to do this. I also only include the rockbox driver, so nothing like the wav file driver, OSS driver, Windows MM driver, etc is included.

Happy with that, I tried to do an ipod build, but came across more problems. There are a number of standard library (and non standard but often available) functions it needs (ie isalnum, malloc, sprintf, strdup, strncat, strncpy,...). Some of these I've had to write myself (strdup, strncat) and others I've referenced the code from firmware/common. Eventually it built, but I decided to remake the simulator again because of the changes. Now the codec in the simulator no longer works, but I'll fix that soon.

Hopefully shortly I'll have a working codec on actual hardware.
Title: Re: .mod file format ?
Post by: orfax on June 29, 2006, 11:14:09 PM
Hopefully shortly I'll have a working codec on actual hardware.
Unfortunately this will not happen soon. After a bit more investigation, the memory consumption of libmikmod is too high for Rockbox. For my test mod (~200K) it allocated around 750K in internal structures. This of course is much higher than is available for a codec. This means to be able to use libmikmod much of the code will need to be rewritten to utilize less memory. Not a simple task. I'm unlikely to do any more to this (my hope was to be able to use an existing library).
Title: Re: .mod file format ?
Post by: dma on July 24, 2006, 07:37:41 AM
Great to have a SID emulation codec!
The emulation isn't the most faithful, but it isn't bad either. :)

I can now browse HVSC (http://www.hvsc.c64.org/) in my H120 to discover new gems, yeah! :)

Could the "durations" file of HVSC be implemented in the codec btw?
Title: Re: .mod file format ?
Post by: iobound on July 26, 2006, 08:30:36 AM
I've now played around with it a bit (created a codec), but there are some issues (such as no sound). The version thats in rockbox is an old version. It appears to be modified a little.
I have created a working codec using DUMB that plays .mod, .xm, .it & .s3m, BUT (and its a big but) only for the simulator. DUMB uses some floating point functions (floor, pow, log, exp) in order to play these formats. The modified rockbox version had these functions #define'd to something else which breaks playback. As I believe we don't have the floating point functions available for the host devices (ie ipod, iriver, etc)  as there is no FPU, I don't think we can use DUMB in its current form.

About half a year ago, I created a plugin (not a codec) which includes realtime playback with sound in simulator, plus a disk-writer (since it's not running at 100% speed and also because play_pcm() in CVS was broken for plugins at the time) for the target device (h340). The disk-writer on the iriver produced a bit-perfect raw pcm file compared to the same code running on the simulator.

I solved the floating point issues by porting the necessary maths routines from FreeBSD's math library as well. Unfortunately I kind of lost interest, but I posted what I got to the tracker at http://www.rockbox.org/tracker/task/2793 .
Title: Re: .mod file format ?
Post by: orfax on July 28, 2006, 09:17:20 AM
I solved the floating point issues by porting the necessary maths routines from FreeBSD's math library as well. Unfortunately I kind of lost interest, but I posted what I got to the tracker at http://www.rockbox.org/tracker/task/2793 .
Cool. I'll have a look at what you have done. It doesn't sound promising about the memory allocation / free thing though.

I also have another library I want to try out, which is xmp.
Title: Re: .mod file format ?
Post by: Starius on January 17, 2007, 06:04:37 PM
If you guys ever do get amiga mod (.mod, .it, .s3m, .xm, etc) supported in RockBox, I'd consider buying a ipod just to use it.  

I see this thread hasn't been updated in awhile, any progress here?
Title: Re: .mod file format ?
Post by: Llorean on January 17, 2007, 06:09:08 PM
http://www.rockbox.org/tracker/task/5241
Title: Re: .mod file format ?
Post by: Starius on January 17, 2007, 06:26:59 PM
http://www.rockbox.org/tracker/task/5241
Ah, thanks for the link there.
Title: Re: .mod file format ?
Post by: gnu on January 22, 2007, 01:50:31 PM
You could also use IPL, someone made a module that plays most mod formats..
Title: Re: .mod file format ?
Post by: cynric on February 01, 2007, 06:14:30 PM
this is a great addon indeed!
but unfortunately most of my old modfiles have thier comments filled with not that useful data. so updating my ID3 tag database reads these tags and totally screws up my database. is it possible to still read the tags in the NPS but to exclude them from the database indexing??
Title: Re: .mod file format ?
Post by: Llorean on February 01, 2007, 10:38:59 PM
Disable auto-update and copy them off the player before running the initialize, then back on after it's done.

Right now there's no way to set it to skip certain folders.
Title: Re: .mod file format ?
Post by: cynric on February 03, 2007, 12:46:58 PM
thanks, it works this way... maybe a ".skipdir" file or something like that to make DB indexing skip the current folder (and its subfolders) would be useful for these formats; the meanwhile fully impemented .nsf format might cause similar problems (did not test it yet).
strangely rockbox now reads all my genre tags wrong, but that is likely to be some other problem..
Title: Re: .mod file format ?
Post by: princessblacklung on February 15, 2007, 09:17:45 AM
Wow, I was just about to jump off a bridge until I found this post - chip tunes ahoy!