Interface BiquadFilterNode

BiquadFilterNode is an AudioNode processor implementing very common low-order filters.

Low-order filters are the building blocks of basic tone controls (bass, mid, treble), graphic equalizers, and more advanced filters. Multiple BiquadFilterNode filters can be combined to form more complex filters. The filter parameters such as "frequency" can be changed over time for filter sweeps, etc. Each BiquadFilterNode can be configured as one of a number of common filter types as shown in the IDL below. The default filter type is "lowpass"

numberOfInputs : 1 numberOfOutputs : 1

The filter types are briefly described below. We note that all of these filters are very commonly used in audio processing. In terms of implementation, they have all been derived from standard analog filter prototypes. For more technical details, we refer the reader to the excellent reference by Robert Bristow-Johnson.

All parameters are k-rate with the following default parameter values:

frequency

350Hz, with a nominal range of 10 to the Nyquist frequency (half the sample-rate).

Q

1, with a nominal range of 0.0001 to 1000.

gain

0, with a nominal range of -40 to 40.

Hierarchy

Index

Properties

Methods

Properties

public Q: AudioParam

public context: AudioContext

The AudioContext which owns this AudioNode.

public frequency: AudioParam

public gain: AudioParam

public numberOfInputs: number

The number of inputs feeding into the AudioNode. This will be 0 for an AudioSourceNode.

public numberOfOutputs: number

The number of outputs coming out of the AudioNode. This will be 0 for an AudioDestinationNode.

public type: BiquadFilterType

Methods

public connect(destination: AudioNode, output?: number, input?: number)

Connects the AudioNode to another AudioNode.

It is possible to connect an AudioNode output to more than one input with multiple calls to connect(). Thus, "fanout" is supported.

It is possible to connect an AudioNode to another AudioNode which creates a cycle. In other words, an AudioNode may connect to another AudioNode, which in turn connects back to the first AudioNode. This is allowed only if there is at least one DelayNode in the cycle or an exception will be thrown.

There can only be one connection between a given output of one specific node and a given input of another specific node. Multiple connections with the same termini are ignored. For example:

nodeA.connect(nodeB);
nodeA.connect(nodeB);

will have the same effect as

nodeA.connect(nodeB);

Parameters

  • destination: AudioNode

    the AudioNode to connect to.

  • output?: number optional

    an index describing which output of the AudioNode from which to connect. An out-of-bound value throws an exception.

  • input?: number optional

    an index describing which input of the destination AudioNode to connect to. An out-of-bound value throws an exception.

public connect(destination: AudioParam, output?: number)

Connects the AudioNode to an AudioParam, controlling the parameter value with an audio-rate signal.

It is possible to connect an AudioNode output to more than one AudioParam with multiple calls to connect(). Thus, "fanout" is supported.

It is possible to connect more than one AudioNode output to a single AudioParam with multiple calls to connect(). Thus, "fanin" is supported.

An AudioParam will take the rendered audio data from any AudioNode output connected to it and convert it to mono by down-mixing if it is not already mono, then mix it together with other such outputs and finally will mix with the intrinsic parameter value (the value the AudioParam would normally have without any audio connections), including any timeline changes scheduled for the parameter.

There can only be one connection between a given output of one specific node and a specific AudioParam. Multiple connections with the same termini are ignored. For example:

nodeA.connect(param);
nodeA.connect(param);

will have the same effect as

nodeA.connect(param);

Parameters

  • destination: AudioParam

    the AudioParam to connect to.

  • output?: number optional

    an index describing which output of the AudioNode from which to connect. An out-of-bound value throws an exception.

public disconnect(output?: number)

Disconnects an AudioNode's output.

Parameters

  • output?: number optional

    an index describing which output of the AudioNode to disconnect. An out-of-bound value throws an exception.

public getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any)

Given the current filter parameter settings, calculates the frequency response for the specified frequencies.

Parameters

  • frequencyHz: any

    an array of frequencies at which the response values will be calculated.

  • magResponse: any

    an output array receiving the linear magnitude response values.

  • phaseResponse: any

    an output array receiving the phase response values in radians.