iPhone metering problems

Posted by Eric Christensen on Stack Overflow See other posts from Stack Overflow or by Eric Christensen
Published on 2010-03-08T06:32:13Z Indexed on 2010/03/08 6:36 UTC
Read the original article Hit count: 418

When I'm recording an AVAudioRecorder object, I repeat a chunk of code via an NSTimer that includes:

[soundrecording updateMeters];
NSLog(@"channel 0 average:%f, peak:%f",[soundrecording averagePowerForChannel:0],[soundrecording peakPowerForChannel:0]);
NSLog(@"channel 1 average:%f, peak:%f",[soundrecording averagePowerForChannel:1],[soundrecording peakPowerForChannel:1]);

When I'm recording a mono file, the peak power for channel 0 is just what you'd expect, a float from -160 to 0. But average power for channel 0 is always zero. (And, of course, the values for channel 1 are both zero.) When I'm recording a stereo file, both the average and peak values for both channels are as expected.

Any thoughts on why, when recording a mono file, the average value for channel 0 isn't returning correctly, even though the peak is?

Thanks!

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone