short sounds versus long sounds

Started by
3 comments, last by Zakwayda 12 years, 10 months ago
I am rather uninformed in the world of audio; be gentle. :)

It seems that older games would use MP3 or OGG for long music/dialog sequences and use WAV for all the short sound effects. Was this strictly for compression/size reasons? In terms of my own game development, is there any real downside to using all OGG files for both long music files and short sound effects? What do I need to watch out for?
Amateurs practice until they do it right.Professionals practice until they never do it wrong.
Advertisement
WAV files contain uncompressed PCM audio, which can be opened, read and fed straight to the sound chip with no data conversion. If you have a scene in your game with 40+ sound effects playing simultaneously, this is ideal, since there's little CPU time involved and the sound chip does all of the work. OGG files require a lot more work from the CPU to decode on the fly. Data must be decoded - in realtime - into packets of PCM data, which is all done using the CPU. If you try to do this with 40+ simultaneous files, your system will choke.

There's no "one size fits all" audio format, UNLESS the hardware supports the decoding on the fly. On the Xbox 360 for example, the sound chip is custom designed to handle the decoding of XMA2 data, so that one format can be used for one-shot sound effects, long dialogue or to stream in music tracks.

It is possible to open all the necessary OGG files at load time, decode them and have the PCM data sit there in memory ready for use, but that all depends on your target platform - I wouldn't consider a method like this for iPhone, for example. Since I try my best to code cross-platform, I find using WAVs for sound effects and OGG for long tracks to suit the majority of devices just fine.

"The right, man, in the wrong, place, can make all the dif-fer-rence in the world..." - GMan, Half-Life 2

A blog of my SEGA Megadrive development adventures: http://www.bigevilcorporation.co.uk

Glad you summed that up deadstar, I didn't know that. +1 to post.
Ah! That clears it up very nicely. Thank you much, deadstar.

So, if my target platform is, for instance, the big three (Windows/OSX/Linux), using all OGG files loaded in memory is a viable option?
Amateurs practice until they do it right.Professionals practice until they never do it wrong.

So, if my target platform is, for instance, the big three (Windows/OSX/Linux), using all OGG files loaded in memory is a viable option?

A relatively long stereo sound (e.g. a music track) decompressed can require many MB of storage, so it probably just depends on how many music tracks and/or other memory-intensive sounds you have, and what your memory budget is.

This topic is closed to new replies.

Advertisement