Spectrum data to frequency Unity

#1

Hey,
I would like to determine the frequencies by the spectrum. Unfortunately I always get wrong values ​​when I compare it with

fft.getParameterFloat((int)DSP_FFT.DOMINANT_FREQ, out dominantFreq);

I read this contribution to me.
https://qa.fmod.com/t/calculate-the-frequency-with-spectrum-data/14042/3
unfortunately I’m still doing something wrong and I can not get it
This is my Code

        float nyquistRate = (44100 / 2);
        float numEntries = (FftWindowSize / 2);
        float hzPerEntry = (nyquistRate / numEntries);
        float entrypower = 0;
        float biggest = 0;
        frequency = new float[(int)numEntries];
        for(int i = 0; i < numEntries; i++)
        {
            entrypower = spectrumData[0][i] * hzPerEntry;
            if (entrypower > biggest)
                biggest = entrypower;
        }
#2

How are the values wrong?
By stepping through the code, are you see expected values in the other variables?

#3

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 :frowning:
pls help!! :open_mouth: