Question about the tracker/MOD implementation

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Question about the tracker/MOD implementation

Post by Foxley »

I LIVE.

(unfortunately I've also done almost no game work aside from concept sketches for the past several months, too busy)

Anyways, I had a question about whatever OHRRPGCE uses for tracker music formats like .IT and .MOD... I think it's MikMod. Does it have any choices in sample interpolation methods? I ask because I just did a quick one-pattern .IT track and imported it to see how CUSTOM would handle note cutoffs, and there is very noticeable clickyness in playback that isn't present in OpenMPT, the program I made the song in.

So, hopefully MikMod has some options regarding sample interpolation. Otherwise I'll have to mess around with instrument samples in Audacity for days. :(
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I had a look and yes, mikmod does have an option to enable "interpolated mixers", and it's probably not enabled. Also, I see "sample interpolation" listed as a mikmod feature. mikmod is normally used internally by SDL_mixer (though it can use modplug instead), but it's not clear to me how to actually access mikmod to change the setting without recompiling SDL_mixer (and on GNU/Linux we use whatever build of SDL_mixer is installed on the system). I think I can probably do it, but it's complicated by the fact that mikmod can be either statically or dynamically linked to SDL_mixer and that I need to support three OSes, and there are many many different ways SDL_mixer could be compiled on GNU/Linux. I'll make another attempt in a couple days.

I have seen audiophiles write that mikmod is terrible for accurate playback, although on comparing mikmod and xmp on just a few module files I couldn't hear any difference. But it might well be playing certain files wrong.
Last edited by TMC on Tue Jan 26, 2016 11:20 am, edited 2 times in total.
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Post by Foxley »

Darn, I didn't know it was precompiled with certain settings like that. :(

Hopefully using XMP or LibModPlug would be doable. It'd be great if doing music in OpenMPT was more WYHIWYG in terms of importing it into CUSTOM, without really noticeable clicky/crackly audio garbage. Let me know if you're able to change it, I can help test it to see if I hear noticeable improvement in the sample playback.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

We already provide our own builds of SDL_mixer on Windows and OSX, and also providing one on Linux could be reasonable - it actually seems to be the normal thing to do for closed source games. Besides I really would like to either stop using SDL_mixer, or fork it, in which case it would be simpler to statically link it.

XMP has been separated into libxmp and the xmp player.

Aside from the sample interpolation, have you heard any any problems?
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Post by Foxley »

Not thus far, the note cutoffs and volume envelopes in the .IT file seemed to work. One thing about Modplug/OpenMPT is that even when making .IT files in it, a lot of its features far exceed the late '90s Impulse Tracker standards, especially options in the instrument editor like cutoff filters, resonance, filter envelopes and such. Not to mention being able to import VST effects and instruments!

I tried importing some old tracks I made when I was a teenager that used features like that. And sure enough, they didn't sound right at all. This is likely just due to limitations of MikMod, which probably sticks to decade-and-a-half-old standards. If getting modern tracker functionality with a different library happens, that'd be icing on the cake.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I looked through modarchive and found a bunch of files that sound noticeably different in xmp and mikmod. Either there is some clicking, or it sounds quite different, typically less smooth and more electronic. I even found an .xm (01heart.xm) that doesn't play at all with mikmod. I wonder if you have any idea what's special about it.

Bad news, after poking around I discovered that the interpolation flag is actually already turned on; turning it off produces really bad results for some tracks.

I tried compiling libSDL_mixer with libmikmod 3.3.8 instead of the 3.1.1 that it packages, and now 01heart.xm actually plays. However the clicking in other tracks is still there. Next I tried compiling it against libmodplug. Wow, a couple of my standard test modules sounded very different -- I actually hadn't tried playing them with xmp, but I see now that xmp plays those the same as modplug. I had thought all that crackling was part of the track! One annoying thing is that the volume is louder when played with modplug - likely to be a config setting in sdl_mixer.

I did all this on GNU/Linux although I don't think we'll switch to distributing our own libSDL_mixer.so at least not soon; compiling SDL_mixer is more of a pain on Windows but I guess I'll get to it eventually, and I'm really not looking forward to doing it on OSX again.
Last edited by TMC on Mon Feb 01, 2016 2:37 am, edited 1 time in total.
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Post by Foxley »

Hmm, the only unusual thing I can see about that one is that it has 53 instruments, which is kind of a lot. Maybe it's too much for that version of MikMod to handle.

Thanks for looking into this, I'm glad my thoughts on the playback being clicky/crackly wasn't just me being overly sensitive! Also no rush on getting the library recompiled, I'd only really want the playback improved before something like a major release - that could take years, at the rate I'm able to actually work on my own stuff lately.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

You mean a major release of the engine or of your game? The next major release is very soon :)
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Post by Foxley »

Sorry, kind of vague wording. I meant a major release of one of my game projects, like Steam or something.

Do let me know if you'd like some help testing .XM/.IT settings in XMP or libmodplug though.
Post Reply