Java MOD/XM Playback

Good work :slight_smile:

Did switching to integer arithmetic improve performance? (Do you have some numbers?)

BSD licence!

Thanks :-*

Oh and right now there isnā€™t a way to cleanly exit the demo player. Pressing ctrl+c can result in an endless loop of the last frame (until you reboot), because the cleanup stuff isnā€™t reached.

There are several ways to fix it, but it would make the programm more complicated, which isnā€™t necessarly a good thing. So, just print a message that itā€™s better to let it run through :wink:

[quote]Good work :slight_smile:

Did switching to integer arithmetic improve performance? (Do you have some numbers?)
[/quote]
I measured the time it takes to mix the entire song at 44100hz with linear interpolation without writing the result on a bunch of different versions, all use integer arithmetic except for KBMod.

Tests done on a 1500mhz Sempron with Java 1.5.0:

Song: Jogeir Lilljedahl - Guitar Slinger (299 seconds)

MicroMod 0.83 : 1516ms
MicroMod 0.98 : 2250ms
KBMod : 6359ms
IBXM: 1672ms
IBXM-Fastmix: 1156ms

Song: TNT - Once More TNT (195 seconds)

MicroMod 0.83 : 906ms
MicroMod 0.98 : 1297ms
KBMod : 3344ms
IBXM: 984ms
IBXM-Fastmix: 687ms

Even the slowest of these only takes 2% of this cpu :slight_smile:

IBXM is nearly 4x faster than KBMod. Floating point has quite a speed penalty!

ā€œIBXM-Fastmixā€ is a test version that directly mixes into a mono 8 bit byte array and only supports forward sample loops. Since itā€™s only 50% faster and poor quality I probably wonā€™t follow it up.

The fastest player with good quality mixing is MicroMod 0.83, but only by 10% or so, which did surprise me, given how naive the mixing code is in that player. IBXM sounds much better, anyway :slight_smile: I may be able to optimise it to close that gap.

The slowness of MicroMod 0.98 comes as no surprise. Iā€™m surprised itā€™s not slower, given how much buffer copying it does.

I see, Iā€™ve never come across that problem before. Iā€™ll bear it in mind.

Cheers,
Martin

Wow. Itā€™s surprisngly fast :o

Good to know :slight_smile:

as you know, im using micromod in my (still very early) game, and as a test I stuck it in the actual game loop to test if it made any noticable diff to the speed, and with 640x480 parallax scrolling (32x32 tiles 2 layers, 1 opaque and the foreground bitmasked) with a 96x64 player sprite, upto about 8 or so bullets and had 10 84x124 (i think! :-/) ā€˜enemyā€™ dudes wandering about (not that there will be THAT many enemies on screen at once at that size in the actual game!) it still ran lovely! even got a few sound effects playing over the top when the lil fella walks and fires etc!

(MicroMod V 0.98kX is the one im using)

so even micromod gets the BIG Thumbs up from me! well chuffed with it!

In the spirit of not keeping things back, hereā€™s another alpha!

http://geocities.com/sunet2000/ibxm-alpha30.jar

The framework is now feature complete, and the interface is not likely to change. Probably still has quite a few bugs, though. XM is an amazingly quirky format. Some might even say ā€œbaroqueā€ :slight_smile:

All the effects that I want to implement are now done. Iā€™ve had some feedback and it appears that playback is very accurate (or as he put it, ā€œblimmin amazing!!ā€) and much better than kbxm. Certainly good enough for gaming!

Also there has been a bit more tuning and bugfixing, and the commandline player application now lets you choose the interpolation.

Next job is S3M :slight_smile:

Cheers,
Martin

Very nice, tested it with some old amiga .mod and .xm worked like a charm. Keep up the good work. :slight_smile: :slight_smile:

Another day, another alpha. There are a couple of major fixes (any xm that attempted a global volume slide down would simply fall silent).

Thereā€™s also a seekable InputStream for use in an SPI, and a WAV InputStream.

http://geocities.com/sunet2000/ibxm-alpha31.jar

Cheers,
Martin

Some more MOD related bits and pieces. I guess itā€™s a hobby of mine :-/

This one has some tuning of the MOD playback, so PC mods with more than 4 channels now work well. Thereā€™s still no S3M loader, but you can always convert to XM if youā€™re desperate ā€¦

http://geocities.com/sunet2000/ibxm-alpha31c.jar

If IBXM is too bulky for you, try http://geocities.com/sunet2000/Micromod.java - a full featured MOD-only player with a turbocharged mixer in less than 600 lines of code, which compiles to just one 12k class :slight_smile:

Iā€™ll update the website soon.

Cheers,
Martin

Had an attack of enthusiasm a couple of weeks ago.
IBXM now has cleaner code, faster mixing, and S3M is finally supported! After only 12 months!

http://geocities.com/sunet2000/

Cheers,
Martin

Wee ;D/

Very very very cool! :slight_smile:

Kev

Couple of under-tested classes for using the lib to play back through OpenAL (LWJGL) are here:

http://www.cokeandcode.com/ibxm/

Great work again, really appreciate the efforts!

Kev

uh - nice and small - great wrapper kev

Thanks for the feedback, guys!

Slightly updated version, with a couple of small fixes and improvements to the mixing (15% faster).

http://geocities.com/sunet2000/ibxm-alpha47.jar

Cheers,
Martin

Thanks for sharing :slight_smile:

Has this been tested on the MacOSX? My OpenAL wrapper produced noise there - Iā€™ve fixed it locally (its just the change of edianess on the platform - but Iā€™m not sure whether the change need to be in IBXM or just locally for OpenAL users? Java Sound might well morph the endian-ness out of the question.

Thoughts?

Kev

Interesting. The current version only ouputs 16-bit little-endian stereo as a byte stream. It doesnā€™t surprise me that Macs default to big-endian for their audio system.

Is it possible to tell OpenAL to expect little-endian input?

Doesnā€™t seem like it - though Iā€™m not sure - I still have to ask OpenAL nicely to do stuff for me.

I just hacked in a change in IBXM where it adds the two bytes to the buffer to swap them round if ByteOrder.nativeOrder() came back the otherway round. Seems to work fine but I havenā€™t made it available for fear that itā€™d break JavaSound (I donā€™t use JavaSound)

Thanks again for the great library, my game music is 84k because of this - brilliant!

Kev

Does anyone know any good software for composing mods?

Maybe just using some setter for enabling that automatic endian twisting?

Does anyone know any good software for composing mods?

modplug, bero, milky, skale (I dont like that one because it sounds quite different)ā€¦