# [PD] fft beginner question

Mathieu Bouchard matju at artengine.ca
Wed Nov 21 17:16:36 CET 2007

```On Wed, 21 Nov 2007, hard off wrote:

> and so on...always until you reach half the sample rate.  ..i think you
> also get info on 0hz, and i guess that is also somehow important when it
> comes to resynthesis, but i'm not too sure if or how or why.

it may seem like 0hz is useless, as it is inaudible, but that's only if
you keep it constant. at a block size of 64 and CD quality, you can make
a 344hz square wave just by toggling the value of the 0hz component.

in any decomposition in which the first harmonic is 689hz, any frequency
between 0hz and 689hz needs to make waves in the history of the 0hz
component to make it sound like the desired number of hz. Any frequency
that is not a harmonic will also use pretty much all of the spectrum
(usually at least a little of each frequency) in order to simulate
whatever piece of wave happens to be in the current block.

> but i think the reason why you get a real part and an imaginary part is
> because the analysis finds the angle between one sample and the next
> one.  ..if it's a steep angle, then that's a high frequency...if it's a
> flatter angle, then that's a lower frequency.

No. "Real" stands for "Cosine" and "Imaginary" stands for "Sine", as those
coefficients are those of an Euler (complex-number) exponential. Those
values are made by multiplying the amplitude by the cosine and sine of the
phase.

> and the way to find an angle is derived from pythagoras' equation....a^2+b^2=c^2

this is actually cos^2+sin^2=1 in this context, and it helps getting back
to the amplitude by removing the phase (angle).

To get the phase, you need to use atan2 or atan or a complex-number
logarithm.

> so...that works fine when the samples lie above the zero axis...but
> when they go below the zero axis, then to get the angle you have to
> take the square route of a negative number.  hence the imaginary part.

The imaginary numbers are because the complex-number system is
two-dimensional and that signals to be analysed are presumed to be
two-dimensional. They are decomposable into a sum of circular
trajectories. In complex-numbers, circles are made by giving an imaginary
argument to an exponential (this is one of the most mind-blowing and most
useful parts of calculus, at the same time).

_ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada
```