Analyser
class Component ↳ extends ToneAudioNode<AnalyserOptions>
Wrapper around the native Web Audio’s AnalyserNode. Extracts FFT or Waveform data from the incoming signal.
Constructor
Section titled “Constructor”new Analyser(type?: AnalyserType, size?: number)Parameters
-
type
AnalyserTypeoptionalThe return type of the analysis, either “fft”, or “waveform”.
-
size
numberoptionalThe size of the FFT. This must be a power of two in the range 16 to 16384.
new Analyser(options?: Partial<AnalyserOptions>)Parameters
- options
Partial<AnalyserOptions>optional
Properties
Section titled “Properties”read-only
input: InputNodeThe input node or nodes. If the object is a source, it does not have any input and this.input is undefined.
output
Section titled “output”read-only
output: OutputNodeThe output nodes. If the object is a sink, it does not have any output and this.output is undefined.
channels
Section titled “channels”read-only
channels: numberThe number of channels the analyser does the analysis on. Channel separation is done using Split
size: numberThe size of analysis. This must be a power of two in the range 16 to 16384.
smoothing
Section titled “smoothing”smoothing: number0 represents no time averaging with the last analysis frame.
type: AnalyserTypeThe analysis function returned by analyser.getValue(), either “fft” or “waveform”.
Methods
Section titled “Methods”getValue()
Section titled “getValue()”getValue(): 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 Float32Array<ArrayBuffer> | Float32Array<ArrayBuffer>[]
getDefaults()
Section titled “getDefaults()”static
getDefaults(): AnalyserOptionsReturns all of the default options belonging to the class.
Returns AnalyserOptions
Inherited members
Section titled “Inherited members”- From
ToneWithContext: context, blockTime, sampleTime, get(), immediate(), now(), set(), toFrequency(), toSeconds(), toTicks() - From
Tone: debug, version, disposed, toString() - From
ToneAudioNode: channelCount, channelCountMode, channelInterpretation, numberOfInputs, numberOfOutputs, chain(), connect(), disconnect(), fan(), toDestination(), toMaster()