play mods

BlitzPlus Forums/BlitzPlus Programming/play mods

Zster(Posted 2003) [#1]
Ok almost finished my remake and now I want to add music composed by my buddy that's in mod format (IT specifically). What's the best way to play the music with minimal CPU load? Convert it to a MP3 or use a dll to play to mod file? If a dll is the way to go are there any besides Bass.dll that I can use?


Binary_Moon(Posted 2003) [#2]
If a dll is the way to go are there any besides Bass.dll that I can use?


Did you look through the docs that come with Blitz+?

I haven't got a clue if its there or not but in blitz 3d you can use the playmusic command to play mod/it/xm. Can't see why Msrk would have taken it out for blitz+ so I'm pretty sure that would be the best way.

Just had a look at the blitz+ docs... and yes, the same command is in b+

http://www.blitzbasic.com/bpdocs/command.php?name=PlayMusic&ref=2d_cat


LineOf7s(Posted 2003) [#3]
To sorta rephrase his question with BM's reply in mind, is it better, CPU-load-wise to use MODs etc as-is or convert to mp3/ogg first? I know the benefits as far as filesizes go (and hence download time), but I've always thought that the trade-off was that MODs made use of the CPU much more than the 'dumb' audio formats.

Anyone know for sure either way?


Binary_Moon(Posted 2003) [#4]
Mp3s need decompressing... but would this happen when they are loaded or whilst playing?

I haven't got a clue but would suspect that the difference won't be huge and that the drawing stuff to the screen would be where the game/app is most likely to slow down.

Personally I haven't had any problems either way. I think Mark said we can use up to 1024 channels so...


Zster(Posted 2003) [#5]
Thanks. I know that in the old days I could play 64 channel modules on my 486 but needed a pentium to decode mp3 (p100 could do it realtime with the first winmp3). Doubt it decodes them to memory as this would equate to 10mb per minute of sound, although with today's machines that might not be such a problem.
Thanks again


Hotcakes(Posted 2003) [#6]
Pre-Blitz v1.80 I would have said to go with an ogg cuz the channel limit was 32 and modules could use that up pretty quick.

Pre-BlitzPC, back in the early days, I'd say go mod, unless you had an early Pentium, where I'd say go mp3 ;]

Nowadays it doesn't make much of a differance, but I think the way that sound hardware is progressing, mp3s and oggs are the solution for CPU usage. Mods for filesize.


CS_TBL(Posted 2003) [#7]
An IT-replayer coder I spoke to, years ago, told me once, that playing an mp3 took far less CPU time than a big IT file.
The amount of CPU usage with IT files differs alot (due to the NNA's).. so if you can choose between 10% cpu usage guaranteed when playing an mp3, or between 5% or 20% for an IT file, MP3 is the winner here..

For filesize: this depends on the style (and the style of the game). Small puzzlegames don't get that large (tho it's not impossible!), but when you're composing an IT-file for a massive fantasy RPG with all the bells and whistles of the orchestra, then the mp3 files are usually 10x smaller than the it file(s). (and usually even more than 10x)

Soundquality: when using mp3, you can mix (and master!) your project to the perfect sound.

This all makes mp3/ogg the winner, imho ..!

Except for 1 thing: it seems an ogg/mp3 can't loop in BB without hearing a small gap at the begin/end of the file.


Hotcakes(Posted 2003) [#8]
MP3s have a buffer at the beginning and end of each sample, but I loop my oggs just fine. I use Goldwave to save them out, so maybe it's dependant on the saver.


LineOf7s(Posted 2003) [#9]
Thx for the answers peeps - experience had shown me that mp3/ogg (hurrah for ogg!) were better CPU-wise, but I thought I'd just check to make sure I wasn't seeing things.

...which is a shame, because I'm especially fond of the smallness of mod/XM etc


Zster(Posted 2003) [#10]
Hmm that makes sense. I would gather that an IT does take less processing power most of the the time as decoding an mp3 is more complex, the difference I think is that blitz probably decodes the whole mp3 at once and saves it to memory so from then on the overhead is the same as a "Wav" file wheas the "IT" is played real time leading to a constant overhead. Can anyone confirm this?


darklordz(Posted 2003) [#11]
there's also a modbass.dll a smaller version of bass.dll