如何使用音频ios app的音高检测键

时间:2014-05-30 04:58:53

标签: ios

是否有任何机构可以帮助我找到音频文件的音高。我有一个代码,通过Mic计算音高,但我想检测音高信号及其强度?

1 个答案:

答案 0 :(得分:0)

为此你需要使用avaudioplayer。它将为您提供音频音高的峰值功率。这些峰值电影实际上是信号强度,你可以从中做动画。

 audioPlayer.meteringEnabled = YES;
    [audioPlayer updateMeters];
if([audioPlayer isMeteringEnabled] ){
    for (int currChannel = 0; currChannel < [audioPlayer numberOfChannels]; currChannel++) {
        //strength of audio channel
        NSLog(@"channel# %d %0.2f %0.2f", currChannel, [audioPlayer peakPowerForChannel:currChannel], [audioPlayer averagePowerForChannel:currChannel]);
    }
}