MSP Reference
Open Help

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 clear message, or by turning the audio on and off).

## Examples

Filter coefficients may be supplied as numerical values or as varying signals

## Arguments

### a0 [float]

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]

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]

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]

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]

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] (default: 1)

Toggles the smoothing of filter coeffient changes.

### annotation [symbol]

Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.

### background [int] (default: 0)

Adds or removes the object from the patcher's background layer. background 1 adds the object to the background layer, background 0 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'

### hidden [int] (default: 0)

Toggles whether an object is hidden when the patcher is locked.

### 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] (default: 0)

Toggles whether an object ignores mouse clicks in a locked patcher.

### patching_rect [4 floats] (default: 0. 0. 100. 0.)

Sets the position and size of the object in the patcher window.

### position [2 floats]

g/s(set)

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] (default: 0)

Sets whether an object belongs to the patcher's presentation.

### presentation_rect [4 floats] (default: 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]

g/s(set)

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]

g/s(set)

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 [float]

Sets the color for the object's text in RGBA format.

### textjustification [int]

Text Justification

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

#### Arguments

filter-coefficient [int]
Converted to float .

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.

### float

#### Arguments

filter-coefficient [float]
The coefficients in inlets 2 to 6 may be specified by a float instead of a signal. If a signal is also connected to the inlet, the float is ignored.

### list

#### Arguments

a0 [float]
a1 [float]
a2 [float]
b1 [float]
b2 [float]
The five filter coefficients can be provided as a list in the left inlet. The first number in the list is coefficient a0, the next is a1, and so on. If a signal is connected to a given inlet, the coefficient supplied in the list for that inlet is ignored.

### dictionary

#### Arguments

dictionary-name [symbol]
The word dictionary , followed by a symbol that references a named filterdesign object dictionary (set via the name attribute), will cause the biquad~ object to use the dictionary values for filter coefficients.

### clear

Clears the biquad~ object's memory of previous inputs and outputs, resetting xn-1, xn-2, yn-1, and yn-2 to 0.

### 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

#### Arguments

a0 [float]
a1 [float]
a2 [float]
b1 [float]
b2 [float]
The word stoke , 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.

## Output

### signal

The filtered signal.