I am looking at FFTW to obtain the spectrum of a sample of audio data.
As I understand it, the "plan" for the process chooses a number N of samples which corresponds to a time period of T seconds. The value of input[x]
is the amplitude of the wave at time x*N/T
and the complex amplitude of output[x]
relates somehow to the frequency.
I know I need to apply a window function but I don't know how. The input buffer is an array of Ni
samples, in general Ni!=N
, and at a rate of F Hz, this corresponds to a time of Ti=Ni/F
seconds with Ti!=T
in general.
So how do I populate the N
inputs to the FFT given Ni
samples, and, given N
and F
, what is the frequency corresponding to output[x]
?
There are a lot of good questions and answers on this subject on SO already, but a few general pointers:
mag_dB = 10 * log10(re*re + im*im)
See also: