# [PD] fft beginner question

Frank Barknecht fbar at footils.org
Tue Nov 20 20:38:03 CET 2007

```Hallo,
cristiano figueirÿfffff3 hat gesagt: // cristiano figueirÿfffff3 wrote:

> ok, that i understand, i'll make some tests with this
> value...to modify the default i call the block~ object
> rigth?

Yes, just use [block~ 8] or so to get less output.

> "Complex numbers are just pairs of numbers as well. FFT gives out
> cartesian coordinates (re = x, im = y) that are connected to phase
> and magnitude, if you view the latter as the respective polar
> coordinates for that fft-bin."
>
> So, each pair is one number from real and the
> respective from imaginary? (the first from real and
> first from imag. for example?).
>
> In my example, when i first select the frequency
> "0"(hertz) for my osc~ (who is gonna be analyzed) why
> this number (-39.604) appears?
>
> real:
> -39.604  0        0        0        0        0
> 0        0
> 0        0        0        0        0        0
> 0        0
...
> imaginary:
> 0        -0       -0       -0       -0       -0
> -0       -0
> -0       -0       -0       -0       -0       -0
...

The number is the real part of your first "osc~" with frequency 0,
that is: the "DC offset". The first "osc~" of the bank actually would
be a "sig~" in Pd: it doesn't change over time because its frequency
is 0.

If you would connect a [sig~ 1] to [rfft~] and print it, then you'd
get all zeros everywhere except in the first real value, where you'd
get the blocksize (like 8 or 64 or so). You don't get 1, because the
[rfft~] isn't normalized. If you connect a [sig~ 0.5] you'd get
blocksize/2 in the first real bin, and with [sig~ -1] you get
-(blocksize).

Using amp = sqrt(re^2 + im^2) you can calculate the amplitude of your
signal manually from re and im as well and would get e.g. 8 for [sig~
1] at [block~ 8] (which is unnormalized again). The phase is
arctan(im/re) or arctan(0/bs) = 0, which is okay for a DC signal.

Ciao
--
Frank Barknecht                                     _ ______footils.org__

```