0
$\begingroup$

I am trying to get the estimation frequency from the FFT output in unity, I have read that Quinn's second estimator method is the most accurate method, and I found the algorithm for how to implement the method. The explanation is referring to the output array (samples) as complex numbers, And the FFT in Unity returns the samples as a float array (I think this is the magnitude of the complex number).

My question: How do modify the algorithm to work with float numbers?

tau(x) = 1/4 * log(3x^2 + 6x + 1) – sqrt(6)/24 * log((x + 1 – sqrt(2/3))  /  (x + 1 + 
sqrt(2/3)))
ap = (X[k + 1].r * X[k].r + X[k+1].i * X[k].i)  /  (X[k].r * X[k].r + X[k].i * X[k].i)
dp = -ap / (1 – ap)
am = (X[k – 1].r * X[k].r + X[k – 1].i * X[k].i)  /  (X[k].r * X[k].r + X[k].i * 
X[k].i)
dm = am / (1 – am)
d = (dp + dm) / 2 + tau(dp * dp) – tau(dm * dm)
k’ = k + d

//Where 
//k =  index of the max (possibly local) magnitude of an DFT.
//X[i]  =  bin “i” of an DFT |X[i]| =  magnitude of DFT at bin “i”.
//k’  =  the interpolated bin location.

Link to the algorithm: http://dspguru.com/dsp/howtos/how-to-interpolate-fft-peak/

if you think there is a better method to get the frequency, please tell me about it.

$\endgroup$
2
  • 1
    $\begingroup$ Try Quinn-Fernandes. $\endgroup$
    – Peter K.
    Sep 23, 2022 at 21:33
  • 1
    $\begingroup$ That really depends what exact format your FFT function is returning. You need to check the documentation. Could be real/imaginary alternating, could be magnitude only could be something else. There is no single standard $\endgroup$
    – Hilmar
    Sep 24, 2022 at 12:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.