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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ten-vad-lib

v1.0.0

Published

A JavaScript library for Ten VAD (Voice Activity Detection) based on WebAssembly

Readme

Ten VAD Library

A JavaScript library for Ten VAD (Voice Activity Detection) based on WebAssembly.

Installation

npm install ten-vad-lib

Usage

Basic Usage

import { NonRealTimeTenVAD } from 'ten-vad-lib';

async function processAudio() {
  const vad = await NonRealTimeTenVAD.new({
    hopSize: 256,
    voiceThreshold: 0.5,
    minSpeechDuration: 100,
    wasmPath: '/path/to/ten_vad.wasm',
    jsPath: '/path/to/ten_vad.js'
  });

  const audioData = new Float32Array(/* your audio data */);
  const sampleRate = 16000;

  const result = await vad.process(audioData, sampleRate);
  
  console.log('Speech segments:', result.speechSegments);
  console.log('Statistics:', result.statistics);
}

Streaming Usage

import { NonRealTimeTenVAD } from 'ten-vad-lib';

async function streamProcess() {
  const vad = await NonRealTimeTenVAD.new();
  const audioData = new Float32Array(/* your audio data */);
  
  for await (const segment of vad.run(audioData, 16000)) {
    console.log('Speech segment:', segment);
  }
}

WASM File Handling

The library includes WASM files that need to be accessible at runtime. Here are the supported scenarios:

1. NPM Package Usage (Recommended)

When using as an npm package, the WASM files are automatically included:

import { NonRealTimeTenVAD } from 'ten-vad-lib';

const vad = await NonRealTimeTenVAD.new();

The library will automatically detect the correct paths for WASM files.

2. CDN Usage

If you're serving the library from a CDN, specify the WASM paths:

const vad = await NonRealTimeTenVAD.new({
  wasmPath: 'https://your-cdn.com/ten-vad-lib/wasm/ten_vad.wasm',
  jsPath: 'https://your-cdn.com/ten-vad-lib/wasm/ten_vad.js'
});

3. Local Development

For local development, place the WASM files in your public directory:

const vad = await NonRealTimeTenVAD.new({
  wasmPath: '/wasm/ten_vad.wasm',
  jsPath: '/wasm/ten_vad.js'
});

4. Custom Build

If you're building a custom version, copy the WASM files to your build output:

cp node_modules/ten-vad-lib/wasm/* public/wasm/

API Reference

NonRealTimeTenVAD

Constructor Options

interface TenVADOptions {
  hopSize?: number;              // Default: 256
  voiceThreshold?: number;       // Default: 0.5
  wasmPath?: string;            // Path to WASM file
  jsPath?: string;              // Path to JS file
  minSpeechDuration?: number;   // Default: 100ms
  maxSilenceDuration?: number;  // Default: 500ms
}

Methods

  • static new(options?: TenVADOptions): Promise<NonRealTimeTenVAD>
  • process(audio: Float32Array, sampleRate: number): Promise<TenVADResult>
  • run(audio: Float32Array, sampleRate: number): AsyncGenerator<TenVADSpeechData>

TenVADResult

interface TenVADResult {
  speechSegments: TenVADSpeechData[];
  statistics: {
    totalFrames: number;
    voiceFrames: number;
    voicePercentage: number;
    processingTime: number;
    realTimeFactor: number;
  };
}

TenVADSpeechData

interface TenVADSpeechData {
  audio: Float32Array;
  start: number;        // Start time in milliseconds
  end: number;          // End time in milliseconds
  probability: number;  // Voice probability (0-1)
}

Browser Support

  • Chrome 57+
  • Firefox 52+
  • Safari 11+
  • Edge 79+

License

MIT