I have read a code for pitch determination using autocorrelation method. Can anybody please tell what would be the input data (passed as argument to DetectPitch()) function here:
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;
}