The Fast Fourier Transform (FFT) is a central technnology in computer music, allowing an efficient transformation between the time domain (amplitude-time waveforms) and the frequency domain (spectrum, representing the phase and energy of component pure frequencies). It enables a variety of useful spectral processing techniques, and Fourier re-synthesis back into the time domain can be accomplished by an IFFT (Inverse FFT) or a third party additive synthesis UGen.

To process sound SuperCollider has a selection of PV (Phase Vocoder) UGens which are commonly used as in place operators on the FFT data:

input -> FFT -> PV_UGen1 ... PV_UGenN... -> IFFT -> output

See the code examples below for how this 'chain' looks in actual SC code form

example 1: do nothing transformation

s = Server.local.boot;

b = Buffer.alloc(s,1024,1); //a buffer must be allocated which gives the size of the FFT; 1024 sample window size in this case. The hop size is half the window by default.

(

{ var in, chain;

in = WhiteNoise.ar(0.8);

chain = FFT(b, in);//go from time domain to frequency domain; note that the UGen does not appear to run at a conventional rate (no .ar or .kr); in actual fact, FFT and PV_UGens are at control rate, but only calculate when there is data to act on; IFFT is at audio rate to produce output samples

//the output chain will always be -1 except when a block of fft data has been calculated; a trigger is then sent, essentiallyby returning the buffer number containing the data (i.e., b.bufnum in this case)

[IFFT(chain),in];//convert the data back to the time domain when input chain is a valid buffer number; I'm outputting in stereo with the IFFT output on the left and the original input on the right channel for comparison

}.play(s);

)

b.free; //frees the resource

example 2 PV UGen example; spectral filtering

b = Buffer.alloc(s,1024,1);

(

{ var in, chain;

in = WhiteNoise.ar(0.8);

chain = FFT(b, in);

//PV_BrickWall acts as a spectral filter, low pass when second argument (wipe) is -1 to 0 and high pass for 0 to 1

Technical Note: It is possible to run multiple machine listening UGens on a single FFT (since they usually do not disturb the data source itself); but unless you know what you're doing (i.e., are willing to check the source code for the UGens!) it is usually safest to assume they are changing the fft data in place. PV_Copy can be used to create copies of the FFT output without having to run the actual FFT itself again.