Skip to content

TEN-framework/ten-vad

Repository files navigation

Image

TEN Releases Release Date Discussion posts Commits Issues closed PRs Welcome HuggingFace TEN VAD GitHub license Ask DeepWiki

TEN-framework%2Ften-vad | Trendshift


Latest News 🔥

  • [2025/11] We supported Python inference with ONNX model on Linux, macOS thanks to Guy Nicholson!
  • [2025/11] We supported Golang on Linux, macOS and Windows with usage of the prebuilt-libs thanks to hylarucoder!
  • [2025/11] We supported Java on Linux, macOS, Windows, Android with usage of the prebuilt-libs thanks to ZhangYang(arthasking123)!
  • [2025/07] 🎉 Exciting news! TEN VAD is now integrated into k2-fsa/sherpa-onnx, thanks to the fantastic work by Fangjun Kuang! You can now achieve more precise speech segment extraction and enjoy an enhanced ASR experience! Refer to the documentation and give it a try!
  • [2025/07] We supported Python inference on macOS and Windows with usage of the prebuilt-libs!
  • [2025/06] We finally released and open-sourced the ONNX model and the corresponding preprocessing code! Now you can deploy TEN VAD on any platform and any hardware architecture!
  • [2025/06] We are excited to announce the release of WASM+JS for Web WASM Support.

Table of Contents


Welcome to TEN

TEN is an open-source framework for conversational voice AI agents.

TEN Ecosystem includes TEN Framework, Agent Examples, VAD, Turn Detection and Portal.


Community Channel Purpose
Follow on X Follow TEN Framework on X for updates and announcements
Follow on LinkedIn Follow TEN Framework on LinkedIn for updates and announcements
Discord TEN Community Join our Discord community to connect with developers
Hugging Face Space Join our Hugging Face community to explore our spaces and models
WeChat Join our WeChat group for Chinese community discussions

Important

Star TEN Repositories ⭐️

Get instant notifications for new releases and updates. Your support helps us grow and improve TEN!


TEN star us gif


TEN Hugging Face Space

huggingface-demo.mp4

You are more than welcome to Visit TEN Hugging Face Space to try VAD and Turn Detection together.


Introduction

TEN VAD is a real-time voice activity detection system designed for enterprise use, providing accurate frame-level speech activity detection. It shows superior precision compared to both WebRTC VAD and Silero VAD, which are commonly used in the industry. Additionally, TEN VAD offers lower computational complexity and reduced memory usage compared to Silero VAD. Meanwhile, the architecture's temporal efficiency enables rapid voice activity detection, significantly reducing end-to-end response and turn detection latency in conversational AI systems.


Key Features

1. High-Performance:

The precision-recall curves comparing the performance of WebRTC VAD (pitch-based), Silero VAD, and TEN VAD are shown below. The evaluation is conducted on the precisely manually annotated testset. The audio files are from librispeech, gigaspeech, DNS Challenge etc. As demonstrated, TEN VAD achieves the best performance. Additionally, cross-validation experiments conducted on large internal real-world datasets demonstrate the reproducibility of these findings. The testset with annotated labels is released in directory "testset" of this repository.


PR Curves Performance Comparison

Note that the default threshold of 0.5 is used to generate binary speech indicators (0 for non-speech signal, 1 for speech signal). This threshold needs to be tuned according to your domain-specific task.

1.1 Performance Comparison

Developers can reproduce the performance comparison PR curves for TEN VAD and Silero VAD on the open-source testset (as shown in the figure above) by executing the following script on Linux x64 with a simply one line of code. The output figure will be saved in the same directory as the script.

cd ./examples
python plot_pr_curves.py

2. Agent-Friendly:

As illustrated in the figure below, TEN VAD rapidly detects speech-to-non-speech transitions, whereas Silero VAD suffers from a delay of several hundred milliseconds, resulting in increased end-to-end latency in human-agent interaction systems. In addition, as demonstrated in the 6.5s-7.0s audio segment, Silero VAD fails to identify short silent durations between adjacent speech segments.

Agent-Friendly Response

3. Lightweight:

We evaluated the RTF (Real-Time Factor) across five distinct platforms, each equipped with varying CPUs. TEN VAD demonstrates much lower computational complexity and smaller library size than Silero VAD.

