ricky0123 / vad

Voice activity detector (VAD) for the browser with a simple API

Home Page:https://www.vad.ricky0123.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Voice Activity Detection for Javascript

npm vad-web npm vad-node npm vad-react

Run callbacks on segments of user speech in a few lines of code

This package aims to provide an accurate, user-friendly voice activity detector (VAD) that runs in the browser. It also has limited support for node. By using this package, you can prompt the user for microphone permissions, start recording audio, send segments of audio with speech to your server for processing, or show a certain animation or indicator when the user is speaking.

  • See a live demo
  • Join us on Discord!
  • Browse or contribute to documentation
  • If you would like to contribute, I have started writing some documentation on how to get started hacking on these packages here. If you have any questions, you can open an issue here or leave a message on Discord.

Under the hood, these packages run Silero VAD [1] using ONNX Runtime Web / ONNX Runtime Node.js. Thanks a lot to those folks for making this possible.

Sponsorship

Please contribute to the project financially - especially if your commercial product relies on this package. Become a Sponsor

Quick Start

To use the VAD via a script tag in the browser, include the following script tags:

<script src="https://cdn.jsdelivr.net/npm/onnxruntime-web@1.14.0/dist/ort.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.7/dist/bundle.min.js"></script>
<script>
  async function main() {
    const myvad = await vad.MicVAD.new({
      onSpeechStart: () => {
        console.log("Speech start detected")
      },
      onSpeechEnd: (audio) => {
        // do something with `audio` (Float32Array of audio samples at sample rate 16000)...
      }
    })
    myvad.start()
  }
  main()
</script>

Documentation for bundling the voice activity detector for the browser or using it in node or React projects can be found on vad.ricky0123.com.

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, hello@silero.ai.

About

Voice activity detector (VAD) for the browser with a simple API

https://www.vad.ricky0123.com

License:Other


Languages

Language:TypeScript 49.1%Language:JavaScript 33.7%Language:HTML 14.0%Language:Shell 3.2%