IIRFilterNode.getFrequencyResponse()

The getFrequencyResponse() method of the IIRFilterNode interface takes the current filtering algorithm's settings and calculates the frequency response for frequencies specified in the frequencyHz array of frequencies.

The results are stored in two preexisting output arrays:

  • magResponse receiving the linear magnitude
  • phaseResponse receiving the phase response in radians.

Syntax

JavaScript
var audioCtx = new AudioContext();
var iirFilter = audioCtx.createIIRFilter();
iirFilter.getFrequencyResponse(myFrequencyArray,magResponseOutput,phaseResponseOutput);

Returns

None.

Parameters

getFrequencyResponse() takes as parameters three Float32Arrays:

frequencyHz
An array containing hertz values that you want the frequency response for.
magResponse
An array that will contain the outputted magnitude of the frequency response for each inputted frequency (hertz) value. The magnitude values are unitless.
phaseResponse
An array that will contain the outputted phase of the frequency response for each inputted frequency (hertz) value, measured in radians.

Specifications

Specification Status Comment
Web Audio API
The definition of 'getFrequencyResponse()' in that specification.
Working Draft  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 49.0 ? ? ? ?
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support 49.0 ? ? ? ? ? 49.0

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/iirfilternode/getfrequencyresponse()

API IIRFilterNode Method Reference Web Audio API