【发布时间】:2012-05-08 18:37:35
【问题描述】:
我正在尝试了解 AVAudioPlayer 和音频电平表。下面是一个正在播放短音频的对象“AudioPlayer”。现在我想输出这个声音的力量(分贝)。不知何故,我不认为我这样做是正确的。
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]);
这个的 NSLog 输出是 0 -160.00 -160.00 1 -160.00 -160.00
现在根据 Apple “0 dB 的返回值表示满量程或最大功率;-160 dB 的返回值表示最小功率” 那么这是否意味着这个声音处于最小功率?我不认为这是真的,因为音频 sn-p 是相当响亮的声音。我想我在这里遗漏了一些东西,任何澄清将不胜感激。
【问题讨论】:
标签: iphone objective-c xcode ipad avaudioplayer