Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 930599 of BiquadFilterNode

  • Revision slug: Web/API/BiquadFilterNode
  • Revision title: BiquadFilterNode
  • Revision id: 930599
  • Created:
  • Creator: Sebastianz
  • Is current revision? No
  • Comment Replaced list for properties by table (bug 1212752)

Revision Content

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

The BiquadFilterNode interface represents a simple low-order filter, and is created using the {{ domxref("AudioContext.createBiquadFilter()") }} method. It is an {{domxref("AudioNode")}} that can represent different kinds of filters, tone control devices, and graphic equalizers. A BiquadFilterNode always has exactly one input and one output.

Number of inputs 1
Number of outputs 1
Channel count mode "max"
Channel count 2 (not used in the default count mode)
Channel interpretation "speakers"

Properties

Inherits properties from its parent, {{domxref("AudioNode")}}.

{{domxref("BiquadFilterNode.frequency")}}
Is a {{k-rate}} {{domxref("AudioParam")}}, a double representing a frequency in the current filtering algorithm measured in hertz (Hz).
{{domxref("BiquadFilterNode.detune")}}
Is an {{a-rate}} {{domxref("AudioParam")}} representing detuning of the frequency in cents.
{{domxref("BiquadFilterNode.Q")}}
Is a {{k-rate}} {{domxref("AudioParam")}}, a double representing a Q factor, or quality factor.
{{domxref("BiquadFilterNode.gain")}} {{readonlyInline}}
Is a {{k-rate}} {{domxref("AudioParam")}}, a double representing the gain used in the current filtering algorithm.
{{domxref("BiquadFilterNode.type")}}
Is a string value defining the kind of filtering algorithm the node is implementing.
 
The meaning of the different parameters depending of the type of the filter (detune has the same meaning regardless, so isn't listed below)
type Description frequency Q gain
lowpass Standard second-order resonant lowpass filter with 12dB/octave rolloff. Frequencies below the cutoff pass through; frequencies above it are attenuated. The cutoff frequency. Indicates how peaked the frequency is around the cutoff. The greater the value is, the greater is the peak. Not used
highpass Standard second-order resonant highpass filter with 12dB/octave rolloff. Frequencies below the cutoff are attenuated; frequencies above it pass through. The cutoff frequency. Indicates how peaked the frequency is around the cutoff. The greater the value, the greater the peak. Not used
bandpass Standard second-order bandpass filter. Frequencies outside the given range of frequencies are attenuated; the frequencies inside it pass through. The center of the range of frequencies. Controls the width of the frequency band. The greater the Q value, the smaller the frequency band. Not used
lowshelf Standard second-order lowshelf filer. Frequencies lower than the frequency get a boost, or an attenuation; frequencies over it are unchanged. The upper limit of the frequencies getting a boost or an attenuation. Not used The boost, in dB, to be applied; if negative, it will be an attenuation.
highshelf Standard second-order highshelf filer. Frequencies higher than the frequency get a boost or an attenuation; frequencies lower than it are unchanged. The lower limit of the frequencies getting a boost or an attenuation. Not used The boost, in dB, to be applied; if negative, it will be an attenuation.
peaking Frequencies inside the range get a boost or an attenuation; frequencies outside it are unchanged. The middle of the frequency range getting a boost or an attenuation. Controls the width of the frequency band. The greater the Q value, the smaller the frequency band. The boost, in dB, to be applied; if negative, it will be an attenuation.
notch Standard notch filter, also called a band-stop or band-rejection filter. It is the opposite of a bandpass filter: frequencies outside the give range of frequencies pass through; frequencies inside it are attenuated. The center of the range of frequencies. Controls the width of the frequency band. The greater the Q value, the smaller the frequency band. Not used
allpass Standard second-order allpass filter. It lets all frequencies through, but changes the phase-relationship between the various frequencies. The frequency with the maximal group delay, that is, the frequency where the center of the phase transition occurs. Controls how sharp the transition is at the medium frequency. The larger this parameter is, the sharper and larger the transition will be. Not used

Methods

Inherits methods from its parent, {{domxref("AudioNode")}}.

{{domxref("BiquadFilterNode.getFrequencyResponse()")}}
From the current filter parameter settings this method calculates the frequency response for frequencies specified in the provided array of frequencies.

Example

{{page("/en-US/docs/Web/API/AudioContext.createBiquadFilter","Example")}}

Specifications

Specification Status Comment
{{SpecName('Web Audio API', '#the-biquadfilternode-interface', 'BiquadFilterNode')}} {{Spec2('Web Audio API')}}  

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatChrome(10.0)}}{{property_prefix("webkit")}} {{CompatGeckoDesktop(25.0)}}  {{CompatNo}} 15.0{{property_prefix("webkit")}}
22 (unprefixed)
6.0{{property_prefix("webkit")}}
Feature Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support {{CompatUnknown}} 26.0 1.2 {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} 33.0

