Models

Voice activity detection

snakers4/silero-vad

Model ID
snakers4/silero-vad
Type
Voice activity detection

Use this model

Detect speech in a web app

Install the browser SDK:

npm install @wfloat/wfloat-web

Load the model and detect speech regions in an audio file:

import { loadVadModel } from "@wfloat/wfloat-web";
const vad = await loadVadModel("snakers4/silero-vad");
const file = document.querySelector<HTMLInputElement>("#audio-file")?.files?.[0];
if (!file) throw new Error("Choose an audio file first.");
const result = await vad.detect({ audio: file });
for (const segment of result.segments) {
console.log(segment.startSec, segment.endSec);
}

For live detection, use vad.createSession({ onSpeechStart, onSpeechEnd }), then call session.startMicrophone() and session.stopMicrophone().