Web/API/IIRFilterNode

From Get docs

The IIRFilterNode interface of the Web Audio API is a AudioNode processor which implements a general infinite impulse response (IIR)  filter; this type of filter can be used to implement tone control devices and graphic equalizers as well. It lets the parameters of the filter response be specified, so that it can be tuned as needed.

Number of inputs 1
Number of outputs 1
Channel count mode "max"
Channel count Same as on the input
Channel interpretation "speakers"

Typically, it's best to use the BiquadFilterNode interface to implement higher-order filters. There are several reasons why:

  • Biquad filters are typically less sensitive to numeric quirks.
  • The filter parameters of biquad filters can be automated.
  • All even-ordered IIR filters can be created using BiquadFilterNode.

However, if you need to create an odd-ordered IIR filter, you'll need to use IIRFilterNode. You may also find this interface useful if you don't need automation, or for other reasons.

Once the node has been created, you can't change its coefficients.


IIRFilterNodes have a tail-time reference; they continue to output non-silent audio with zero input. As an IIR filter, the non-zero input continues forever, but this can be limited after some finite time in practice, when the output has approached zero closely enough. The actual time that takes depends on the filter coefficients provided.

Constructor

IIRFilterNode()
Creates a new instance of an IIRFilterNode object.

Properties

This interface has no properties of its own; however, it inherits properties from its parent, AudioNode.

Methods

Inherits methods from its parent, AudioNode. It also has the following additional methods:

getFrequencyResponse()
Uses the filter's current parameter settings to calculate the response for frequencies specified in the provided array of frequencies.

Examples

You can find a simple IIR filter demo live on Codepen. Also see the source code on GitHub. It includes some different coefficient values for different lowpass frequencies — you can change the value of the filterNumber constant to a value between 0 and 3 to check out the different available effects.

Also see our Using IIR filters guide for a full explanation.

Specifications

Specification Status Comment
Web Audio APIThe definition of 'IIRFilterNode' in that specification. Working Draft Initial Definition

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
IIRFilterNode Chrome

Full support 49

Edge

Full support ≤18

Firefox

Full support 50

IE

No support No

Opera

Full support 36

Safari

No support No

WebView Android

Full support 49

Chrome Android

Full support 49

Firefox Android

Full support 50

Opera Android

Full support 36

Safari iOS

No support No

Samsung Internet Android

Full support 5.0

IIRFilterNode() constructor

Chrome Full support 55

Notes'

Full support 55

Notes'

Notes' Before version 59, the default values were not supported.

Edge

Full support 79

Firefox

Full support 53

IE

No support No

Opera

Full support 42

Safari

No support No

WebView Android Full support 55

Notes'

Full support 55

Notes'

Notes' Before version 59, the default values were not supported.

Chrome Android Full support 55

Notes'

Full support 55

Notes'

Notes' Before version 59, the default values were not supported.

Firefox Android

Full support 53

Opera Android

Full support 42

Safari iOS

No support No

Samsung Internet Android Full support 6.0

Notes'

Full support 6.0

Notes'

Notes' Before Samsung Internet 7.0, the default values were not supported.

getFrequencyResponse Chrome

Full support 49

Edge

Full support 14

Firefox

Full support 50

IE

No support No

Opera

Full support 36

Safari

No support No

WebView Android

Full support 49

Chrome Android

Full support 49

Firefox Android

Full support 50

Opera Android

Full support 36

Safari iOS

No support No

Samsung Internet Android

Full support 5.0

Legend

Full support  
Full support
No support  
No support
See implementation notes.'
See implementation notes.


See also