I have managed to get the spectrum data but I am a bit confused on how to calculate the frequency from those values. I’ve read somewhere in the forums that it is the number of entries (length?) in the spectrum window divided by the output rate to get the Hz per entry and found this code:
nyquistLength = length / 2;

for (int i = 0; i < nyquistLength – 1; ++i)
float hz = i * (44100 * 0.5f) / (nyquistLength – 1);

an then I multiply that with my spectrum value e.g. spectrum[channel][length] ?
If that is so, can I use some if statements to get the frequency 400-800Hz.

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.