AnalyserNode

  • Revision slug: DOM/AnalyserNode
  • Revision title: AnalyserNode
  • Revision id: 376191
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

« Web Audio API

{{SeeCompatTable}}

The AnalyserNode interface represents a note able to provide real-time frequency and time-domain analysis information. It is an {{domxref("AudioNode")}} that passes the audio stream from the input to the output. It has exactly one input and one output. The node works even if the output is not connected.

Without modifying the audio stream, the node allows to get the frequency and time-domain data associated to it, using a FFT.

Attributes

Inherits attributes from its parent, AudioNode.

{{domxref("AnalyserNode.fftSize")}}
Is an unsigned long value representing the size of the Fast Fourier Transform to be used to determine the frequency domain. It must be a non-zero power of 2 in the range between 32 and 2048, included. and its default value is 2048. If not a power of 2 or outside the specified range, the exception INDEX_SIZE_ERR is thrown.
{{domxref("AnalyserNode.frequencyBinCount")}}
Is an unsigned long value containing half the FFT size. Read-only.
{{domxref("AnalyserNode.minDecibels")}}
Is a double value representing the minimum power value in the scaling range for the FFT analysis data for conversion to unsigned bytw values. If a value greater than AnalyserNode.maxDecibels is set, an INDEX_SIZE_ERR exception is thrown. It defaults to -100.
{{domxref("AnalyserNode.maxDecibels")}}
Is a double value representing the maximumum power value in the scaling range for the FFT analysis data for conversion to unsigned bytw values. If a value smaller than AnalyserNode.minDecibels is set, an INDEX_SIZE_ERR exception is thrown. It defaults to -30.
{{domxref("AnalyserNode.smoothingTimeConstant")}}
Is a double value representing the averaging constant with the last analysis frame. It must be between 0 and 1, included and defaults to 0.8 (and 0 meaning no time averaging). If outside this range, an INDEX_SIZE_ERR exception is thrown

Methods

Inherits methods from its parent, AudioNode.

{{domxref("Analyser.getFloatFrequencyData")}}
Copies...
{{domxref("Analyser.getByteFrequencyData")}}
Copies
{{domxref("Analyser.getByteTimeDomainData")}}
Copies...

Examples

 

Specifications

Specification Status Comment
{{SpecName('Web Audio API', '#AnalyserNode-section', 'AnalyserNode')}} {{Spec2('Web Audio API')}}  

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatVersionUnknown}}{{property_prefix("webkit")}} Activated on Nightly and Aurora only {{CompatNo}} {{CompatNo}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatNo}} Activated on Nightly and Aurora only {{CompatNo}} {{CompatNo}} {{CompatUnknown}}

See also

  • Using Web Audio API

Revision Source

<p>« <a href="/en-US/docs/Web_Audio_API" title="/en-US/docs/Web_Audio_API">Web Audio API</a></p>
<p>{{SeeCompatTable}}</p>
<p>The <strong><code>AnalyserNode</code></strong><strong> </strong>interface represents a note able to provide real-time frequency and time-domain analysis information. It is an {{domxref("AudioNode")}} that passes the audio stream from the input to the output. It has exactly one input and one output. The node works even if the output is not connected.</p>
<p><img alt="Without modifying the audio stream, the node allows to get the frequency and time-domain data associated to it, using a FFT." src="https://mdn.mozillademos.org/files/5119/WebAudioFFT.png" style="width: 661px; height: 174px;" /></p>
<h2 id="Attributes">Attributes</h2>
<p><em>Inherits attributes from its parent, </em><code>AudioNode</code>.</p>
<dl>
  <dt>
    {{domxref("AnalyserNode.fftSize")}}</dt>
  <dd>
    Is an unsigned long value representing the size of the <a href="/en-US/docs/" title="/en-US/docs/">Fast Fourier Transform</a> to be used to determine the frequency domain. It must be a non-zero power of 2 in the range between <code>32</code> and <code>2048</code>, included. and its default value is <code>2048</code>. If not a power of 2 or outside the specified range, the exception <code>INDEX_SIZE_ERR</code> is thrown.</dd>
  <dt>
    {{domxref("AnalyserNode.frequencyBinCount")}}</dt>
  <dd>
    Is an unsigned long value containing half the FFT size. <strong>Read-only</strong>.</dd>
  <dt>
    {{domxref("AnalyserNode.minDecibels")}}</dt>
  <dd>
    Is a double value representing the minimum power value in the scaling range for the FFT analysis data for conversion to unsigned bytw values. If a value greater than <code>AnalyserNode.maxDecibels</code> is set, an <code>INDEX_SIZE_ERR</code> exception is thrown. It defaults to <code>-100</code>.</dd>
  <dt>
    {{domxref("AnalyserNode.maxDecibels")}}</dt>
  <dd>
    Is a double value representing the maximumum power value in the scaling range for the FFT analysis data for conversion to unsigned bytw values. If a value smaller than <code>AnalyserNode.minDecibels</code> is set, an <code>INDEX_SIZE_ERR</code> exception is thrown. It defaults to <code>-30</code>.</dd>
  <dt>
    {{domxref("AnalyserNode.smoothingTimeConstant")}}</dt>
  <dd>
    Is a double value representing the averaging constant with the last analysis frame. It must be between <code>0</code> and <code>1</code>, included and defaults to <code>0.8</code> (and <code>0</code> meaning no time averaging). If outside this range, an <code>INDEX_SIZE_ERR</code> exception is thrown</dd>
</dl>
<h2 id="Methods">Methods</h2>
<p><em>Inherits methods from its parent, </em><code>AudioNode</code>.</p>
<dl>
  <dt>
    {{domxref("Analyser.getFloatFrequencyData")}}</dt>
  <dd>
    Copies...</dd>
</dl>
<dl>
  <dt>
    {{domxref("Analyser.getByteFrequencyData")}}</dt>
  <dd>
    Copies</dd>
</dl>
<dl>
  <dt>
    {{domxref("Analyser.getByteTimeDomainData")}}</dt>
  <dd>
    Copies...</dd>
</dl>
<h2 id="Examples">Examples</h2>
<p>&nbsp;</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', '#AnalyserNode-section', 'AnalyserNode')}}</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>{{CompatVersionUnknown}}{{property_prefix("webkit")}}</td>
        <td>Activated on Nightly and Aurora only</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatUnknown}}</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>IE Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatNo}}</td>
        <td>Activated on Nightly and Aurora only</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatUnknown}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li>Using Web Audio API</li>
</ul>
Revert to this revision