Skip to main content

IIRFilterNode

The IIRFilterNode interface represents a general infinite impulse response (IIR) filter. It is an AudioNode used for tone controls, graphic equalizers, and other audio effects. IIRFilterNode lets the parameters of the filter response be specified, so that it can be tuned as needed.

In general, it is recommended to use BiquadFilterNode for implementing higher-order filters, as it is less sensitive to numeric issues and its parameters can be automated. You can create all even-order IIR filters with BiquadFilterNode, but if odd-ordered filters are needed or automation is not needed, then IIRFilterNode may be appropriate.

Constructor

BaseAudioContext.createIIRFilter(options: IIRFilterNodeOptions)

interface IIRFilterNodeOptions {
feedforward: number[]; // array of floating-point values specifying the feedforward (numerator) coefficients
feedback: number[]; // array of floating-point values specifying the feedback (denominator) coefficients
}

Properties

It inherits all properties from AudioNode.

Methods

It inherits all methods from AudioNode.

getFrequencyResponse

ParameterTypeDescription
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, sampleRate2\frac{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, sampleRate2\frac{sampleRate}{2}], the corresponding results are NaN.

Returns undefined.