I was looking some Harmonic Product Spectrum algorithm examples and I came up with this:
//Implement Harmonic Product Spectrum
for(k = 0; k < buffer_size / 8; k++)
{
sum[k] = magFFT[k] * magFFT[2*k] * magFFT[3*k];
// find fundamental frequency (maximum value in plot)
if( sum[k] > max_value2 && k > 0 )
{
max_value2 = sum[k];
fund_freq = k;
}
}
fund_freq1 = fund_freq * 8000 / buffer_size;
What I dont understand is the reason behind the last line, I tested it and it works but I couldn't find an explanation for that multiplication. Can anyone help me please?
Source of code: SOURCE