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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user