How too: Multiplatform music

BlitzMax Forums/BlitzMax Programming/How too: Multiplatform music

Banshee(Posted 2005) [#1]
After some experimentation i've found a way to get BMax to do multiplatform music without any extra installs on the client machine. I've tested this on PC and Mac.

On a PC using sound recorder and a downloaded codec I exported a .wav using "OggVorbis (mode 1)". You can select this by clicking "Change" on the export dialogue of Sound Recorder. You can get the OggVorbis export codec by downloading an ogg codec pack (i've lost the link to the pack I downloaded). I used the 64kbps OggVorbis option.

The original PCM encoded filesize was 45mb, using mp3 I managed to reduce my stream to 1.5mb previously but this export resulted in 1.9mb so it's compression wasn't the best - but none the less the loaded sound file worked on both a PC & Mac using BMax.

I tested the music on a PC without the codec pack installed and a vanilla installation of Apple OSX Panther and it played in both.

I hope this helps some people. If you need me to try and dig out the specific codec files for the export I will but hopefully it's a fairly generic one (I havn't looked).


Qweeg(Posted 2005) [#2]
Thanks Becky. For information you can get the codec from here:

Free Codecs

Tim (PS hope the new job is going well)


Hotcakes(Posted 2005) [#3]
Yes, the freesound module supports both wav and ogg out of the box (and IFF 8SVX as some goon did a module for that too). It uses internal code to do the loading, so there is no such thing as dependancies.

As to the resulting filesize, a better comparison would have been a 64kbps ABR (average bitrate) mp3 vs a 64kbps ogg. Oggs don't measure on kpbs, but most sound programs (or codecs) will list it that way for a comparative understanding. Kinda like comparing AMD clock speeds to Intels. Anyway, oggs are encoded using a quality value, or an average kbps value. There is no such thing a nonvariable bitrate with oggs. So comparing a standard nonvariable 64kbps mp3 (minimum 8kB per second of data + headers) with an ogg (could be anything per second of data, depending on the codec/soundprogram implementation) isn't exactly fair.

So, in short : your '64kbps' ogg is averaged obviously slightly higher than 64kbps (around 81 in fact). Because a 64 kilobit per second encoding cannot be more than 64 kilobits for each second of audio data, no matter what the format ;] The codec obviously decided that an extra 2 bytes of data per second would give a better sound quality.

This in mind, you can easily record oggs at an even lower 'bitrate' setting until you find one that it comparable with the 64kbps mp3 (filesize wise). I think you will find at lower bitrates (esp below 64kbps) ogg really outshines mp3 in sound quality.