# [PD] fftchannels

John Heenan john at auscyber.com
Thu Jan 24 18:44:01 CET 2002

```I find the documentation in PD terse and so confusing. Normally I go the
source code if I want to understand what is going on. In this case it is
probably not much of a help as FFT is an infamous area in itself. In PD
the FFT routines are written by Kevin Peterson, MIT Media Lab, EMS. In
themselves they are terse and not exposed in a convenient object
oriented style.

There are N array elements (or parts) to an FFT result from N samples.
The FFT results are complex numbers (i.e. values with real and/or
imaginary parts).

This above is purely a mathematical operation. Interpreting the results
in the context of samples that represent audio is not mathematics.  The
complex results can be transformed into another array of pairs of
numbers that can be said to represent 'magnitude' and 'phase'. To fully
reconstitute the original samples with a inverse fft it is necessary to
use the original FFT complex array.

For human auditory perception phase has little consequence.

In DSP (Digital Signal Processing) it is normal to indicate each element
i up to the first N/2 elements of a FFT array result can be used to
represent the magnitude of a frequency or a frequency bin (range of
frequencies). The particular frequency or end point of a frequency bin
is given by the equation
sample rate * i / N
The equation I gave in my previous posting was incorrect.

The actual magnitude of the frequency or bin is scaled or normalised.

For i = N/2 the frequency represented is the Nyquist frequency (half the
sampling rate), since
sample rate * (N/2) / N  = sample rate / 2.
N for FFT must be a power of two and so is always an even number.

PD allows you to plot the real and/or imaginary outlets of the rfft~
object.

I have read the full text of the help patch. It is implied there are N/2
+ 1 parts of a real FFT that have values and there are other parts with
value 0. Of the N/2 + 1 parts with values it is stated two parts have no
imaginary component. It is stated these are the DC and Nyquist parts.

This is just information. It is not the job of PD to explain or
interpret this.

The statement in PD is technically true. There are values produced for i
> N/2, however they are said in DSP literature to correspond to
'negative frequencies' and are generally ignored (using mathematics to
over interpret physical phenomena causes endless philosophical horrors).
At any rate these values don't have to be interpreted if the Nyquist
sampling rule is applied. How convenient.

John Heenan

-----Original Message-----
From: marius schebella [mailto:marius.schebella at chello.at]
Sent: Thursday, 24 January 2002 10:00 PM
To: pd-list at iem.kug.ac.at
Subject: Re: [PD] fftchannels

Messageagain

> ----- Original Message -----
> From: John Heenan
> To: pd-list at iem.kug.ac.at
> Sent: Thursday, January 24, 2002 11:33 AM
> Subject: RE: [PD] fftchannels
>
> The size of an array result of a FFT is the same size as the number of
samples. So if there are N samples a real domain FFT on > these samples
is held in an array of size N.
>
> John Heenan

in the help-patch of the rfft- i also read "the rfft outputs N/2 + 1
real parts". so the first value represents the DC and the last (N/2+1)
should represent the nyquist... the imag-parts for both are always 0.
(that´s the N/2-1).

marius.

```