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.
Discussion
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
subpatch-name[symbol]
optional
Name of patcher to load
FFT-size[int]samples
optional
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, unless the full-spectrum-flag is present.)
overlap-factor (hop-size-denominator)[int]
optional
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 this overlap factor. (e.g. if the frame size is 512 and the overlap is set to 4 then the hop size is 128 samples). The value must be a power of 2 and defaults to 2. A value of 4 is recommended for most applications.
start-onset[int]samples
optional
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]
optional
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 extra computing power but may be potentially useful in some of the more esoteric spectral processing applications.
'args' and list-of-argument-values[symbol]
optional
Use the argument
followed by an argument value to initialize any pound-sign arguments in the loaded patcher (e.g., ). If used, the argument must be the last argument word used; everything which appears after the word will be treated as an argument value.Attributes
Common Box Attributes
annotation[symbol]
Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.
background[int]: 0
Adds or removes the object from the patcher's background layer.
adds the object to the background layer, removes it. Objects in the background layer are shown behind all objects in the default foreground layer.
color[4 floats]
Sets the color for the object box outline.
fontface[int]
Sets the type style used by the object. The options are:
plain
bold
italic
bold italic
Possible values:
0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'
fontname[symbol]
Sets the object's font.
fontsize[float]
Sets the object's font size (in points).
Possible values:
'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'
hint[symbol]
Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.
ignoreclick[int]: 0
Toggles whether an object ignores mouse clicks in a locked patcher.
jspainterfile[symbol]
JS Painter File
patching_rect[4 floats]: 0. 0. 100. 0.
Sets the position and size of the object in the patcher window.
position[2 floats]
write-only
Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.
presentation[int]: 0
Sets whether an object belongs to the patcher's presentation.
presentation_rect[4 floats]: 0. 0. 0. 0.
Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.
rect[4 floats]
write-only
Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).
size[2 floats]
write-only
Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.
textcolor[4 floats]
Sets the color for the object's text in RGBA format.
textjustification[int]
Sets the justification for the object's text.
Possible values:
0 = 'left'
1 = 'center'
2 = 'right'
varname[symbol]
Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.
Messages
bang
int
Integer values sent to the pfft~ object cause the object to act according to the user-defined functionality within it.
- input
[int]
float
Floating-point values sent to the pfft~ object cause the object to act according to the user-defined functionality within it.
- input
[float]
list
Lists sent to the pfft~ object cause the object to act according to the user-defined functionality within it.
- input
[list]
anything
Messages sent to the pfft~ object cause the object to act according to the user-defined functionality within it.
- input
[list]
clear
Clears all of the pfft~ object's internal buffers.
(mouse)
Double-clicking with the mouse on the pfft~ object opens a Max patcher window containing the patcher loaded by the object.
mute
The word pfft~, turning off signal processing within the enclosed subpatch.
, followed by a 1 or 0, will mute or unmute the- mute-flag (0 or 1)
[int]
open
wclose
Closes the enclosed subpatch if it is open.
- subpatch-filename
[int]
Output
message
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.
See Also
Name | Description |
---|---|
cartopol | Convert cartesian to polar coordinates |
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 | Convert polar to cartesian coordinates |
poltocar~ | Signal Polar to Cartesian coordinate conversion |
vectral~ | Vector-based envelope follower |