AnalyserNode
The AnalyserNode interface represents a node providing two core functionalities: extracting time-domain data and frequency-domain data from audio signals.
It is an AudioNode that passes the audio data unchanged from input to output, but allows to take passed data and process it.
Time domain vs Frequency domain

A time-domain graph illustrates how a signal evolves over time, displaying changes in amplitude or intensity as time progresses. In contrast, a frequency-domain graph reveals how the signal's energy or power is distributed across different frequency bands, highlighting the presence and strength of various frequency components over a specified range.
Constructor
constructor(context: BaseAudioContext, options?: AnalyserOptions)
AnalyserOptions
Inherits all properties from AudioNodeOptions.
| Parameter | Type | Default | Description |
|---|---|---|---|
fftSize Optional | number | 2048 | Initial value for fftSize. |
minDecibels Optional | number | -100.0 | Initial value for minDecibels. |
maxDecibels Optional | number | -30.0 | Initial value for maxDecibels. |
smoothingTimeConstant Optional | number | 0.8 | Initial value for smoothingTimeConstant. |
You can also create an AnalyserNode via the BaseAudioContext.createAnalyser() factory method, which uses default values.
Properties
Inherits all properties from AudioNode.
AudioNodeproperties| Name | Type | Description |
|---|---|---|
fftSize | number | Integer value representing the size of Fast Fourier Transform used to determine frequency domain. In general it is the size of time-domain data that is returned. |
minDecibels | number | Float value representing the minimum value for the range of results from getByteFrequencyData(). |
maxDecibels | number | Float value representing the maximum value for the range of results from getByteFrequencyData(). |
smoothingTimeConstant | number | Float value representing the averaging constant with the last analysis frame. In general the higher value the smoother is the transition between values over time. |
frequencyBinCount Read only | number | Integer value representing the amount of the data obtained in frequency domain, half of the fftSize property. |
Methods
Inherits all methods from AudioNode.
AudioNodemethodsgetFloatFrequencyData
Copies the current frequency data into the given array. Each value in the array represents the decibel value for a specific frequency.
| Parameter | Type | Description |
|---|---|---|
array | Float32Array | The array to which the frequency data will be copied. |
Returns undefined.
getByteFrequencyData
Copies the current frequency data into the given array.
Each value in the array is within the range 0 to 255.
| Parameter | Type | Description |
|---|---|---|
array | Uint8Array | The array to which the frequency data will be copied. |
Returns undefined.
getFloatTimeDomainData
Copies the current time-domain data into the given array. Each value in the array is the magnitude of the signal at a particular time.
| Parameter | Type | Description |
|---|---|---|
array | Float32Array | The array to which the time-domain data will be copied. |
Returns undefined.
getByteTimeDomainData
Copies the current time-domain data into the given array.
Each value in the array is within the range 0 to 255, where value of 127 indicates silence.
| Parameter | Type | Description |
|---|---|---|
array | Uint8Array | The array to which the time-domain data will be copied. |
Returns undefined.
Remarks
fftSize
- Must be a power of 2 between
32and32768. - Throws
IndexSizeErrorif the provided value is not a power of 2, or is outside the allowed range.
minDecibels
0.0dB (decibel) is the loudest possible sound,-10.0dB is a 10th of that.- When getting data from
getByteFrequencyData(), any frequency with amplitude lower thanminDecibelswill be returned as0. - Throws
IndexSizeErrorif the provided value is greater than or equal tomaxDecibels.
maxDecibels
0.0dB (decibel) is the loudest possible sound,-10.0dB is a 10th of that.- When getting data from
getByteFrequencyData(), any frequency with amplitude higher thanmaxDecibelswill be returned as255. - Throws
IndexSizeErrorif the provided value is less than or equal tominDecibels.
smoothingTimeConstant
- Nominal range is
0.0-1.0. 0.0means no averaging,1.0means "overlap the previous and current buffer quite a lot while computing the value".- Throws
IndexSizeErrorif the provided value is outside the allowed range.