#125676 - 0xtob - Sun Apr 15, 2007 11:44 pm
Due to popular demand, I decided to release the current state of NitroTracker's XM player core as an open source library for use in DS apps and games.
More info in the post on my blog:
http://blog.dev-scene.com/0xtob/2007/04/15/libntxm-v01-nitrotracker-xm-library-alpha/
The library is available from Google Code here:
http://code.google.com/p/libntxm/
If you have any questions on using it or if you want to help me developing it, post here!
Happy hacking!
_________________
http://blog.dev-scene.com/0xtob | http://nitrotracker.tobw.net | http://dsmi.tobw.net
Last edited by 0xtob on Wed Apr 16, 2008 1:40 am; edited 1 time in total
#125690 - Neil - Mon Apr 16, 2007 1:14 am
COOL! Thanks Tob. I'm starting to work on something which may need this, and which I hope may possibly be useful in conjunction with Nitrotracker.
#125743 - melw - Mon Apr 16, 2007 3:27 pm
Nice!
Hopefully this will stir some development around a better opersource NDS module playback engine... May use this myself as well. :)
#125761 - Jevin - Mon Apr 16, 2007 7:29 pm
Thanks a bunch for opening this up! I was really interested to see what you were doing with the XM stuff in NitroTracker (a great app, btw).
#125766 - tepples - Mon Apr 16, 2007 8:03 pm
Would it be difficult to add support for MOD and S3M to this library? S3M uses unsigned 8-bit samples just like RIFF WAVE, so you would have to invert the most significant bit at load time, but that's not a problem.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#125781 - 0xtob - Mon Apr 16, 2007 11:25 pm
tepples: You just have to derive a new class from FormatTransport and implement a load function that fills the a Song object with pattern data and Instruments. The XM loader should be a good reference for that. Since XM is an extension of MOD, this should be pretty straightforward, except for the hassle with all these MOD subformats. I haven't looked at S3M yet, so I'm not sure about the instrument settings and effects in S3M and how well they integrate with the current scheme.
Imports for other formats would be extremely welcome! I'd be glad to give advice wherever I can.
_________________
http://blog.dev-scene.com/0xtob | http://nitrotracker.tobw.net | http://dsmi.tobw.net
#125925 - LiraNuna - Wed Apr 18, 2007 8:45 am
FINALLY! \o/
After my own S3M player died...
Great job, tob
_________________
Private property.
Violators will be shot, survivors will be shot again.
#125945 - Sunray - Wed Apr 18, 2007 11:50 am
You can't play a S3M module with a XM player though. I've spent a year of emulating Fast Tracker 2 and Scream Tracker 3 as best as possible. And, it turned out to be one of the most accurate XM player I've heard. Un4seens XMPlay is also very good but I've found some cases where it doesn't play as FT2 does where mine does. And vice versa. S3M emulation is also top notch (except for missing Adlib emulation :)).
#125993 - xrl - Wed Apr 18, 2007 11:06 pm
I hope that's better than moonshell's xm player! I can't listen to music with all that clicks :P
#126578 - litghost - Tue Apr 24, 2007 6:23 pm
I used the alpha of libntxm in my DLDI port of LemmingsDS and I made some modifications for stop notification callbacks, volume control, and one shot sample playback of raw PCM files. I also modified the Makefiles and files to use a set of common files where applicable between the ARM7 and ARM9 instead of having two sets in the arm7 and arm9 directories. I don't know if you want to merge these into your source or not, but here are the modified sources.
#128077 - gorgull - Tue May 08, 2007 12:16 pm
I tested you modified library, no problem using it, but it doesn't play my example xm track correctly, whereas the original one does.
Here's the xm file I used for my tests: http://www.demoscene.hu/trajic/serve?q=http%3A%2F%2Fwww.demoscene.hu%2Ftrajic%2Ffiles%2Fgreentwn.xm
#128104 - litghost - Tue May 08, 2007 5:20 pm
I used the demo app using the original library and and my modified one to play your xm and did not notice any difference. Can you be more specific? I should not have modified any thing in the player beyond volume control.
#128145 - Darkflame - Wed May 09, 2007 12:04 am
*hopes someone writes a DSO plugin*
_________________
Darkflames Reviews --
Make your own at;
Rateoholic:Reviews for anything, by anyone.
#128171 - gorgull - Wed May 09, 2007 9:24 am
I just made the test using the demoapp:
Playing the track:
http://www.demoscene.hu/trajic/serve?q=http%3A%2F%2Fwww.demoscene.hu%2Ftrajic%2Ffiles%2Fgreentwn.xm
you should here the difference at 00:20, when the chorus begins. Notes seem to be played louder and cut before the end.
Can you hear the same thing on your DS?
#128175 - kusma - Wed May 09, 2007 10:46 am
gorgull: Try cutting down the module until you've isolated the problem. That will make it a lot easier to debug.
#128291 - gorgull - Thu May 10, 2007 9:21 am
I recorded two times the same part of my test-xm file played with demoapp, once using the original library, and another time using the libghost's hacked one:
http://bozo.ovh.net/~gorgull/Soundz/libntxm/libntxm.ogg
http://bozo.ovh.net/~gorgull/Soundz/libntxm/libntxm_hack.ogg
I noticed another issue: when I restart the track playing in the demoapp by pressing A once again, I can hear some constant noise in the background.
#128293 - kusma - Thu May 10, 2007 9:26 am
Sorry, I guess I should clarify a bit. Try cutting/stripping down the module itself, not the rendered output. If you can isolate what effect or state that triggers the issue, it'll be a lot easier for the developers to debug. This would mean removing orders and notes until you have only what is strictly needed to trigger the error.
#128294 - gorgull - Thu May 10, 2007 9:34 am
I guessed you were talking about cutting the xm file, but the problem is I've got no idea how to edit an xm file :-p
Nevertheless, I thought it could help.
Maybe someone has some knowledge in xm format?
#128312 - tepples - Thu May 10, 2007 2:42 pm
gorgull wrote: |
I guessed you were talking about cutting the xm file, but the problem is I've got no idea how to edit an xm file :-p |
http://www.modplug.com/
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#128314 - litghost - Thu May 10, 2007 3:15 pm
Wow, that sounds terrible. I am not seeing the same thing you are seeing however. Try using http://www.sendspace.com/file/l78wn2 and rename your file to test.xm in the root of your flash card and playing it. Don't forget to patch DLDI. That binary works fine on my DS and volume works too with your xm. I cannot replicate what you have yet.
#128317 - gorgull - Thu May 10, 2007 4:03 pm
mmmh... the song plays correctly using the demoapp you provided me.
Maybe you don't have the same version of the libnds as mine - I tried to recompile your modified libntxm library, then recompiled your demoapp, but I've got exactly the same problem at the end.
Last edited by gorgull on Thu May 10, 2007 4:13 pm; edited 2 times in total
#128318 - litghost - Thu May 10, 2007 4:11 pm
I doubt it is a difference in libnds versions. Which version do you have? You are compiling the demo app provided, correct?
#128319 - gorgull - Thu May 10, 2007 4:13 pm
it seems a simple volume change (using up/down) makes my compiled demoapp work fine on my DS - uninitialized variable?! :-p
#128322 - litghost - Thu May 10, 2007 4:18 pm
That makes sense.
#128363 - 0xtob - Fri May 11, 2007 12:53 am
Sorry for taking forever to reply, I'm pretty busy atm.
litghost: Great work with your modifications! It seems open sourcing it was a good idea :) I'll merge your modifications into the lib.
About the bug: The problem occurs when the player volume is close to 255 (the value that it's initialized with on the arm7). Your arm9 code only allows for volumes ranging from 0-127, so you can only reproduce the bug if you don't touch the volume. I'm not sure what's causing the problem though. The code looks OK to me. I'll look into it.
_________________
http://blog.dev-scene.com/0xtob | http://nitrotracker.tobw.net | http://dsmi.tobw.net
#128377 - litghost - Fri May 11, 2007 1:48 am
I think volumes are signed, and not designed to operate at >127.
#128413 - gorgull - Fri May 11, 2007 8:55 am
I confirm that setting "MRD_player_volume" to 127 by default (instead of 255) in arm7/source/player.cpp line 35, fixes the problem.
#128416 - 0xtob - Fri May 11, 2007 9:15 am
No, the volume (MRD_player_volume) is unsigned and goes from 0-255. In the ARM7 code, it's multiplied by the original volume and the resulting value is shifted right by 8 places, i.e. divided by 255. So, setting the volume to 127 means that the song is played at only half the volume.
_________________
http://blog.dev-scene.com/0xtob | http://nitrotracker.tobw.net | http://dsmi.tobw.net
#128450 - litghost - Fri May 11, 2007 5:01 pm
That would make sense wouldn't it? But that is not how it works out. Try the demo code and allow the volume to go up to 255. Any volume greater than 127 does not work right. I cannot really explain it.
#151420 - PypeBros - Mon Feb 25, 2008 10:37 pm
there's one thing i don't get about fade handling ... It looks like all the code that is supposed to have some effect (e.g. modify SCHANNEL_VOL or SCHANNEL_CR) in player::handleFade() is commented out in my copy of the library.
Am i missing something ?
_________________
SEDS: Sprite Edition on DS :: modplayer
#151421 - 0xtob - Mon Feb 25, 2008 11:09 pm
Yes your are :) The channel volumes atr updated in line 324 of player.cpp
Code: |
SCHANNEL_VOL(channel) = SOUND_VOL(chnvol); |
Earlier I was updating the channel volumes in several places, which are now commented out.
_________________
http://blog.dev-scene.com/0xtob | http://nitrotracker.tobw.net | http://dsmi.tobw.net
#151422 - nanou - Tue Feb 26, 2008 12:16 am
0xtob, it's nice to see this come full circle.
_________________
- nanou
#151523 - PypeBros - Thu Feb 28, 2008 9:09 am
hey again.
I tried to add portamento effect in your player, but i can't get it working right. I try to use the Sample::BendNote() function, but i'm not quite sure i get the role of _note, _basenote and _finetune right.
Code: |
void Sample::bendNote(u8 note, u8 basenote, u8 finetune, u8 channel)
{
// Add 48 to the note, because otherwise absolute_note can get negative.
// (The minimum value of relative note is -48)
u8 absolute_note = note + 48;
u8 srcsmp, realnote;
u8 base_absolute_note = basenote + 48;
u8 base_octave = (base_absolute_note+rel_note) / 12;
if(base_octave <= 12) {
srcsmp = 0;
realnote = (absolute_note+rel_note);
} else {
srcsmp = base_octave-12;
realnote = (absolute_note+rel_note) - 12 * srcsmp;
}
/** LOOKUP_FREQ(note,finetune)
* (linear_freq_table_lookup(MAX(0,N_FINETUNE_STEPS*(note)+(finetune))))
*/
SCHANNEL_TIMER(channel) = SOUND_FREQ((int)LOOKUP_FREQ(realnote,finetune));
} |
Which i am using this way:
Code: |
case(EFFECT_PORTA_UP): {
// not yet working quite right. When multiplied by 16 instead of
// 8, we can hear the note "falling back" and the sliding up again
// as if finetune wrapped.
// note : we have only 8 bits for finetune !
effstate.actual_finetune[channel]+=param<<3;
Instrument *inst = song->instruments[state.channel_instrument[channel]];
inst->bendNote(state.channel_note[channel],
state.channel_note[channel],
effstate.actual_finetune[channel],
channel);
break;
}
|
My best guess is that i should increase the _note too when 'finetune' wraps ... but i'm not too sure about the <<3 thingy either (which i plan to validate experimentally ... Note: i experimentally tested the whole thing with /music/dalezy-beercan_pyramid.xm which reports to use linear frequencies.
_________________
SEDS: Sprite Edition on DS :: modplayer
#151562 - HyperHacker - Fri Feb 29, 2008 6:22 am
Was I the only one who wondered how you were playing satellite radio on the DS? :P
_________________
I'm a PSP hacker now, but I still <3 DS.
#151563 - eKid - Fri Feb 29, 2008 6:46 am
Hey, where do I get the source.. :/
I can probably add a bunch of effects, and I would love to see effect support in NitroTracker.
#151564 - PypeBros - Fri Feb 29, 2008 10:29 am
eKid wrote: |
Hey, where do I get the source.. :/
I can probably add a bunch of effects, and I would love to see effect support in NitroTracker. |
The original sources are on 0xtob's devblog. I made a source release of my ongoing project prior adding of any effect. I'm working using my own sourceforge CVS at the moment. I don't know if 0xtob had any kind of CVS setup for the library. I can grant you developer access (if you join my project :P) to that branch, or we could setup an independent project/module with libntxm alone.
Note, though, that i only have the source of libntxm, not those of the tracker itself, so once we have supplied support for plenty of additionnal effects in libntxm, we still will have to handle that back to 0xtob so that he can provide effect support (encoding and display) in the tracker (afaik).
Oh, and i'll sure be glad to handle you the support of XM effects while i focus on S3M format loading and S3M-specific effects ;)
_________________
SEDS: Sprite Edition on DS :: modplayer
Last edited by PypeBros on Fri Feb 29, 2008 10:33 am; edited 1 time in total
#151565 - PypeBros - Fri Feb 29, 2008 10:32 am
PypeBros wrote: |
I tried to add portamento effect in your player, but i can't get it working right. I try to use the Sample::BendNote() function, but i'm not quite sure i get the role of _note, _basenote and _finetune right.
|
oh, just to let you know : that one is fixed. I need to reorganize a couple of things in the player to better capture (and manipulate) the "state of a playing sample" (since Sample is simply a static structure that represent "a sample in the module's sound repository").
_________________
SEDS: Sprite Edition on DS :: modplayer
#151581 - tepples - Fri Feb 29, 2008 9:08 pm
HyperHacker wrote: |
Was I the only one who wondered how you were playing satellite radio on the DS? :P |
Are you Sirius?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#152101 - 0xtob - Sun Mar 09, 2008 11:16 pm
PypeBros: Cool, portamento! Great work! I think a central code repository for libntxm would be a good idea. I could set up a Google Code site for it and provide everyone interested with svn/git/whatever access. Who's in? :)
_________________
http://blog.dev-scene.com/0xtob | http://nitrotracker.tobw.net | http://dsmi.tobw.net
#152117 - PypeBros - Mon Mar 10, 2008 9:00 am
0xtob wrote: |
I could set up a Google Code site for it and provide everyone interested with svn/git/whatever access. Who's in? :) |
Good option. That way i'll keep my own CVS for "unstable" things and will commit stable changes into the gcode svn.
_________________
SEDS: Sprite Edition on DS :: modplayer
#154423 - 0xtob - Wed Apr 16, 2008 1:59 am
libntxm v0.2 is out and needs coders!
The new version doesn't add many new "end-user" features but now it's directly integrated into NitroTracker. While libntxm v0.1 was just a stripped down version of the NitroTracker arm7 code, libntxm v0.2 has all the NitroTracker core functionality, and this library is now used in NitroTracker directly, which makes integration of new features / bugfixes into NitroTracker trivial.
Also, there's now a Google Code project page with an SVN repository, and everyone who wants to help out is very welcome to do so!
I'm currently looking for people who want to implement:- Loading / Saving of other music formats (s3m, it, etc)
- Loading / Saving of FT2 xi instruments
- Saving of wav files
If you want to help out, please contact me!
_________________
http://blog.dev-scene.com/0xtob | http://nitrotracker.tobw.net | http://dsmi.tobw.net