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:
- MP3: This is a highly compressed, but also high-quality encoding format that preserves the richness of music and spoken voice. However, only a single mp3 stream can be played at a time on the iPhone because it requires use of the hardware decoder. This excludes mp3 as a format for sound effects, since they will interrupt background music and/or any user music being played.
- WAV: The iPhone only supports WAV files if they are PCM - encoded and do not require any compression codecs. While WAV supports many different sampling rates and bit-depths, it results in very large files (180k / sec for 16-bit/44.1kHz/stereo audio). The large size becomes prohibitive when you have many effects to rapidly play.
- AIFF: Has similar problems to WAV files - it's unclear if any compression codecs are supported. Supposedly Apple Lossless compression is supported - but I can't find any tools that can generate AIFF in using this compression.
- Custom: You can use the iPhone low-level APIs to play your own audio from any source. But this seems like overkill for playing a simple sound effect in a game. I certainly don't want to write my own audio layer and encoder/decoder just for this.
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.