Skip to main content

Function: useWaveform()

function useWaveform(source, options?): WaveformState;

Defined in: useWaveform.ts:153

Analyzes source and keeps the result. The analysis runs once per source and analysis options; barCount, metric, normalize and view only resample the stored peaks. A running analysis is cancelled when the source changes or the component unmounts, and results of a previous source are never returned for a new one.

Parameters​

ParameterType
sourceAudioSource | null | undefined
options?UseWaveformOptions

Returns​

WaveformState

Example​

const { bars } = useWaveform(url, { ...waveformPresets.chat, barCount: 40 });