How do you control the playback levels (decibles?) using the iPhone AVAudioPlayer? Or do I need to use a different API?
My audio clips sound perfect when开发者_如何学运维 I upload them to the iPhone via iTunes. And I am pretty sure it is because the iPod has a maximum playback level, so the audio doesn't sound overdriven. In my app, I include the same audio files, and when I play them [myAudio play]; the levels are so high that the audio becomes indiscernible.
I found in the library that it says that you can "Control relative playback level for each sound you are playing" but I've been searching this issue out for hours and I haven't gotten anywhere.
If you are using AVAudioPlayer, you can just set the player's internal volume to be a float. Think of it as pre-gain… this volume does not control the speaker output volume, but controls the source volume.
[audioPlayer setVolume:0.5];
Source: I have used in in my apps, and the docs
精彩评论