FFT   fast fourier transform

FFT.ar(fftsize, fftoffset, cosTable, inputWindow, outputWindow, real, imag)

FFT.a2sr(fftsize, fftoffset, cosTable, inputWindow, outputWindow, real, imag)
FFT.sr(cosTable, inputWindow, outputWindow, real, imag)

The fast fourier transform analyzes the frequency content of a signal.

The ar method takes audio rate input and produces audio rate output.
FFT.ar collects incoming audio until it has a full buffer, does the transform,
and then streams that buffer out while collecting a new buffer to analyze.

The a2sr method takes audio rate input and produces spectral rate output.
FFT.a2sr collects incoming audio until it has a full buffer, does the transform,
and then sends the whole spectrum out at once.
Spectral rate is preferred because it eliminates the latency due to streaming between
unit generators.

The sr method takes spectral rate input and produces spectral rate output.
When using sr, the fftsize and fftoffset arguments are not needed.

fftsize - the size of the FFT. Must be a power of two.
fftoffset - delay offset useful for overlapping multiple FFTs.
cosTable - the FFT requires a precomputed cosine lookup table. The Signal class has a class
method 'fftCosTable' that will create the proper table to pass for this argument.
inputWindow - a windowing function that will be multiplied by the input signal.
outputWindow - a windowing function that will be multiplied by the output spectrum.
real - the real part of the input signal.
imag - the imaginary part of the input signal. If not supplied then a real FFT will be performed.

More examples can be found in the "FFT examples" file.

(
// view magnitude spectrum of input.
{
 var fftsize, cosineTable, window, src, fft, wind, view, scopeBuf1, scopeBuf2, scope;
 var filename, sound, signal;
 
 fftsize = 1024;
 
 window = Signal.welchWindow(fftsize);   // make a signal analysis window
 cosineTable = Signal.fftCosTable(fftsize);  // make cosine table required for FFT
 
 src = AudioIn.ar(1);   // input wave
 
 // fourier transform
 fft =  FFT.ar(fftsize, 0, cosineTable, window, nil, src, 0.0);
 
 // wrap fft magnitude spectrum with Scope ugen
 Scope.window("FFT", fftsize, nil, fft.magnitudeApx);
 
 src
}.play;
GUIWindow.closeAll;
)


This page was created by SimpleText2Html 1.0.3 on 22-Feb-100.