I'm trying to understand AVAudioPlayer and audio level metering. What I have below is an object "AudioPlayer" that is playing a short audio sound. Now I want to output the power of this sound (decibels). Somehow I don't think I'm doing this right.
audioPlayer.meteringEnabled = YES;
[audioPlayer play];
int channels = audioPlayer.numberOfChannels;
[audioPlayer updateMeters];
for (int i=0; i<channels; i++) {
//Log the peak and average power
NSLog(@"%d %0.2f %0.2f", i, [audioPlayer peakPowerForChannel:0],[audioPlayer averagePowerForChannel:0]);
The NSLog output of this is 0 -160.00 -160.00 1 -160.00 -160.00
Now according to Apple "A return value of 0 dB indicates full scale, or maximum power; a return value of -160 dB indicates minimum power" So does this mean this sound is at minimum power? I don't think this is true because the audio snippet is a fairly loud sound. I think I'm missing something here, any clarification would be appreciated.