Skip to content

isSilent

Detects whether an audio buffer contains silence.

function isSilent(samples, threshold?): boolean;

Defined in: src/utils/audio.ts:428

Detects whether an audio buffer contains silence.

Parameters

ParameterTypeDefault valueDescription
samplesFloat32ArrayundefinedThe audio samples as a Float32Array (normalized to [-1.0, 1.0]).
thresholdnumber0.01The RMS threshold below which audio is considered silent.

Returns

boolean

true if the RMS volume is below the threshold, false otherwise.

Remarks

Computes the RMS volume via calculateRMS and compares it against the given threshold. Useful for detecting end-of-speech or filtering out background noise.

Default Value

threshold: 0.01

Example

if (isSilent(audioBuffer, 0.02)) {
  console.log('Silence detected -- end of speech?');
}

See

calculateRMS

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency