biquad~
Two-pole, two-zero filter
Description
biquad~ implements a two-pole, two-zero filter using the following equation:
y[n] = a0 * x[n] + a1 * x[n-1] + a2 * x[n-2] - b1 * y[n-1] - b2 * y[n-2]
You can specify the coefficients a0, a1, a2, b1, and b2 as signals or floats (if you make the filter explode by making the b coefficients too high, you can recover (after lowering them) with the message, or by turning the audio on and off).
Arguments
a0[float]
optional
Set the initial value for the a0 filter coefficient. If a signal is connected to the second inlet, the coefficient supplied as an argument is ignored.
a1[float]
optional
Set the initial value for the a1 filter coefficient. If a signal is connected to the third inlet, the coefficient supplied as an argument is ignored.
a2[float]
optional
Set the initial value for the a2 filter coefficient. If a signal is connected to the fourth inlet, the coefficient supplied as an argument is ignored.
b1[float]
optional
Set the initial value for the b1 filter coefficient. If a signal is connected to the fifth inlet, the coefficient supplied as an argument is ignored.
b2[float]
optional
Set the initial value for the b2 filter coefficient. If a signal is connected to the sixth inlet, the coefficient supplied as an argument is ignored.
Attributes
smooth[int]: 1
Toggles the smoothing of filter coeffient changes.
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
int
Converted to
The coefficients in inlets 2 to 6 may be specified by a number instead of a signal. If a signal is also connected to the inlet, the number value is ignored.
- filter-coefficient
[int]
float
The coefficients in inlets 2 to 6 may be specified by a
instead of a signal. If a signal is also connected to the inlet, the is ignored.- filter-coefficient
[float]
list
The five filter coefficients can be provided as a
in the left inlet. The first number in the is coefficient a0, the next is a1, and so on. If a signal is connected to a given inlet, the coefficient supplied in the for that inlet is ignored.- a0
[float]
- a1
[float]
- a2
[float]
- b1
[float]
- b2
[float]
clear
Clears the biquad~ object's memory of previous inputs and outputs, resetting xn-1, xn-2, yn-1, and yn-2 to 0.
dictionary
The word filterdesign object dictionary (set via the attribute), will cause the biquad~ object to use the dictionary values for filter coefficients.
, followed by a symbol that references a named- dictionary-name
[symbol]
signal
In left inlet: Signal to be filtered. The filter mixes the current input sample with the two previous input samples and the two previous output samples according to the formula:
yn = a0xn + a1xn-1 + a2xn-2 - b1yn-1 - b2yn-2.
In 2nd inlet: Amplitude coefficient a0, for scaling the amount of the current input to be passed directly to the output.
In 3rd inlet: Amplitude coefficient a1, for scaling the amount of the previous input sample to be added to the output.
In 4th inlet: Amplitude coefficient a2, for scaling the amount of input sample n-2 to be added to the output.
In 5th inlet: Amplitude coefficient b1, for scaling the amount of the previous output sample to be added to the current output.
In right inlet: Amplitude coefficient b2, for scaling the amount of output sample n-2 to be added to the current output. .
stoke
The word
, followed by a list that specifies a set of filter coefficient values, will preload the filter so that it starts in a given initial state, allowing the filter to be used for purposes such as a ringing oscillator.- a0
[float]
- a1
[float]
- a2
[float]
- b1
[float]
- b2
[float]
Output
signal
The filtered signal.
See Also
Name | Description |
---|---|
buffir~ | buffer-based FIR filter |
cascade~ | Cascaded series of biquad filters |
comb~ | Apply a comb filter effect |
cross~ | Third-order crossover filter |
filtercoeff~ | Signal-rate filter coefficient generator |
filtergraph~ | Filter editor |
lores~ | Resonant lowpass filter |
onepole~ | Single-pole lowpass filter |
reson~ | Resonant bandpass filter |
svf~ | State-variable filter with simultaneous outputs |
teeth~ | Comb filter with feedforward and feedback delay control |