I have simply pitch detection. Input (microphone) data are passed to fft routine, then I'm looking for a pitch with maximum value It means:
Max(pow(data[i].getRe(), 2) + pow(data[i].getIm(), 2)) for 0<= i < SAmplesSize
I need it for detection of guitar string's primary frequency. It works well for freq 440 hz (and maybe higher, i didn't check that) downto 250 hz. Below this value detected frequency is twice as high as it should be, ie. for 195 hz detected frequency is about 380 hz. It looks like it detects higher harmonics below 250 hz. For pure 195 hz tone it detects perfectly, but for quitar string something is wrong.
Any suggestion what can cause that ? Or should I use more sophisticated pitch detection?
Ps. sampling rate: 8000hz, input data size: 1024
I don't know about guitars specifically, but missing fundamentals seem to be quite common in acoustics. The Wikipedia page on pitch detection alludes to secondary processing steps after the FFT, perhaps one of these would be helpful.
Also, see these two SO questions, lots of good information there: (1), (2).
来源:https://stackoverflow.com/questions/4501089/fft-pitch-detection-for-guitar-string