【发布时间】:2010-03-14 10:52:33
【问题描述】:
我已经阅读了使用自相关方法确定音高的代码。谁能告诉这里输入数据是什么(作为参数传递给 DetectPitch())函数:
double DetectPitch(short* data)
{
int sampleRate = 2048;
//Create sine wave
double *buffer = malloc(1024*sizeof(short));
double amplitude = 0.25 * 32768; //0.25 * max length of short
double frequency = 726.0;
for (int n = 0; n < 1024; n++)
{
buffer[n] = (short)(amplitude * sin((2 * 3.14159265 * n * frequency) / sampleRate));
}
doHighPassFilter(data);
printf("Pitch from sine wave: %f\n",detectPitchCalculation(buffer, 50.0, 1000.0, 1, 1));
printf("Pitch from mic: %f\n",detectPitchCalculation(data, 50.0, 1000.0, 1, 1));
return 0;
}
【问题讨论】:
-
您的问题非常模糊 - 请明确说明您在此处遇到的问题。您可能还需要发布 detectPitchCalculation 的代码。
标签: c audio signal-processing