Am 12.01.2017 um 22:53 schrieb Fernando Jefferson:

I'm developing a Lua application and I need to identify frequencies in
an audio recording (Wav format).
By theory, it would be enough to apply a Fast Fourier Transform in the
sample sequence and extract the real part.
I got a package of FFT for Lua:
Https://rosettacode.org/wiki/Fast_Fourier_transform#Lua
My first test was with a very simple audio (1 second of 440Hz tone,
sample rate 16KHz). The output of the routine would be an array with
only the value 440 on all elements ... But it is not working.
I would appreciate any help. I can send the test audio and the Lua
routine which reads the wav file and tries to apply the FFT.
Fernando Jefferson

HI Fernando,
do you have to test for a single (or a few) known frequency?
In that case, the Goertzel algorithm may be your friend. It is a DFT
(not fast one) for a single frequency, which is faster for a single
frequency tha FFT
If you have to find the loudest tone; FFT is the first step. Then find
the highest amplitude; for this don't rely on the real part, it may be
zero with the imaginary part carrying all the power of the signal.
Real and imaginary part can be converted to amplitude and phase angle.
Phase is irrelevant in terms of power, amplitude is relevant. If you
want to be exact, you need to computer the sum of the squares of real
and imaginary part, and find the position of the largest result.
Which frequency this is depends on the number of samples that you
computed the FFT of. With 1024 samples, you get a frequency resolution
of 16kHz/512.