BaseAudioContext: createIIRFilter() method

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{ APIRef("Web Audio API") }}

The **createIIRFilter() method of the {{domxref("BaseAudioContext")}} interface creates an {{ domxref("IIRFilterNode") }}, which represents a general infinite impulse response** (IIR) filter which can be configured to serve as various types of filter.

توجه: The {{domxref("IIRFilterNode.IIRFilterNode", "IIRFilterNode()")}} constructor is the recommended way to create an {{domxref("IIRFilterNode")}}; see Creating an AudioNode.

Syntax

js-nolint
createIIRFilter(feedforward, feedback)

Parameters

  • feedforward
  • : An array of floating-point values specifying the feedforward (numerator)

coefficients for the transfer function of the IIR filter. The maximum length of this array is 20, and at least one value must be nonzero.

  • feedback
  • : An array of floating-point values specifying the feedback (denominator) coefficients

for the transfer function of the IIR filter. This array may have up to 20 members, the first of which must not be zero.

Return value

An {{domxref("IIRFilterNode")}} implementing the filter with the specified feedback and feedforward coefficient arrays.

Exceptions

  • InvalidStateError {{domxref("DOMException")}}
  • : Thrown if all of the feedforward coefficients are 0, or if the first

feedback coefficient is 0.

  • NotSupportedError {{domxref("DOMException")}}
  • : Thrown if one or both of the input arrays exceeds 20 members.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • Using the Web Audio API
  • {{domxref("IIRFilterNode")}}
  • {{domxref("AudioNode")}}