AnalyserAn audio analyser effector that can be attached in the DSP graph to read waveform (time-domain) and frequency (spectrum) data using the Web Audio API's AnalyserNode.
It exposes pre-allocated typed-array buffers (Float32 and Uint8 variants) and provides helper methods to fill and return those buffers.
import { Analyser } from "@fluex/fluexgl-dsp";
const analyser = new Analyser({
fftSize: 2048,
smoothingTimeConstant: 0.85,
minDecibels: -90,
maxDecibels: -10
});
await analyser.InitializeOnAttachment(audioContext);
const waveform = analyser.GetWaveformFloatData();
const spectrum = analyser.GetFrequencyByteData();
new Analyser(options?: Partial<AnalyserOptions>): Analyser;
label: string | nullname: stringanalyserNode: AnalyserNode | nullwaveformFloat32ArrayBuffer: Float32ArraywaveformUint8ArrayBuffer: Uint8ArrayfrequencyFloat32ArrayBuffer: Float32ArrayfrequencyUint8ArrayBuffer: Uint8ArrayInitializeOnAttachment(context: AudioContext): Promise<void>SetOptions(options: Partial<AnalyserOptions>): voidGetWaveformFloatData(): Float32Array | nullGetWaveformByteData(): Uint8Array | nullGetFrequencyFloatData(): Float32Array | nullGetFrequencyByteData(): Uint8Array | null