# [LAD] FFT 1D real

Fons Adriaensen fons at linuxaudio.org
Mon Mar 14 16:02:01 UTC 2011

```On Mon, Mar 14, 2011 at 02:11:00PM +0200, Alfs Kurmis wrote:

>  What typical comes in to FFT function ? Pointer to already windowed
>  array of samples ?

Yes.

>  What return FFT ?

Either it overwrites the input, or it needs a second pointer
to the output array.

Function return value: up to you, normally you don't need one.

>  What exact physical dimensions return FFT , if input function
>  dimensions was - voltage depends from (time) U=U(t) ?

The dimension of the data is the same in both domains.
If one is a function of T, then the other is a function
of 1/T  (for example: T = time, 1/T = frequency).

>  How from ...1024 or 2048 or 4096... FFT return values  i calculate
>  power magnitudes for all bands,
>  and finally values for visual 10-20 hopping bars, like in Winamp ,
>  XMMS , QMMP ... ?

If you want such a display the FFT is not a good way to do it.
It's possible but not simple if you want a correct result.

>  If i exact know my FFT window size [for example 4096 samples] and
>  window type , and it will be constant forever,
>  is it possible to calculate window(,sine,cosine,) and store all
>  values in constant array,
>  so that in runtime it do not need be calculated , but i can just
>  take values form array ?

Yes.

>  43303.2715 + 796.7285 = 44100 or 44100 - 43303.2715 = 796.7285>
>  Why Frequency 796.7285 is mirrored as Frequency 43303.2715 , and
>  magnitude for both Frequencies is divided by 2 ????

Because you are using a complex FFT, and the imaginary part
of your signal is zero. That means that the spectrum must be
symmetric.

>  Is here way direct calculate full magnitude and without Frequency
>  mirroring , in band 0 Hz ... FSampl/2 ONLY ,

Use an FFT operating on real data instead of complex.

Ciao,

--
FA

```

More information about the Linux-audio-dev mailing list