views:

737

answers:

5

I want to start with an audio file of a modest filesize, and finish with an array of unsigned chars that can be loaded into OpenAL with alBufferData. My trouble is the steps that happen in the middle.

I thought AAC would be the way to go, but according to Apple representative Rincewind (circa 12/08):

Currently hardware assisted compression formats are not supported for decode on iPhone OS. These formats are AAC, MP3 and ALAC.

Using ExtAudioFile with a client format set generates PERM errors, so he's not making things up.

So, brave knowledge-havers, what are my options here? Package the app with .wav's and just suck up having a massive download? Write my own decoder?

Any links to resources or advice you might have would be greatly appreciated.

A: 

You could always make your wave files mono and hence cut your wave file size in half. But that might not be the best alternative for you

hhafez
Ach, they're already mono. I want the kind of space reduction only lossy compression can give.
frezned
+1  A: 

There are some good open source audio decoding libraries that you could use:

Both are licensed under LGPL, meaning you can use them in closed source applications provided modifications to the library, if any, are open sourced.

codelogic
A: 

Another option for doing your own decoding would be Ogg Vorbis. There's even a low-memory version of their library for integer processors called "Tremor".

AShelly
+2  A: 

While Vorbis and the others suggested are good, they can be fairly slow on the iPhone as there is no hardware acceleration.

One codec that is natively supported (but has only a 4:1 compression ratio) is ADPCM, aka ima4. It's handled through the ExtAudioFile interface and is only the tiniest bit slower than loading .wav's directly.

frezned
+3  A: 

Offline rendering of compressed audio is now possible, see QA1562.

zoul