Skip to content
Tone.js

Analyser

class Component ↳ extends ToneAudioNode<AnalyserOptions<ChannelCount>>

Wrapper around the native Web Audio’s AnalyserNode. Extracts FFT or Waveform data from the incoming signal.

new Analyser(type?: AnalyserType, size?: number)

Parameters

  • type AnalyserType optional

    The return type of the analysis, either “fft”, or “waveform”.

  • size number optional

    The size of the FFT. This must be a power of two in the range 16 to 16384.

new Analyser(options?: Partial<AnalyserOptions<ChannelCount>>)

Parameters

read-only

input: InputNode

The input node or nodes. If the object is a source, it does not have any input and this.input is undefined.

read-only

name: string

The name of the class

Default: "Analyser"

read-only

output: OutputNode

The output nodes. If the object is a sink, it does not have any output and this.output is undefined.

read-only

channels: ChannelCount

The number of channels the analyser does the analysis on. Channel separation is done using Split

size: number

The size of analysis. This must be a power of two in the range 16 to 16384.

smoothing: number

0 represents no time averaging with the last analysis frame.

The analysis function returned by analyser.getValue(), either “fft” or “waveform”.

dispose(): this

Clean up.

Returns this

getValue(): ChannelCount extends 1 ? Float32Array<ArrayBuffer> : Float32Array<ArrayBuffer>[]

Run the analysis given the current settings. If channels = 1, it will return a Float32Array. If channels > 1, it will return an array of Float32Arrays where each index in the array represents the analysis done on a channel.

Returns ChannelCount extends 1 ? Float32Array<ArrayBuffer> : Float32Array<ArrayBuffer>[]

static

getDefaults(): AnalyserOptions<1>

Returns all of the default options belonging to the class.

Returns AnalyserOptions<1>