Skip to content

About

VAD for webspaces

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Webspace VAD

The Webspaces voice activity detector as a small browser and PCM package. It runs a modified RNNoise model on 10 ms frames and reports speech probability, speaking state, and frame timestamps.

PcmVad timestamps are relative to the first input sample. WebAudioVad timestamps use the associated AudioContext timeline.

Quick start

npm install
npm run dev

Open the printed URL, start the microphone, and speak. Processing happens locally in an AudioWorklet.

Web Audio API

import { WebAudioVad } from "webspace-vad";

const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
const context = new AudioContext();
const source = context.createMediaStreamSource(stream);
const vad = await WebAudioVad.create(context, source);

vad.addEventListener("frame", event => {
  console.log(event.detail.probability, event.detail.speaking);
});

By default this preserves the Webspaces VAD signal conditioning: gain 3, followed by a compressor at -12 dB, ratio 20, 5 ms attack, and 50 ms release. Set conditionAudio: false to feed the source directly into RNNoise. The detector resamples AudioContext rates such as 44.1 kHz to RNNoise's required 48 kHz rate.

PCM API

import { PcmVad } from "webspace-vad";

const vad = await PcmVad.create({ inputSampleRate: 16000 });
const frames = vad.push(monoFloat32Samples);
for (const frame of frames) {
  console.log(frame.timestamp, frame.probability, frame.speaking);
}

Input is mono normalized floating-point PCM. Chunks may have any length. The default speaking threshold is 0.7, matching Webspaces. Each result describes the center of one 480-sample, 48 kHz frame.

Licensing

The original package code is Apache-2.0 and no MPL-2.0 code is included. The bundled RNNoise-derived WASM retains BSD-3-Clause terms; Greg Fodor's modifications to it are Apache-2.0. The generated Emscripten loader retains MIT OR NCSA terms. These are permissive licenses and their complete notices ship with the package. See PROVENANCE.md for the audit trail.

This provenance review is not legal advice. It assumes Greg Fodor owns the identified first-party contributions and has authority to offer them under Apache-2.0.

About

VAD for webspaces

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages