I want to calculate the frequency from spectrumData. i compare my value “biggest” with fft.getParameterFloat((int)DSP_FFT.DOMINANT_FREQ, out dominantFreq);
but the value are wrong. As example, the value in “dominantFreq” is 724.3906 and the value in “biggest” is 10.45431.
What im doing wrong
pls help!!

just picking one value out of a noisy spectrum is not a good way to find the dominant frequency.
FMOD finds the value by lookign at the most significant values not just 1 value.

To find the value here is the code

float average = 0.0f;
float power = 0.0f;
for (int i = 0; i < nyquist-1; ++i)
{
float hz = i * (rate * 0.5f) / (nyquist-1);
if (spectrum[i] > 0.0001f) // aritrary cutoff to filter out noise
{
average += spectrum[i] * hz;
power += spectrum[i];
}
}
if (power > 0.001f)
{
*dominant = average / power;
}
else
{
*dominant = 0;
}