Skip to main content

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 inputs1
Number of outputs1
Channel count2
Channel count modemax
Channel interpretationspeakers

Constructor

BaseAudioContext.createBiquadFilter()

Properties

NameTypeRateDescription
frequencyAudioParama-rateThe filter’s cutoff or center frequency in hertz (Hz)
detuneAudioParama-rateAmount by which the frequency is detuned in cents
QAudioParama-rateThe filter’s Q factor (quality factor).
gainAudioParama-rateGain applied by specific filter types, in decibels (dB)
typestringDefines the kind of filtering algorithm the node applies (e.g. "lowpass", "highpass").

BiquadFilterType enumeration description

typeDescriptionfrequencyQgain
lowpassSecond-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
highpassSecond-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
bandpassSecond-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
lowshelfSecond-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 usedThe boost (in dB) to be applied. Negative values attenuate the frequencies.
highshelfSecond-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 usedThe boost (in dB) to be applied. Negative values attenuate the frequencies.
peakingFrequencies 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.
notchNotch (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
allpassSecond-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

Methods

getFrequencyResponse

ParametersTypeDescription
frequencyArrayFloat32ArrayArray of frequencies (in Hz), which you want to filter.
magResponseOutputFloat32ArrayOutput array to store the computed linear magnitude values for each frequency. For frequencies outside the range [0, sampleRate / 2], the corresponding results are NaN.
phaseResponseOutputFloat32ArrayOutput array to store the computed phase response values (in radians) for each frequency. For frequencies outside the range [0, sampleRate / 2], the corresponding results are NaN.
lengthnumberThe number of frequency values to process. It should match the length of all input and output arrays.

Returns undefined.

Remarks

frequency

  • float, default value is 350.

detune

  • float, default value is 0.

Q

  • float, default value is 1.

gain