Autocorrelation method for pitch determination.. whats d input data form..?

Posted by harsh on Stack Overflow See other posts from Stack Overflow or by harsh
Published on 2010-03-14T10:52:33Z Indexed on 2010/03/14 10:55 UTC
Read the original article Hit count: 248

Filed under:

i hav read a code for pitch determination using autocorrelation method. can anybody please tell wht wud b d 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;

}

© Stack Overflow or respective owner

Related posts about automation