is vad available in node.js. as i am encountering ...
# ask-ai
l
is vad available in node.js. as i am encountering Error: runner initialization timed out and sometimes silero_vad.onnx is not found in the file. can you provide the correct format to integrate vad in node.js?
t
Thanks for reaching out, Computer. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Voice Activity Detection (VAD) is available in Node.js through the
@livekit/agents-plugin-silero
plugin. I understand the errors you mentioned, like "runner initialization timed out" and "silero_vad.onnx not found," can be frustrating. These usually happen when the model file hasn’t downloaded correctly or the VAD hasn’t been prewarmed. Let me guide you through the steps to integrate VAD in Node.js smoothly: 1. Install the Plugin:
pnpm install @livekit/agents-plugin-silero
2. Download Model Weights: Make sure your
package.json
includes a
download
script. Then run:
pnpm run download
This will download
silero_vad.onnx
and place it in your project’s
dist
directory during the build process. 3. Initialize VAD with Prewarming: It’s important to use the
prewarm
function to load the VAD model before running any jobs, which helps avoid those timeout issues:
Copy code
import * as silero from '@livekit/agents-plugin-silero';
import { defineAgent } from '@livekit/agents';

export default defineAgent({
  prewarm: async (proc) => {
    proc.userData.vad = await silero.VAD.load();
  },
  entry: async (ctx) => {
    const vad = ctx.proc.userData.vad as silero.VAD;
    const session = new voice.AgentSession({ vad, /* other settings */ });
    // ...
  },
});
4. Configuration Options: You have the flexibility to customize
VAD.load()
with parameters like
minSpeechDuration
,
minSilenceDuration
,
sampleRate
, and
forceCPU
to better fit your needs. Troubleshooting tips: • "Runner initialization timed out": This usually means the VAD model wasn’t prewarmed. Make sure to prewarm it to prevent delays during runtime. • "silero_vad.onnx not found": Double-check that you’ve run
pnpm run download
and that the file is present in the
dist
directory after building. If you’d like to dive deeper, feel free to explore the Silero VAD plugin documentation. I’m here if you need any more help! Sources: Docs::Agents | examples/src/realtime_turn_detector.ts | Docs::Agents