gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > direct sound mixer

#43414 - revengero - Mon May 23, 2005 6:06 am

Hi, has anyone made a direct sound mixer that uses pcm wav files? Any ideas as to where to start?

Thanks

#43417 - DekuTree64 - Mon May 23, 2005 6:42 am

"pcm wav files" can be a bunch of different formats. The GBA uses specifically 8-bit signed PCM. Most sound editor programs (I use CoolEdit 96, although it's a little hard to find nowadays) can save a .wav file in that format.

To mix sounds, just add all the PCM values together.
It's actually a bit more complicated than that because you usually need to do resampling and volume and then keep your values from getting too big to fit in a signed 8-bit sample, but it's not too bad.
You might want to check out my GBA sound tutorial, which can be found here. The first 2 sections are basically writing a simple mixer from the ground up.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#43418 - revengero - Mon May 23, 2005 7:14 am

Thanks for the tutorial, works great...this should really be in the FAQ section, I was looking for this stuff for ages!