snd-fft output

Hello,

I’ve been learning about the Fourier Transform and doing some testing in Audacity.

I’ve read the reference for the function snd-fft which indicates that it returns a Lisp array of FLONUMs. It does not say anything more about the output data but I would like to understand exactly what the output data is and how to associate it with a frequency.

I generate a one-second, 440 hz, 0.5 amplitude sine wave with a sample rate of 44100 hz.

I use the Nyquist Prompt to run the following on debug:
(print (snd-fft track 4096 1 NIL))

The debug output prints an array of floats:

#(2.80654 -2.80811 -0.144799 2.81284 0.290117 … 0.000144243 0.182733)

I graph the numbers and see a nice Fourier-style spike in the data, as expected. That spike corresponds to the 83rd element in the array, which has a value of 910.585.

Now I am trying to figure out what the floats represent. I wonder how I can identify the frequency (440 hz) from this spike. I imagine there could be some kind of math with the 83rd element, the sample rate (44100 hz), and length (4096) with the data, but I have not been able to figure that out.

I would appreciate any information on what the output represents and how it could be used to determine frequencies.

Thank you for reading!

There’s a Nyquist FFT tutorial here: https://audionyq.com/nyquist_demos/fft_tutorial.htm
It’s quite old, so some details may have changed, but it’s still basically the same now.