Platform CPU RTF Lib Size
TEN VAD Silero VAD TEN VAD Silero VAD
Linux AMD Ryzen 9 5900X 12-Core 0.0150 / 306KB 2.16MB(JIT) / 2.22MB(ONNX)
Intel(R) Xeon(R) Platinum 8253 0.0136
Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz 0.0086 0.0127
Windows Intel i7-10710U 0.0150 / 464KB(x86) / 508KB(x64)
macOS M1 0.0160 731KB
Web macOS(M1) 0.010 277KB
Android Galaxy J6+ (32bit, 425) 0.0570 373KB(v7a) / 532KB(v8a)
Oppo A3s (450) 0.0490
iOS iPhone6 (A8) 0.0210 320KB
iPhone8 (A11) 0.0050

4. Multiple Programming Languages and Platforms:

TEN VAD provides cross-platform C compatibility across five operating systems (Linux x64, Windows, macOS, Android, iOS), with Python bindings optimized for Linux x64, with wasm for Web.

5. Supported Sampling Rate and Hop Size:

TEN VAD operates on 16kHz audio input with configurable hop sizes (optimized frame configurations: 160/256 samples=10/16ms). Other sampling rates must be resampled to 16kHz.

Developers Testimonial

"We selected TEN VAD because it provides faster and more accurate sentence-end detection in Japanese compared to other VADs, while still being lightweight and fast enough for live use." - LiveCap,Hakase shojo.

"TEN VAD's overall performance is better than Silero VAD. Its high accuracy and low resource consumption helped us improve efficiency and significantly reduce costs." - Rustpbx.


Installation

git clone https://github.com/TEN-framework/ten-vad.git

Quick Start

The project supports five major platforms with dynamic library linking.

Platform Dynamic Lib Supported Arch Interface Language Header Comment
Linux libten_vad.so x64 Python, C, Java, Go ten_vad.h
ten_vad.py
ten_vad.js
TenVad.java
Windows ten_vad.dll x64, x86 C, Java, Go
macOS ten_vad.framework arm64, x86_64 C, Java, Go
Web ten_vad.wasm / JS
Android libten_vad.so arm64-v8a, armeabi-v7a C, Java
iOS ten_vad.framework arm64 C 1. not simulator
2. not iPad

Python Usage

1. Linux / macOS / Windows

Requirements

  • numpy (Version 1.17.4/1.26.4 verified)

  • scipy (Version >= 1.5.0)

  • scikit-learn (Version 1.2.2/1.5.0 verified, for plotting PR curves)

  • matplotlib (Version 3.1.3/3.10.0 verified, for plotting PR curves)

  • torchaudio (Version 2.2.2 verified, for plotting PR curves)

  • Python version 3.8.19/3.10.14 verified

Note: You could use other versions of above packages, but we didn't test other versions.


The lib only depend on numpy, you have to install the dependency via requirements.txt:

pip install -r requirements.txt

For running demo or plotting PR curves, you have to install the dependencies:

pip install -r ./examples/requirements.txt

Note that if you did not install libc++1 (Linux), you have to run the code below to install it:

sudo apt update
sudo apt install libc++1

Usage (Prebuilt-libs)

Note: For usage in python, you can either use it by git clone or pip.

By using git clone:
  1. Clone the repository
git clone https://github.com/TEN-framework/ten-vad.git
  1. Enter examples directory
cd ./examples
  1. Test
python test.py s0724-s0730.wav out.txt

By using pip:
  1. Install via pip
pip install -U --force-reinstall -v git+https://github.com/TEN-framework/ten-vad.git
  1. Write your own use cases and import the class, the attributes of class TenVAD you can refer to ten_vad.py
from ten_vad import TenVad

Usage (ONNX model)

You have to download the onnxruntime packages from the microsoft official onnxruntime github website. Note that the version of onnxruntime must be higher than or equal to 1.17.1 (e.g. onnxruntime-linux-x64-1.17.1.tgz).

You can check the official ONNX Runtime releases from this website. And for example, to download version 1.17.1 (Linux x64), use this link. After extracting the compressed file, you'll find two important directories:include/ - header files, lib/ - library files

1) cd examples_onnx/python
2) ./build-and-deploy-linux.sh --ort-path /absolute/path/to/your/onnxruntime/root/dir # For Linux. If macOS, run build-and-deploy-macos.sh instead.

Note 1: If executing the onnx demo from a different directory than the one used when running build-and-deploy-linux.sh, ensure to create a symbolic link to src/onnx_model/ to prevent ONNX model file loading failures.
Note 2: The ONNX model locates in src/onnx_model directory.
Note 3: For macOS, run build-and-deploy-macos.sh instead.


JS Usage

1. Web

