npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

realtime-vad

v1.0.0

Published

A realtime voice activity detection library

Readme

Realtime VAD

Realtime VAD is a realtime voice activity detection library for Node.js environments. It utilizes the Silero VAD and onnxruntime-node libraries to perform efficient speech detection.

Quickstart

Below is an example demonstrating how to use the library:

import { VoiceActivityDetector } from "realtime-vad";
import record from "node-record-lpcm16";

const SAMPLE_RATE = 16000;
const CHANNELS = 1;

async function main() {
  const vad = new VoiceActivityDetector({
    sampleRate: SAMPLE_RATE,
    channels: CHANNELS,
    frameDurationMs: 30,
    speechThreshold: 0.5,
    silenceDebounceMs: 600,
  });

  // Load the model
  await vad.init();

  // Listen to speech events
  vad.on("speechStart", (startTime) => {
    console.log("Speech start detected at", startTime);
  });

  vad.on("speechEnd", ({ start, end, duration }) => {
    console.log("Speech detected from", start, "to", end, "for", duration, "ms");
  });

  // Start recording from microphone
  const recording = record.record({
    sampleRate: SAMPLE_RATE,
    channels: CHANNELS,
    threshold: 0,
    audioType: "wav",
  });
  const micStream = recording.stream();

  let audioBuffer = Buffer.alloc(0);

  micStream.on("data", async (data) => {
    audioBuffer = Buffer.concat([audioBuffer, data]);
    while (audioBuffer.length >= vad.chunkBytes) {
      const frame = audioBuffer.subarray(0, vad.chunkBytes);
      audioBuffer = audioBuffer.subarray(vad.chunkBytes);
      await vad.processAudioChunk(frame);
    }
  });

  micStream.on("error", (err) => {
    console.error("Error with microphone stream:", err);
  });

  console.log("Listening for speech... Press CTRL+C to stop.");
}

main();

Installation

  1. Clone the repository

    git clone https://github.com/ThEditor/realtime-vad.git
    cd realtime-vad
  2. Install dependencies

    pnpm install
  3. Build the project

    pnpm build

Background

This project started as an extension of ricky0123/vad-node to add real-time voice activity detection in Node.js (You can checkout the archived repository here).

As of October 2024, @ricky0123 has dropped support for ricky0123/vad-node in order to focus on ricky0123/vad-web. Following this change and inspired from @ricky0123, I've created this as a standalone voice activity detection library.

License

This project is licensed under the MIT License.

References

[1] Silero Team. (2021). Silero VAD: pre-trained enterprise-grade Voice Activity Detector (VAD), Number Detector and Language Classifier. GitHub, GitHub repository, https://github.com/snakers4/silero-vad, [email protected].