Good (Audio) News
December 8th, 2008
There’s a lesson here: read the docs, read more docs, read the forums, go back to the docs, read different docs, find a link to a doc you hadn’t read before and read it. It turns out that I can indeed compress my music tracks using something reasonable, like AAC.
Here’s what the confusion was:
I’m using the SoundEngine code that comes with one of Apple’s example projects. They provide you with a way to play background music along with sound FX. I thought that the whole system was using OpenAL for the audio layer, but it turns out that it’s actually using two systems. It uses OpenAL for the sound FX and it uses something called the Audio Queue Services for the background music track.
If you read through the iPhone documentation on OpenAL it tells you that you may only use PCM or IMA4 for the audio format. I thought this applied to the background music (which it does NOT). The problem I thought I had is that IMA4, while it is compression, doesn’t compress a whole lot. However, if you use Audio Queue Services you get two advantages: 1) you can stream audio off disk 2) you get access to a whole bunch of hardware decoders.
There are limitations: you can only have one hardware decoded track running at once. Which is why the music uses Audio Queue Services but the sound FX do not.
So, the end result is that I’ve compressed the audio tracks using AAC and even at a good sampling rate the tracks are about 1MB each. That’s much more reasonable. So it looks like things are back on track audio-wise. Now I just have to deal with all the other stuff that’s going on…
Owen





