BiquadFilterNode
The BiquadFilterNode interface represents a low-order filter. It is an AudioNode used for tone controls, graphic equalizers, and other audio effects.
Multiple BiquadFilterNode instances can be combined to create more complex filtering chains.
AudioNode properties
| Number of inputs | 1 |
| Number of outputs | 1 |
| Channel count | 2 |
| Channel count mode | max |
| Channel interpretation | speakers |
Constructor
BaseAudioContext.createBiquadFilter()
Properties
It inherits all properties from AudioNode.
| Name | Type | Rate | Description |
|---|---|---|---|
frequency | AudioParam | k-rate | The filter’s cutoff or center frequency in hertz (Hz). |
detune | AudioParam | k-rate | Amount by which the frequency is detuned in cents. |
Q | AudioParam | k-rate | The filter’s Q factor (quality factor). |
gain | AudioParam | k-rate | Gain applied by specific filter types, in decibels (dB). |
type | BiquadFilterType | — | Defines the kind of filtering algorithm the node applies (e.g. "lowpass", "highpass"). |
BiquadFilterType enumeration description
Note: The detune parameter behaves the same way for all filter types, so it is not repeated below.
type | Description | frequency | Q | gain |
|---|---|---|---|---|
lowpass | Second-order resonant lowpass filter with 12dB/octave rolloff. Frequencies below the cutoff pass through; higher frequencies are attenuated. | The cutoff frequency. | Determines how peaked the frequency is around the cutoff. Higher values result in a sharper peak. | Not used |
highpass | Second-order resonant highpass filter with 12dB/octave rolloff. Frequencies above the cutoff pass through; lower frequencies are attenuated. | The cutoff frequency. | Determines how peaked the frequency is around the cutoff. Higher values result in a sharper peak. | Not used |
bandpass | Second-order bandpass filter. Frequencies within a given range pass through; others are attenuated. | The center of the frequency band. | Controls the bandwidth. Higher values result in a narrower band. | Not used |
lowshelf | Second-order lowshelf filter. Frequencies below the cutoff are boosted or attenuated; others remain unchanged. | The upper limit of the frequencies where the boost (or attenuation) is applied. | Not used | The boost (in dB) to be applied. Negative values attenuate the frequencies. |
highshelf | Second-order highshelf filter. Frequencies above the cutoff are boosted or attenuated; others remain unchanged. | The lower limit of the frequencies where the boost (or attenuation) is applied. | Not used | The boost (in dB) to be applied. Negative values attenuate the frequencies. |
peaking | Frequencies around a center frequency are boosted or attenuated; others remain unchanged. | The center of the frequency range where the boost (or an attenuation) is applied. | Controls the bandwidth. Higher values result in a narrower band. | The boost (in dB) to be applied. Negative values attenuate the frequencies. |
notch | Notch (band-stop) filter. Opposite of a bandpass filter: frequencies around the center are attenuated; others remain unchanged. | The center of the frequency range where the notch is applied. | Controls the bandwidth. Higher values result in a narrower band. | Not used |
allpass | Second-order allpass filter. All frequencies pass through, but changes the phase relationship between the various frequencies. | The frequency where the center of the phase transition occurs (maximum group delay). | Controls how sharp the phase transition is at the center frequency. Higher values result in a sharper transition and a larger group delay. | Not used |
Loading...
Methods
It inherits all methods from AudioNode.
getFrequencyResponse
| Parameters | Type | Description |
|---|---|---|
frequencyArray | Float32Array | Array of frequencies (in Hz), which you want to filter. |
magResponseOutput | Float32Array | Output array to store the computed linear magnitude values for each frequency. For frequencies outside the range [0, ], the corresponding results are NaN. |
phaseResponseOutput | Float32Array | Output array to store the computed phase response values (in radians) for each frequency. For frequencies outside the range [0, ], the corresponding results are NaN. |
length | number | The number of frequency values to process. It should match the length of all input and output arrays. |
Returns undefined.
Remarks
frequency
- Float. Default: 350.
- Range: [10, ].
detune
- Float. Default: 0.
Q
- Float. Default: 1.
- Range:
- For
lowpassandhighpassis [-Q, Q], where Q is the largest value for which does not overflow the single-precision floating-point representation. Numerically: Q ≈ 770.63678. - For
bandpass,notch,allpass, andpeaking: Q is related to the filter’s bandwidth and should be positive. - Not used for
lowshelfandhighshelf.
- For
gain
- Float. Default: 0.
- Range: [-40, 40].
- Positive values correspond to amplification; negative to attenuation.
type
BiquadFilterType. Default:"lowpass".