Introducing Asounding

While porting the game Tumiki Fighters to the iPhone, I had a hard time with audio. Making background music and sound effects work well together, work well with the iPod playing its music, and handling other things that may happen on the device isn’t a task as simple as it seems at first glance. Turns out I’ve made my own audio engine for this game, and today I make it available to help other iPhone developers who are struggling with audio issues. Introducing the Asounding Audio Engine for iPhone OS.

My first attempt at an easy solution was to use the AVAudioPlayer class to play the background music and SystemSounds to play the sounds effect. This was pretty simple, and worked to an extent. As soon as a couple of sounds started to play however, the background music noticeably gained in volume and got distorted until all sounds effects would stop. This solution proved unworkable.

My second attempt was to use the SoundEngine code from a now-retired Apple sample code. I won’t tell you were to find it because it’s buggy (no wonder Apple removed it), but it was a somewhat better temporary solution than SystemSounds simply because it worked correctly (most of the time) and thus I could concentrate on other things than audio. Once the game was in a better shape, and after collecting a couple of crash logs, I decided that debugging a race-condition in SoundEngine wasn’t something I wanted to try, and decided to move to something else.

At this point, I had already decided to build my own sound engine for managing all things audio in the game. I started from the oalTouch sample code, then grew it to accomodate all my needs. With Asounding you can:

Then I added some automatic behaviours to:

In addition, you can choose to disable iPod playback, and you can manually disable background music, sound effects, or all audio from the program (useful to enforce user preferences).

Special care was given to what happens when the user starts iPod playback while the application is running by double-clicking the Home button.

Asounding is now available to everyone as open-source (GPL) and for commercial licensing in closed-source applications. If you are an iPhone game developer, please give it a try and look at how much implementation and debugging time it will save you.

You can see Asounding at work in the game Tumiki Fighters (App Store link).



Hi Michel,

I am no expert in either iPhone development or Objective C, but I’ve taken a look at your code anyway. It looks very nice, very clean - another one of your little gems: short, to the point, but covering all essentials, and in only 78K of code.
Nice job!


  • © 2003–2019 Michel Fortin.