A newer version of Max is available. Click here to access the latest version of this document.

pfft~

Spectral processing manager for patchers

Description

The pfft~ object is designed to simplify spectral audio processing using the Fast Fourier Transform (FFT). In addition to performing the FFT and the Inverse Fast Fourier Transform (IFFT), pfft~ (with the help of its companion fftin~ and fftout~ objects) manages the necessary signal windowing, overlapping and adding needed to create a real-time Short Term Fourier Transform (STFT) analysis/resynthesis system.
The number of inlets on the pfft~ object is determined by the number of fftin~ and/or in objects in the enclosed subpatch. Patchers loaded into a pfft~ object can only be given signal inlets by fftin~ objects within the patch. See fftin~ and in for details.

Arguments

Name Type Opt Description
subpatch-name symbol Obligatory. The first argument must be the name of a subpatch which will be loaded into the pfft~ and assigned its own signal-processing chain. The signal processing chain connections for input and output are made using fftin~ and fftout~ objects in the subpatcher.
FFT-size (samples) int opt Specifies the FFT size, in samples, of the overlapped windows which are transformed to and from the spectral domain by the FFT/IFFT. The window size must be a power of 2, and defaults to 512. (Note: The size of the spectral "frames" processed by the pfft~ object's subpatch will be half this size, as the 2nd half of the spectrum is a mirror of the first, and thus redundant.)
overlap-factor (hop-size-denominator) int opt The third argument determines the overlap factor for FFT analysis and resynthesis windows. The hop size (number of samples between each successive FFT window) of Fast Fourier transforms performed is equal to the size of the Fast Fourier transform divided by the overlap factor (e.g. if the frame size is 512 and the overlap is set to 2 then the hop size is 256 samples). The value must be a power of 2 and defaults to 2.
start-onset (samples) int opt The fourth argument specifies the start onset in samples for the Fast Fourier transform. It must be a multiple of the current signal vector size and defaults to 0.
full-spectrum-flag (0 or nonzero) int opt A non-zero fifth argument may be used to specify "full-spectrum mode". In this mode, the pfft~ object will internally compute a complex FFT and process full DC to SR mirrored spectra (instead of simply eliminating the redundant half of the spectrum). This takes up extra computing power, but may be potentially useful in some of the more esoteric spectral processing applications.

Messages

bang Patchers loaded into a pfft~ object can only accept bang messages by in objects within the patch. The number of inputs is determined by the in objects in the enclosed subpatch. See in for details.
int input [int]
Performs the same function as anything.
float input [float]
Performs the same function as anything.
list input [list]
Performs the same function as anything.
anything input [list]
Messages sent to the pfft~ cause the object to act according to the user-defined functionality within it.
(mouse) Double-clicking with the mouse on the pfft~ object opens a Max patcher window containing the patcher loaded by the object.
clear Clears all of the pfft~ object's internal buffers.
mute mute-flag (0 or 1) [int]
The word mute, followed by a 1 or 0, will mute or unmute the pfft~, turning off signal processing within the enclosed subpatch.
open subpatch-filename [int]
The word open will open the subpatch loaded into the pfft~ object.
wclose subpatch-filename [int]
Closes the enclosed subpatch if it is open.

Information for box attributes common to all objects

Output

message: Any messages received by an out object in a loaded patcher appear at the message outlet of the pfft~ object which corresponds to the number argument of the out object. The message outlets of a pfft~ object appear to the right of the rightmost signal outlet.
signal: The output is the result of the FFT-based signal processing subpatch. As with the fft~ and ifft~ objects, pfft~ introduces a slight delay from input to output (although it is less than half the delay than with an fft~ / ifft~ combination). The I/ O delay is equal to the window size minus the hop size (e.g., for a 1024-sample FFT window with an overlap factor of 4, the hop size is equal to 256, and the overall delay from input to output is 768 samples). The number of outlets is determined by the number of fftout~ and/or out objects in the loaded subpatcher. Patchers loaded into a pfft~ object can be given outlets by fftout~ or out objects within the patch. See fftout~ and out for details.

Examples

pfft~ loads subpatchers specially designed for frequency domain processing

See Also

Name Description
cartopol Cartesian to Polar coordinate conversion
cartopol~ Signal Cartesian to Polar coordinate conversion
fft~ Fast Fourier transform
fftin~ Input for a patcher loaded by pfft~
fftinfo~ Report information about a patcher loaded by pfft~
fftout~ Output for a patcher loaded by pfft~
frameaccum~ Compute "running phase" of successive phase deviation frames
framedelta~ Compute phase deviation between successive FFT frames
ifft~ Inverse fast Fourier transform
in Message input for a patcher loaded by poly~ or pfft~
out Message output for a patcher loaded by poly~ or pfft~
poltocar Polar to Cartesian coordinate conversion
poltocar~ Signal Polar to Cartesian coordinate conversion
vectral~ Vector-based envelope follower
MSP Tutorial 25: Using the FFT MSP Tutorial 25: Using the FFT
MSP Tutorial 26: Frequency Domain Signal Processing with pfft~ MSP Tutorial 26: Frequency Domain Signal Processing with pfft~