Hi my friends
What is the simplest way to play XM mod under win32asm?
Posted on 2006-09-14 01:44:16 by aX3l
Posted on 2006-09-14 06:30:15 by f0dder
bassmod (un4seen.com) and fmod (fmod.com) are harder to implement but have far better reproduction, i have a c and asm example if you'd like.
Posted on 2006-09-14 17:39:18 by Ehtyar
Big thx :)
Ehtyar - I`m interested :)
Posted on 2006-09-15 12:00:47 by aX3l

bassmod (un4seen.com) and fmod (fmod.com) are harder to implement but have far better reproduction, i have a c and asm example if you'd like.

fmod doesn't offer better sound quality when playing module tracks. I guess it's author desided not to update the XM/IT/MOD/... loaders since version 3. I have many XM files producing noisy output or not playing at all in fmod. un4seen engine is much better than fmod (I'm talking about module music only!). Another fine and even free and opensource player is ModPlug's one. It has some nice effects and filters library.

In terms of sound quality when playing XM files, fmod isn't good at all, bass is just OK, uFMOD is a bit better, ModPlug is very good. That's my personal opinion.
Posted on 2006-09-16 12:17:48 by Kvant
I'm in for ModPlug, too - moreover, you can compose the music in MPTrack and thus have the exact same sound in your software as composed. And btw, MPTrack is the easiest tracker to use imho - it's become my tool of choice for making MOD music for my commercial mobile games.
Yet, for PC games (but not 4k/64k demos) I wouldn't bother with tracked music - there are too many obstacles, inconveniences and limitations, compared to any modern music studio software.
Posted on 2006-09-16 14:58:13 by Ultrano
Yet, for PC games (but not 4k/64k demos) I wouldn't bother with tracked music - there are too many obstacles, inconveniences and limitations, compared to any modern music studio software.

There are 2 cons against tracked music in game dev I'm concerned. First is sound quality. Hi-Fi studio recorder wav/ogg/mp3/... usually sounds pretty much the same way on any hardware and system configuration (obviously, high-end sound cards offer better sound to some extend). Tracked modules sometimes sound lousy on slow machines using too heavy mod engines. Most libs are really heavy (fmod and modplug being the most, because of built-in sw mixer, sw equalizer, etc.) Synthesizing a short audio sample involves a lot of CPU usage. So, in game dev light weight music engines/mixers are preferred. uFMOD is the most light one ;) The other problem has to do with the standart. There's only one correct way you can interpret the data found inside a wav file, or an mp3 file. XM/IT/MOD/S3M/... files got processed in many different ways. Every sound lib implements it's own algorithm. So, an XM file may sound different when played in WinAmp, in MPP, in XMPlay and so on.
Posted on 2006-09-16 15:38:27 by Kvant
Yes, those are the 2 of the 3 cons of current types of tracked music. The third one was the one I hinted to with the sentence you quoted. A quick explanation: compare the UnrealTournament music (xm and s3m) to UnrealTournament2003 music (.ogg), similarly-skilled composers. I think that 99 of 100 gamers will tell that the latter definitely beats. This is the tip of the iceberg. Maybe you cannot imagine the hardness of making a good track in such a primitive format as MOD (mod/xm/s3m..). It's like someone giving any of us win32asm coders a 16-bit GAS assembler, to make a full-blown RTS game (16-bit DOS!). And then compare that game to Bogdan Ontanu's "Hostile Encounter", accenting on graphics. You can get the hang of mod composing, produce something nice - but meanwhile the other musicians, that are not much better than you, would have made 10 outstanding (in comparison) songs, and be mastering them (applying final touches).

I'm not completely against tracked music, it's just that since s3m came out, it has continued in the wrong direction. The sad thing is that there's no open format to drive tracked music in the right direction - FruityLoops2 or 3 was the only thing near that idea, iirc.

Btw, in better soundcards you actually hear the artifacts in ogg/mp3 much easier - since you have gotten used to perfect quality :) . Only 256kbit/s ogg or 320kbit/s mp3 make those artifacts virtually inaudible.
Posted on 2006-09-16 17:30:26 by Ultrano
The cool thing about Unreal .IT use was that it was dynamic, changed when you were in combat.
Posted on 2006-09-16 17:37:24 by f0dder
Obviously a game like Halo doesn't need MOD music. I suppose most well known composers ain't aware of tracked music at all. Some of them might hate MOD and the scene as well. No sense expecting Beethoven's 5th Symphony in a 2Kb XM track sound like that available at CD stores.

XM is still useful for small games, like those freewhare/sharewhare distributed over Internet.
Posted on 2006-09-16 18:08:40 by Kvant
It's a feature of ogg-vorbis, too ;) . There's a game "Halo" that skips between different motifs of the current .ogg file, depending on action status. (it's possible, because ogg-vorbis is sample-perfect, no extra samples produced during decoding). Though, it can add a bit of complexity for the musician to make loops/motifs, because of delay-based filters (reverb, chorus,..).
Posted on 2006-09-16 18:38:57 by Ultrano
Isn't it still "simpler" (although harder codewise) to seamlessly progress from *any* piece of music to the combat music and back again? I'm not a composer, so I don't know the challenges of either method :)
Posted on 2006-09-16 18:43:10 by f0dder
It's not hard - using simple fadein+out and 2 decoders - but both songs/parts should have the same tempo (and hold tempo-info in the music file). And markers of tempo-changes (or simply the whole song should stay at a constant tempo, which is most common, actually).
Actually, even with mp3/aac/wma, you can get good enough sync - but the fadein+out approach can lead to a delay of 1-16 seconds.
That delay is because just jumping/fading from any position of the song onto the combat music will often interrupt some melody - making the audio experience seem half-baked.

Though, I haven't played enough with syncing in games - never had enough cycles  to spare for a second decoder/MOD_player.
Posted on 2006-09-16 19:05:02 by Ultrano
You'd be surprised to know how many of these composers actually started with MOD music :) .
True, for small games, where usually the composer won't be experienced enough, XM is good.

btw, a correction to my previous post - the tempo info will be needed, and delay added, because usually melodies last 4 or 8 bars (whole notes), and it's a bit safe to assume you'll minimize melody-interruption/corruption by starting a 1-bar fadein+out exactly after every 4th or 8th bar. The perfect approach would be to mark ranges of the song that shouldn't be interrupted.
Posted on 2006-09-16 19:22:00 by Ultrano
I like BassPlayer by TBD. Besides playing XM; it will play MO3, MOD, S3M, IT, MTMAND UMX.

Also, the front end is written in assembly and the only DLL used is bass.dll

Posted on 2006-09-16 22:12:08 by PBrennick
I like BASS library as it is well implemented, support for MO3 if you want to save some bytes from the module and the 3D support (used it on my SUAVE project - 3D playing of modules in SketchUp)

PBrennick: found it funny to look at my 4yr old source code  :lol:
Posted on 2006-09-17 02:42:00 by TBD
Well it seems while i was gone there has been some debate, lol. Stopping short of providing my opinion where it was not requested, here are the two examples.
The bassmod example is in asm (masm), the bass example is in ansi c (mingw). bassmod is probably what you're after, as it is smaller than bassmod, but provides slighly less features and formats, while naturally bass is larger and has more support and features. I coded these about 6 months ago and posted them elsewhere but recieved not a single post in feedback. If anyone can find improvements or bugs in these, please let me know, i am particularly interested in variable elimination, nested command here, push and pop there ya know. Hope they help you out axel, enjoy :)

On a side note however, i would have to agree that fmod reproduction of tracked music is not superior to that of bass/bassmod, and i'd suggest choosing between bass/bassmod and ufmod.
Posted on 2006-09-17 05:49:14 by Ehtyar
huh :) I decided to use ufmod :) big thx for your help and great discussion :)
Posted on 2006-09-17 06:40:17 by aX3l
*sigh* fair enough. Good luck with it all :)
Posted on 2006-09-17 07:12:55 by Ehtyar