What is the recommended audio format for storing and playing back short (2-3 sec) audio sound effects on the iPhone or iToouch?
The iPhone audio SDK documentation indicates that the iPhone supports audio in several formats - however there are drawbacks to each:
Any recommendations would be appreciated... it would also be helpful if someone could recommend a reasonably priced tool for processing audio that can generate the recommended format. Thanks.
You can use IMA4 compressed files, which provide a 1:4 compression from WAV files and are decompressed by hardware (you can load them with an AVAudioPlayer
).
As for MP3, you can only play one file simultaneously in that format, that's why it's not recommended for sound effects where you could have more than one at the same time.
I'm using IMA4 files with OpenAL, so I'm decompressing them manually with a code based on this post.
I've had pretty good luck with CAF format files although WAV comes close in size.
As for tools, Audacity is free and reasonably functional. I mainly use Amadeus Pro (around US$40). Pretty decent and generates all the iPhone supported audio formats (including MP3, AIFF, WAVE, AAC, and CAF). A nice feature is that it supports AudioUnit and VST plug-ins so you can add SoundFX.
I've also heard good things about Fission (by Rogue Amoeba) but haven't actually used it. Their other audio products are pretty solid.
The AVAudioPlayer
framework is pretty good at playing short clips, but you may want to pre-load the sounds (call prepareToPlay
) and keep them around if you can spare the memory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With