0
$\begingroup$

I'm trying to code the HPS (harmonic product spectrum) algorithm and the problem I'm facing is that using my guitar, the fundemental frequency (Here it's 82Hz) just isn't there, so is the 5th Harmonic at 410Hz (Actually it's the lowest local point). In my algorithm, I did the step of finding the max of all (Mul(harmonic-multiplications)) What pre/post-process should I do to get to 82Hz here. Plot

$\endgroup$
  • $\begingroup$ i thought i knew something about pitch detection and i never heard of the "HPS algorithm". what am i missing? $\endgroup$ – robert bristow-johnson May 8 '14 at 16:32
  • 1
    $\begingroup$ harmonic product spectrum google.co.il/… $\endgroup$ – Netanel Kadar Levi May 8 '14 at 16:44
  • $\begingroup$ Ok so it appears that it was my bad. As I was going through everything again I found out I accidentally initialized the frame size to be somewhat less than the actual frame size (16384), maybe the fact that it wasn't a power of 2 affected the fft negatively. In any case, it works now. Thank you @pichenettes for your guidance. $\endgroup$ – Netanel Kadar Levi May 8 '14 at 17:35
2
$\begingroup$

Missing f0 is a common situation. Pitch could be defined the lowest common multiple of the spacing between spectral peaks, and they seem to be spaced by 82 Hz or 164 Hz here - so there's nothing wrong with your signal and spectrum. Harmonic sum or product should deal with this case. Could you please post plots of your harmonic sum or product? Which result do they give you?

You can also try looking at another pitch detection method like the Average Magnitude Difference Function or YIN.

$\endgroup$
  • $\begingroup$ Ok thx Ill try plotting it and maybe other methods, but since you suggested it should still work fine, I'm gonna try to stick to that. btw, I noticed that in AudaCity, by increasing the number of bins, suddenly the 82Hz appears. Should I just try to increase the number of fft bins? $\endgroup$ – Netanel Kadar Levi May 8 '14 at 16:34
  • $\begingroup$ FFT has a very poor resolution in the low frequencies - which is why time-domain methods are better for accurate pitch detection of very low notes. If your sample rate is 44kHz and FFT bin size 2048 ; a bin is 20 Hz wide ; so this might indeed be enough to make the 82 Hz bump look smooth and flattened. You'll have to increase the FFT size to get accurate results from a frequency-domain method. $\endgroup$ – pichenettes May 8 '14 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.