Requirements
  • Node.js (macOS v14.18.2, Linux v16.20.2 verified)
  • Terminal
Usage
1) cd ./examples
2) node test_node.js s0724-s0730.wav out.txt

Java Usage

TEN VAD provides comprehensive Java support with JNI (Java Native Interface) bindings for all major platforms.

Requirements

  • Java 8 or higher
  • Native libraries in lib/ directory
  • JNI headers

Compilation

# Compile Java source, note if JNA library is not installed, you should download it first. For example, you can download JNA library and include it here. You can also export it to the CLASSPATH environment variables
wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.13.0/jna-5.13.0.jar # I just picked a random version
javac -encoding UTF-8 -cp jna-5.13.0.jar -d . include/TenVad.java examples/TestTenVad.java

# Run example in the project root directory
java -cp .:jna-5.13.0.jar TestTenVad examples/s0724-s0730.wav examples/out.txt

# Run example in the examples directory
java -cp ..:../jna-5.13.0.jar TestTenVad s0724-s0730.wav out.txt

Example Code

import com.ten.vad.TenVad;

public class VADExample {
    public static void main(String[] args) {
        // Create VAD instance
        TenVad vad = new TenVad(256, 0.5f);
        
        // Process audio frame
        short[] audioFrame = new short[256]; // 16ms at 16kHz
        // ... fill audioFrame with audio data ...
        
        TenVad.VadResult result = vad.process(audioFrame);
        System.out.println("Probability: " + result.getProbability());
        System.out.println("Voice detected: " + result.isVoiceDetected());
        
        // Clean up
        vad.destroy();
    }
}

Platform-Specific Notes

  • Linux: Requires libc++1 package
  • Windows: Ensure Visual C++ Redistributable is installed
  • macOS: No additional requirements
  • Android: Use Android NDK for native library integration

API Reference

public class TenVad {
    // Constructor
    public TenVad(int hopSize, float threshold)
    
    // Process audio frame
    public VadResult process(short[] audioData)
    
    // Get library version
    public static String getVersion()
    
    // Cleanup
    public void destroy()
}

public static class VadResult {
    public float getProbability()    // [0.0, 1.0]
    public int getFlag()            // 0 or 1
    public boolean isVoiceDetected() // true if voice detected
}

Go (Golang) Usage

TEN VAD provides Golang support for Linux, macOS and Windows.

Usage with compilation

cd examples/go-tenvad
go build -o tenvad .
./tenvad

Usage without compilation

cd examples/go-tenvad
export LD_LIBRARY_PATH=../../lib/Linux/x64:$LD_LIBRARY_PATH # For Windows and macOS, export the corresponding lib path instead
go run .

C Usage

Build Scripts

Located in examples/ directory or examples_onnx/ (for ONNX usage on Linux):

  • Linux: build-and-deploy-linux.sh
  • Windows: build-and-deploy-windows.bat
  • macOS: build-and-deploy-mac.sh
  • Android: build-and-deploy-android.sh
  • iOS: build-and-deploy-ios.sh

Dynamic Library Configuration

Runtime library path configuration:

  • Linux/Android: LD_LIBRARY_PATH
  • macOS: DYLD_FRAMEWORK_PATH
  • Windows: DLL in executable directory or system PATH

Customization

  • Modify platform-specific build scripts
  • Adjust CMakeLists.txt
  • Configure toolchain and architecture settings

Overview of Usage

  • Navigate to examples/ or examples_onnx/ (for ONNX usage on Linux)
  • Execute platform-specific build script
  • Configure dynamic library path
  • Run demo with sample audio s0724-s0730.wav
  • Processed results saved to out.txt

The detailed usage methods of each platform are as follows

1. Linux

Requirements
  • Clang (e.g. 6.0.0-1ubuntu2 verified)
  • CMake
  • Terminal

Note that if you did not install libc++1, you have to run the code below to install it:

sudo apt update
sudo apt install libc++1
Usage (prebuilt-lib)
1) cd ./examples
2) ./build-and-deploy-linux.sh
Usage (ONNX)

You have to download the onnxruntime packages from the microsoft official onnxruntime github website. Note that the version of onnxruntime must be higher than or equal to 1.17.1 (e.g. onnxruntime-linux-x64-1.17.1.tgz).

You can check the official ONNX Runtime releases from this website. And for example, to download version 1.17.1 (Linux x64), use this link. After extracting the compressed file, you'll find two important directories:include/ - header files, lib/ - library files

1) cd examples_onnx
2) ./build-and-deploy-linux.sh --ort-path /absolute/path/to/your/onnxruntime/root/dir

