0

I am working in Xcode 4.5.1 and developing for the iPhone.

I am using AVAudioPlayer to play sound. I am playing two sounds and want to make a ratio of their average volume relative to each other.

I gather the relevant information using averagePowerForChannel: in combination with NSTimer, checking the volume of both sound files at an interval. However, I have come to the discovery that, regardless of the value I input at setVolume, a specific sound file will always return the same average volume, for example -20,0. I conclude that it does not take into account any volume changes you apply using setVolume.

You can enter values 0-1 at setVolume. Is there a way to convert these values to something meaningful that I can apply to the volume information which I have gathered using averagePowerForChannel:? I am assuming that I can't simply multiply my average volume value with the setVolume value. I have looked in the class reference, but I could not find anything useful.

Please point me in the right direction. Any input is appreciated.

RoelfMik
  • 255
  • 1
  • 2
  • 9
  • Just to make sure, do you call `-updateMeters` before you read the channel power? And did you enable metering using the `meteringEnabled` property? – zoul Dec 18 '12 at 15:08
  • Thanks for your response. But, this is not my question. I am getting values, no problem there. However, when I want to compare two sounds, I need to know the effect/scaling of the value I input at setVolume. Because, otherwise I won't be able to make an accurate comparison. – RoelfMik Dec 18 '12 at 16:15
  • This is a similar question, however there is no definite answer: http://stackoverflow.com/questions/9162509/how-to-calculate-dbr-from-the-volume-on-ios – RoelfMik Dec 18 '12 at 16:19
  • To clarify... When you meassure the volume using averagePowerForChannel, it does not take into account the effect that setVolume has on the audible level of the sound. I would like to know to what degree the sound is amplified in this 0-1 scaling, I need to know what these values do to the sound level, so I can apply its effect to the values I find using averagePowerForChannel and make an accurate comparison. – RoelfMik Dec 18 '12 at 16:26

0 Answers0