AnalyserNode

« Web Audio API

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

The AnalyserNode interface represents a node able to provide real-time frequency and time-domain analysis information. It is an AudioNode that passes the audio stream unchanged 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.

  • Number of inputs 1
  • Number of outputs 1 (but may be left unconnected)
  • Channel count mode "explicit"
  • Channel count 1
  • Channel interpretation "speakers"

Properties

Inherits properties from its parent, AudioNode.

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; its default value is 2048. If not a power of 2, or outside the specified range, the exception INDEX_SIZE_ERR is thrown.
AnalyserNode.frequencyBinCount Read only
Is an unsigned long value containing half the FFT size.
AnalyserNode.minDecibels
Is a double value representing the minimum power value in the scaling range for the FFT analysis data for conversion to unsigned byte values. If a value greater than AnalyserNode.maxDecibels is set, an INDEX_SIZE_ERR exception is thrown. It defaults to -100.
AnalyserNode.maxDecibels
Is a double value representing the maximumum power value in the scaling range for the FFT analysis data for conversion to unsigned byte values. If a value smaller than AnalyserNode.minDecibels is set, an INDEX_SIZE_ERR exception is thrown. It defaults to -30.
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.

Analyser.getFloatFrequencyData()
Copies the current frequency data into the array, the passed floating-point array. If the array has fewer elements than the frequencyBinCount, excess elements are dropped. If it has more elements than needed, excess elements are ignored.
Analyser.getByteFrequencyData()
Copies the current frequency data into the array, the passed unsigned byte array. If the array has fewer elements than the frequencyBinCount, excess elements are dropped. If it has more elements than needed, excess elements are ignored.
Analyser.getByteTimeDomainData()
Copies the current waveform, or time-domain, data into the array, the passed unsigned byte array. If the array has fewer elements than the fftSize, excess elements are dropped. If it has more elements than needed, excess elements are ignored.

Examples

 

Specifications

Specification Status Comment
Web Audio API Working Draft  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes)webkit Activated on Nightly only Not supported Not supported ?
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support Not supported Activated on Nightly only Not supported Not supported ?

See also

  • Using Web Audio API

Attachments

File Size Date Attached by
The AnalyserNode provide a FFT of the audio data
Without modifying the audio stream, the node allows to get the frequency and time-domain data associated to it, using a FFT.
21267 bytes 2013-04-09 09:07:27 teoli

Document Tags and Contributors

Contributors to this page: Sheppy, tregagnon, 0xABCDEF, leobalter, teoli
Last updated by: 0xABCDEF,