Note 1: If executing the onnx demo from a different directory than the one used when running build-and-deploy-linux.sh, ensure to create a symbolic link to src/onnx_model/ to prevent ONNX model file loading failures.
Note 2: The ONNX model locates in src/onnx_model directory.
Note 3: For ONNX example builds see examples_onnx/README.md.


2. Windows

Requirements
  • Visual Studio (2017, 2019, 2022 verified)
  • CMake (3.26.0-rc6 verified)
  • Terminal (MINGW64 or powershell)
Usage
1) cd ./examples
2) Configure "build-and-deploy-windows.bat" with your preferred:
    - Architecture (default: x64)
    - Visual Studio version (default: 2019)
3) ./build-and-deploy-windows.bat

3. macOS

Requirements
  • Xcode (15.2 verified)
  • CMake (3.19.2 verified)
Usage
1) cd ./examples
2) Configure "build-and-deploy-mac.sh" with your target architecture:
  - Default: arm64 (Apple Silicon)
  - Alternative: x86_64 (Intel)
3) ./build-and-deploy-mac.sh

4. Android

Requirements
  • NDK (r25b, macOS verified)
  • CMake (3.19.2, macOS verified)
  • adb (1.0.41, macOS verified)
Usage
1) cd ./examples
2) export ANDROID_NDK=/path/to/android-ndk  # Replace it with your NDK installation path
3) Configure "build-and-deploy-android.sh" with your build settings:
  - Architecture: arm64-v8a (default) or armeabi-v7a
  - Toolchain: aarch64-linux-android-clang (default) or custom NDK toolchain
4) ./build-and-deploy-android.sh

5. iOS

Requirements

Xcode (15.2, macOS verified) CMake (3.19.2, macOS verified)

Usage
  1. Enter examples directory
cd ./examples
  1. Creates Xcode project files for iOS build
./build-and-deploy-ios.sh
  1. Follow the steps below to build and test on iOS device:

    3.1. Use Xcode to open .xcodeproj files: a) cd ./build-ios, b) open ./ten_vad_demo.xcodeproj

    3.2. In Xcode IDE, select ten_vad_demo target (should check: Edit Scheme → Run → Release), then select your iOS Device (not simulator).

    iOS Setup Image 1

    3.3. Drag ten_vad/lib/iOS/ten_vad.framework to "Frameworks, Libraries, and Embedded Content"

    • (in TARGETS → ten_vad_demo → ten_vad_demo → General, should set Embed to "Embed & Sign").

    • or add it directly in this way: "Frameworks, Libraries, and Embedded Content" → "+" → Add Other... → Add Files →...

    • Note: If this step is not completed, you may encounter the following runtime error: "dyld: Library not loaded: @rpath/ten_vad.framework/ten_vad".

    iOS Setup Image 2

    3.4. Configure iOS device Signature

    • in TARGETS → ten_vad_demo → Signing & Capabilities → Signing

      • Modify Bundle Identifier: modify "com.yourcompany" to yours;

      • Specify Provisioning Profile

    • In TARGETS → ten_vad_demo → Build Settings → Signing → Code Signing Identity:

      • Specify your Certification

        3.5. Build in Xcode and run demo on your device.


TEN Ecosystem

Project Preview
️TEN Framework
Open-source framework for conversational AI Agents.

TEN VAD
Low-latency, lightweight and high-performance streaming voice activity detector (VAD).

️ TEN Turn Detection
TEN Turn Detection enables full-duplex dialogue communication.

TEN Agent Examples
Usecases powered by TEN.

TEN Portal
The official site of the TEN Framework with documentation and a blog.


Ask Questions

TEN VAD is available on these AI-powered Q&A platforms. They can help you find answers quickly and accurately in multiple languages, covering everything from basic setup to advanced implementation details.

Service Link
DeepWiki Ask DeepWiki
ReadmeX ReadmeX

Citations

@misc{TEN VAD,
  author = {TEN Team},
  title = {TEN VAD: A Low-Latency, Lightweight and High-Performance Streaming Voice Activity Detector (VAD)},
  year = {2025},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {https://github.com/TEN-framework/ten-vad.git},
  email = {[email protected]}
}

License

This project is licensed under Apache 2.0 with certain conditions. Refer to the "LICENSE" file in the root directory for detailed information. Note that pitch_est.cc contains modified code derived from LPCNet, which is BSD-2-Clause and BSD-3-Clause licensed, refer to the NOTICES file in the root directory for detailed information.