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

@@ -14,6 +14,7 @@ import {
} from "vite";
import svgrPlugin from "vite-plugin-svgr";
import { createHtmlPlugin } from "vite-plugin-html";
import { viteStaticCopy } from "vite-plugin-static-copy";
import { codecovVitePlugin } from "@codecov/vite-plugin";
import { sentryVitePlugin } from "@sentry/vite-plugin";
@@ -35,6 +36,22 @@ export default ({
// build time.
process.env.VITE_PACKAGE = packageType ?? "full";
const plugins: PluginOption[] = [
viteStaticCopy({
targets: [
{
src: "node_modules/@ricky0123/vad-web/dist/vad.worklet.bundle.min.js",
dest: "vad",
},
{
src: "node_modules/@ricky0123/vad-web/dist/silero_vad_legacy.onnx",
dest: "vad",
},
{
src: "node_modules/onnxruntime-web/dist/*.wasm",
dest: "vad",
},
],
}),
react(),
svgrPlugin({
svgrOptions: {