See also

Revision Source

<p>{{APIRef("Web Audio API")}}</p>

<div>
<p><span class="seoSummary">The <code>BiquadFilterNode</code> interface represents a simple low-order filter, and is created using the {{ domxref("AudioContext.createBiquadFilter()") }} method. It is an {{domxref("AudioNode")}} that can represent different kinds of filters, tone control devices, and graphic equalizers.</span> A <code>BiquadFilterNode</code> always has exactly one input and one output.</p>
</div>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">Number of inputs</th>
   <td><code>1</code></td>
  </tr>
  <tr>
   <th scope="row">Number of outputs</th>
   <td><code>1</code></td>
  </tr>
  <tr>
   <th scope="row">Channel count mode</th>
   <td><code>"max"</code></td>
  </tr>
  <tr>
   <th scope="row">Channel count</th>
   <td><code>2</code> (not used in the default count mode)</td>
  </tr>
  <tr>
   <th scope="row">Channel interpretation</th>
   <td><code>"speakers"</code></td>
  </tr>
 </tbody>
</table>

<h2 id="Properties">Properties</h2>

<p><em>Inherits properties from its parent, </em><em>{{domxref("AudioNode")}}</em>.</p>

<dl>
 <dt>{{domxref("BiquadFilterNode.frequency")}}</dt>
 <dd>Is a {{k-rate}} {{domxref("AudioParam")}}, a double representing a frequency in the current filtering algorithm measured in hertz (Hz).</dd>
 <dt>{{domxref("BiquadFilterNode.detune")}}</dt>
 <dd>Is an {{a-rate}} {{domxref("AudioParam")}} representing detuning of the frequency in <a class="external external-icon" href="https://en.wikipedia.org/wiki/Cent_%28music%29">cents</a>.</dd>
 <dt>{{domxref("BiquadFilterNode.Q")}}</dt>
 <dd>Is a {{k-rate}} {{domxref("AudioParam")}}, a double representing a <a href="https://en.wikipedia.org/wiki/Q_factor" title="https://en.wikipedia.org/wiki/Q_factor">Q factor</a>, or <em>quality factor</em>.</dd>
 <dt>{{domxref("BiquadFilterNode.gain")}} {{readonlyInline}}</dt>
 <dd>Is a {{k-rate}} {{domxref("AudioParam")}}, a double representing the <a href="https://en.wikipedia.org/wiki/Gain" title="https://en.wikipedia.org/wiki/Gain">gain</a> used in the current filtering algorithm.</dd>
 <dt>{{domxref("BiquadFilterNode.type")}}</dt>
 <dd>Is a string value defining the kind of filtering algorithm the node is implementing.<br />
 &nbsp;
 <table class="standard-table">
  <caption>The meaning of the different parameters depending of the type of the filter (detune has the same meaning regardless, so isn't listed below)</caption>
  <thead>
   <tr>
    <th scope="row"><code>type</code></th>
    <th scope="col">Description</th>
    <th scope="col"><code>frequency</code></th>
    <th scope="col"><code>Q</code></th>
    <th scope="col"><code>gain</code></th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <th scope="row"><code>lowpass</code></th>
    <td>Standard second-order resonant lowpass filter with 12dB/octave rolloff. Frequencies below the cutoff pass through; frequencies above it are attenuated.</td>
    <td>The cutoff frequency.</td>
    <td>Indicates how peaked the frequency is around the cutoff. The greater the value is, the greater is the peak.</td>
    <td><em>Not used</em></td>
   </tr>
   <tr>
    <th scope="row"><code>highpass</code></th>
    <td>Standard second-order resonant highpass filter with 12dB/octave rolloff. Frequencies below the cutoff are attenuated; frequencies above it pass through.</td>
    <td>The cutoff frequency.</td>
    <td>Indicates how peaked the frequency is around the cutoff. The greater the value, the greater the peak.</td>
    <td><em>Not used</em></td>
   </tr>
   <tr>
    <th scope="row"><code>bandpass</code></th>
    <td>Standard second-order bandpass filter. Frequencies outside the given range of frequencies are attenuated; the frequencies inside it pass through.</td>
    <td>The center of the range of frequencies.</td>
    <td>Controls the width of the frequency band. The greater the <code>Q</code> value, the smaller the frequency band.</td>
    <td><em>Not used</em></td>
   </tr>
   <tr>
    <th scope="row"><code>lowshelf</code></th>
    <td>Standard second-order lowshelf filer. Frequencies lower than the frequency get a boost, or an attenuation; frequencies over it are unchanged.</td>
    <td>The upper limit of the frequencies getting a boost or an attenuation.</td>
    <td><em>Not used</em></td>
    <td>The boost, in dB, to be applied; if negative, it will be an attenuation.</td>
   </tr>
   <tr>
    <th scope="row"><code>highshelf</code></th>
    <td>Standard second-order highshelf filer. Frequencies higher than the frequency get a boost or an attenuation; frequencies lower than it are unchanged.</td>
    <td>The lower limit of the frequencies getting a boost or an attenuation.</td>
    <td><em>Not used</em></td>
    <td>The boost, in dB, to be applied; if negative, it will be an attenuation.</td>
   </tr>
   <tr>
    <th scope="row"><code>peaking</code></th>
    <td>Frequencies inside the range get a boost or an attenuation; frequencies outside it are unchanged.</td>
    <td>The middle of the frequency range getting a boost or an attenuation.</td>
    <td>Controls the width of the frequency band. The greater the <code>Q</code> value, the smaller the frequency band.</td>
    <td>The boost, in dB, to be applied; if negative, it will be an attenuation.</td>
   </tr>
   <tr>
    <th scope="row"><code>notch</code></th>
    <td>Standard <a href="https://en.wikipedia.org/wiki/Band-stop_filter" title="/en-US/docs/">notch</a> filter, also called a <em>band-stop</em> or <em>band-rejection</em> filter. It is the opposite of a bandpass filter: frequencies outside the give range of frequencies pass through; frequencies inside it are attenuated.</td>
    <td>The center of the range of frequencies.</td>
    <td>Controls the width of the frequency band. The greater the <code>Q</code> value, the smaller the frequency band.</td>
    <td><em>Not used</em></td>
   </tr>
   <tr>
    <th scope="row"><code>allpass</code></th>
    <td>Standard second-order <a href="https://en.wikipedia.org/wiki/All-pass_filter#Digital_Implementation" title="/en-US/docs/">allpass</a> filter. It lets all frequencies through, but changes the phase-relationship between the various frequencies.</td>
    <td>The frequency with the maximal <a href="https://en.wikipedia.org/wiki/Group_delay_and_phase_delay" title="/en-US/docs/">group delay</a>, that is, the frequency where the center of the phase transition occurs.</td>
    <td>Controls how sharp the transition is at the medium frequency. The larger this parameter is, the sharper and larger the transition will be.</td>
    <td><em>Not used</em></td>
   </tr>
  </tbody>
 </table>
 </dd>
</dl>

<h2 id="Methods">Methods</h2>

<p><em>Inherits methods from its parent, </em><em>{{domxref("AudioNode")}}</em>.</p>

<dl>
 <dt>{{domxref("BiquadFilterNode.getFrequencyResponse()")}}</dt>
 <dd>From the current filter parameter settings this method calculates the frequency response for frequencies specified in the provided array of frequencies.</dd>
</dl>

<h2 id="Example">Example</h2>

<p>{{page("/en-US/docs/Web/API/AudioContext.createBiquadFilter","Example")}}</p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Web Audio API', '#the-biquadfilternode-interface', 'BiquadFilterNode')}}</td>
   <td>{{Spec2('Web Audio API')}}</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatChrome(10.0)}}{{property_prefix("webkit")}}</td>
   <td>{{CompatGeckoDesktop(25.0)}}&nbsp;</td>
   <td>{{CompatNo}}</td>
   <td>15.0{{property_prefix("webkit")}}<br />
    22 (unprefixed)</td>
   <td>6.0{{property_prefix("webkit")}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>Firefox OS</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
   <th>Chrome for Android</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>26.0</td>
   <td>1.2</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>33.0</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="/en-US/docs/Web_Audio_API/Using_Web_Audio_API">Using the Web Audio API</a></li>
</ul>
Revert to this revision