API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classAudioAnalyser

@codexo/exojs-audio-fx / audio / stable

Lightweight visualisation analyser backed by a Web Audio AnalyserNode. Accepts any of: AudioBus, Voice, MediaStream, AudioNode, or null. The tap is a parallel branch - it does not affect the source's main routing. Tap a bus for a whole submix, or an individual Voice (its `output` node) for a single playing instance.

6
props
12
methods
0
events
Import
import { AudioAnalyser } from '@codexo/exojs-audio-fx'

Lightweight visualisation analyser backed by a Web Audio AnalyserNode.

Accepts any of: AudioBus, Voice, MediaStream, AudioNode, or null. The tap is a parallel branch - it does not affect the source's main routing. Tap a bus for a whole submix, or an individual Voice (its `output` node) for a single playing instance.

Constructors1
Create an AudioAnalyser with the given options. The underlying AnalyserNode is created immediately if the AudioContext is already running, or deferred until onAudioContextReady fires.
Methods12
destroy(): void
Disconnect the analyser tap, release the internal AnalyserNode, and cancel any pending setup callbacks. Call when the analyser is no longer needed to avoid memory leaks.
getBandEnergy(fromHz: number, toHz: number): number
Return the mean energy of frequency bins in the given Hz range, normalised 0..1. Uses the byte spectrum (0..255), normalised by dividing by 255.
getLowMidHigh(): { high: number; low: number; mid: number }
Return low (0-250 Hz), mid (250-2 kHz), and high (2 k-20 kHz) band energies (0..1 each).
getRms(): number
Return overall RMS energy across all bins, normalised 0..1.
getSpectrum(into?: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>
Fill and return the byte frequency spectrum (0..255 per bin).
getSpectrumFloat(into?: Float32Array<ArrayBuffer>): Float32Array<ArrayBuffer>
Fill and return the float frequency spectrum (dB per bin).
getSpectrumLog(into?: Uint8Array<ArrayBuffer>, options?: SpectrumMappingOptionsMapping options for AudioAnalyser.getSpectrumMel and AudioAnalyser.getSpectrumLog.): Uint8Array<ArrayBuffer>
Log-scaled spectrum, byte domain (0..255). Output length = bands. Bins are spaced so each output covers an equal fraction of the log2(fMax / fMin) octave range - useful when you want a frequency-axis visualization where each octave gets the same width.
getSpectrumLogFloat(into?: Float32Array<ArrayBuffer>, options?: SpectrumMappingOptionsMapping options for AudioAnalyser.getSpectrumMel and AudioAnalyser.getSpectrumLog.): Float32Array<ArrayBuffer>
Log-scaled spectrum, float domain (dBFS values). Output length = bands.
getSpectrumMel(into?: Uint8Array<ArrayBuffer>, options?: SpectrumMappingOptionsMapping options for AudioAnalyser.getSpectrumMel and AudioAnalyser.getSpectrumLog.): Uint8Array<ArrayBuffer>
Mel-scaled spectrum, byte domain (0..255). Output length = bands. Each output bin is a triangular-weighted sum of the linear FFT bins underneath it, mel-spaced from fMin to fMax.
getSpectrumMelFloat(into?: Float32Array<ArrayBuffer>, options?: SpectrumMappingOptionsMapping options for AudioAnalyser.getSpectrumMel and AudioAnalyser.getSpectrumLog.): Float32Array<ArrayBuffer>
Mel-scaled spectrum, float domain (dBFS values). Output length = bands.
getWaveform(into?: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>
Fill and return the byte time-domain waveform (0..255 per sample).
getWaveformFloat(into?: Float32Array<ArrayBuffer>): Float32Array<ArrayBuffer>
Fill and return the float time-domain waveform (-1..1 per sample).
Properties6
fftSize: number
frequencyBinCount: number
Number of frequency bins available - half of fftSize.
maxDecibels: number
minDecibels: number
smoothingTimeConstant: number
The currently tapped audio source, or null if none is set. Assigning a new value disconnects the previous tap and connects the new source as a parallel branch without affecting the source's main routing.
Source