FFT guitar tuner application - incorrect frequency

2019-08-22 03:55发布

问题:

I have been working on a guitar tuner application. I understand that the FFT is a bad choice for this kind of application. However, as deadlines get ever closer, and my original specification submission specified use of this algorithm. So unfortunately I am stuck with it.

Thanks to answers to previous questions and use of this blog: http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html

I have an application that takes in audio, calculates the frequency and both graphs and compares the result to known note ranges at 5 octaves.

The final issue is that the frequency calculated still varies from the frequency read in. I have used a frequency generator provided online an I have found that It will get the frequency of a note above or bellow the given one.

for example a C read in will get B sharp or C sharp at different octaves. Distance of the phone from the noise source also effects the readings.

Is there a known example of this occurring and fixes, or is it because of the FFT algorithm, and my application can't work correctly?

My code can be found at a previous: Displaying a double (frequency) that is updated constantly while recording with Android

A low pass filter has been added to remove background environmental noise, and a ring buffer has been added to get the average of several frequencies given.

回答1:

If your frequency is off by a little, it might mean you either need to use a longer FFT or a peak estimation algorithm (such as a parabolic or other interpolation kernel) on the FFT result.

If your FFT frequency result jumps octaves, it may mean you need to narrow your allowable frequency estimate range or your low pass filter bandwidth using a pitch estimation algorithm, such as a cepstrum/cepstral estimator, autocorrelation/lag estimator, or harmonic product spectrum, et.al.

Also watch out for bugs such as using the wrong sample rate or the wrong data formats, etc.