我在这里得到了代码: https ://naudio.codeplex.com/discussions/270762 。
goertzel 算法是这样的:
public double goertzel(List<double> sngData, long N, float frequency, int samplerate)
{
double skn, skn1, skn2;
skn = skn1 = skn2 = 0;
samplerate = this.sampleRate;
frequency = this.freq;
double c = 2 * pi * frequency / samplerate;
double cosan = Math.Cos(c);
for (int i = 0; i < N; i++)
{
skn2 = skn1;
skn1 = skn;
skn = 2 * cosan * skn1 - skn2 + sngData[i];
}
return skn - Math.Exp(-c) * skn1;
}
我想使用该算法转换音频数据(来自上面链接中的波形文件阅读器)。我怎样才能做到这一点?谢谢