iPhone SDK: How to normalize audio playback using AVAudioPlayer?
I'm doing some test开发者_StackOverflow中文版ing with AVAudioPlayer and notice that the audio is very low. Some apps, like Audio Memos Free, has an option to "auto normalize" playback volume and this results in a significantly louder playback than if I have the AVAudioPlayer volume set to 100%. How are apps like that normalizing playback volume? I don't see any control over the in the AVFoundation classes.
In AVAudioSession class there are various categories to handle playback http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVAudioSession_ClassReference/Reference/Reference.html. In this if you use AVAudioSessionCategoryPlayback you will get higher playback sound compared to other categories like AVAudioSessionCategoryPlayAndRecord. Also there is a setVolume: property for AVAudioPlayer. If you need more control over your audio you can use Core Audio framework. Please refer http://developer.apple.com/library/mac/#documentation/MusicAudio/Reference/CACoreAudioReference/CoreAudioTypes/CompositePage.html and the sample Speak Here application http://developer.apple.com/library/ios/#samplecode/SpeakHere/Introduction/Intro.html for more details. Hope this helps you.
精彩评论