When you plucked on a string, the string is vibrate and except the fundamental frequency, there are an integer multiple of the fundamental frequency, which are the harmonics.

I know that the HPS algorithm is a tool to find the fundamental frequency, but I don't understand the downsample part. How can I know how many times I need to downsample the signal?

I read somewhere that the fundamental frequency can be given by measuring the harmonic frequencies and their GCD (greatest common division)

another source says that there's a need to use the Hanning method. can someone please explain this algorithm?


OK Lets go!

I consider HPS a very simple algorithm, this image representation show exactly how HPS work !

enter image description here

Yeah is highly recommended apply a hann window for every framed data !

What do you need to do is apply one window function over your framed signal, then apply FFT, you need just the first half absolute values from FFT, its give you the Magnitude, now downsample it for N time, Multiply all downsampled and at the end find the peak.

How can I know how many times I need to downsample the signal?

Will depend, the more time you downsample you signal more accurate HPS can be, this has a cost that limits the frequency analysis, for example, imagine that you have a signal sampled at 44100hz, you use FFTsize = 4096 and you decide to make 5 time downsample, its tell me that you can not pick up frequencies above 4403Hz!

floor(4096 / 5) =  819
floor(819 /2) = 409
floor((44100/4096) * 409) = 4403
| improve this answer | |

i might suggest looking up the good ol' Average Magnitude Difference Function (AMDF) or Average Squared Difference Function (ASDF) or Autocorrelation as means of determining the period which is the reciprocal of the fundamental frequency.

| improve this answer | |
  • $\begingroup$ Could you please elaborate on those methods, or cite a source? $\endgroup$ – Mauren Mar 25 '14 at 0:25

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.