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.