views:

95

answers:

1

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

http://developer.apple.com/iphone/library/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/Reference/Reference.html#//apple_ref/doc/uid/TP40008067-CH1-SW2

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.

Any help would be wonderful!

+1  A: 

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

coneybeare
could I say myAudio.volume=0.5;and is there a reason you chose 0.5? Is there a perfect level... should I just play with it?
Joshua
I only ask because the developer who helped me write my code had it set atmyAudio.volume=5.0
Joshua
1.0 should be fine if the original source has no clipping. There is no optimal level… play with it. Just know that 0.0 is the min, and 1.0 is the max.
coneybeare
Thank you so much! I used 1
Joshua