Objective-C Audio experiment
July 5, 2009 § Leave a comment
I couldn’t find any good information on Audio performance and quality. I am sharing my experiement here.
System Audio Services, declared in
AudioToolbox/AudioServices.h only supports .caf, .aif, or .wav files. The audio data in the file must be in PCM or IMA/ADPCM (IMA4) format. The file’s audio duration must be less than 30 seconds.
AVAudioPlayer supports .m4a, .mp3, .wav, .aif, and .caf.
Simulator is not a reliable tool to test and verify audio performance and quality.
- AudioServicePlaySystemSound doesn’t play 128 bitrate 44,100 sampling rate wave, aif and caf audio files on simulator even it plays on device
- Simulator won’t be able to reproduce the speaker sound
- Simulator can’t tell the audio performance between AudioServicePlaySystemSound & AVAudioPlayer
Using the same .wav audio file, by default, AVAudioPlayer is much much louder than AudioServicePlaySystemSound on device. Both sound the same on simulator. I suspect iphone use different hardware mechanism to play AudioServicePlaySystemSound and AVAudioPlayer.
I don’t notice much differences in audio quality among audio formats in .wav, .aif, .caf, .mp3, .m4a in device & simulator. However for the same audio file, the file sizes are much smaller in m4a (44KB), and mp3 (96MB), compared to wav (1MB), AIF (1MB), and CAF (1MB). File sizes do not correspond to rendering time based on profiling on simulator.