Audio formats in sdl_mixer

Hi. What audio format should i use in my game for background music? and for chunks?

I want to get the best performance, and i’m using sdl_mixer.

Cross-Maker wrote:

Hi. What audio format should i use in my game for background music? and for chunks?

I want to get the best performance, and i’m using sdl_mixer.

I’m not completely certain on this, but I believe that if you load all your resources prior to starting your game/program, then performance shouldn’t be an issue.
For playing chunks, the main thing to avoid is LOAD->PLAY->UNLOAD->LOAD->PLAY etc
you’ll want to load it once, play it as many times as needed, and then unload on exit.

For background music, it’s a toss-up. But there are three factors to remember:
Read audio file: HDD is or can be a bottleneck
Decode audio file: Processor is or can be the bottleneck
Retaining audio file: Uses memory.

Consider your target audience and other resource demands your game/program will have.
If you think the memory usage will be low, load it once and play it whenever.
If you believe HDD and Processor aren’t issues, then load play and unload.

A fun thing you can try is write your own benchmarks. See how much memory the files take. Load a file; start playing it; once it starts, unload it; load it again, or another file and do the same. See if you notice stutters in your program.

Hope that helps.

Please define performance. If you just want it to work right I think you
can use anthing. Download some music in each format and try it out. Some
formats are huge and some are timy but there is good reason. The basics is
that the bigger the format the better the sound. I think midi is the most
tiny format but it sounds a little janky. I do love the old midi video game
music though.
For fx and other stuff I only use wav. I think it may be the largest format
that’s supported but it’s easy to use and sounds awesome. I don’t know
about you but when I hit something in a video game I wanna hear a sweet
sound.On Sat, Nov 12, 2011 at 9:44 PM, Cross-Maker wrote:

**
Hi. What audio format should i use in my game for background music? and
for chunks?

I want to get the best performance, and i’m using sdl_mixer.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org