feat: add Silero VAD toggle to audio pipeline

Integrates @ricky0123/vad-web's MicVAD as an optional voice activity detector
alongside the noise gate. When enabled, the Silero ONNX model classifies each
audio frame as speech or silence; silence frames mute the worklet's output via
a new VAD gate message. VAD is wired into Publisher.ts alongside the existing
noise gate transformer. Vite is configured to copy the worklet bundle, ONNX
model, and ORT WASM files to /vad/ so they're reachable at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mk
2026-03-23 23:29:43 -03:00
parent 0788e56c51
commit 428b76db25
9 changed files with 386 additions and 6 deletions

View File

@@ -119,6 +119,11 @@ export class NoiseGateTransformer implements AudioTrackProcessor {
this.sendParams();
}
/** Tell the worklet to open or close the VAD-controlled gate. */
public setVADOpen(open: boolean): void {
this.workletNode?.port.postMessage({ type: "vad-gate", open });
}
private sendParams(): void {
if (!this.workletNode) return;
log.debug("sendParams:", this.params);