Skip to main content

Lightweight wrapper for Silero VAD using internal ONNX Runtime and with no python package dependencies

Project description

Silero VAD Lite

ATTENTION: Not ready for public use yet.

Silero VAD Lite is a lightweight Python wrapper for the Silero Voice Activity Detection (VAD) model using ONNX Runtime. This package provides a simple interface to use the Silero VAD model without the need for the full ONNX Runtime Python package.

For more information, you can visit the original Silero VAD repository.

Installation

You can install Silero VAD Lite using pip:

pip install silero-vad-lite

Note: This package requires CMake and a C++ compiler to be installed on your system.

Usage

Here's a simple example of how to use Silero VAD Lite:

from silero_vad_lite import SileroVAD
import numpy as np

# Initialize the SileroVAD object with the path to your ONNX model
vad = SileroVAD("path/to/silero_vad.onnx")

# Generate some dummy audio data (replace this with your actual audio data)
sample_rate = 16000
duration = 1  # 1 second
t = np.linspace(0, duration, int(sample_rate * duration), False)
audio_data = np.sin(2 * np.pi * 440 * t).astype(np.float32)

# Process the audio data
result = vad.process(audio_data, sample_rate)

print(f"Voice activity detection result: {result}")

The process method returns a float value between 0 and 1, indicating the probability of voice activity in the given audio segment.

Building from Source

To build Silero VAD Lite from source:

  1. Clone the repository:

    git clone https://github.com/yourusername/silero-vad-lite.git
    cd silero-vad-lite
    
  2. Install the package in editable mode:

    pip install -e .
    

This will compile the C++ extension and install the package.

Running Tests

To run the tests, first install pytest:

pip install pytest

Then, from the root directory of the project, run:

pytest

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Silero Team for the original Silero VAD model
  • ONNX Runtime team for the C++ API

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

silero_vad_lite-0.1.0.tar.gz (2.0 MB view details)

Uploaded Source

File details

Details for the file silero_vad_lite-0.1.0.tar.gz.

File metadata

  • Download URL: silero_vad_lite-0.1.0.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for silero_vad_lite-0.1.0.tar.gz
Algorithm Hash digest
SHA256 232217b3818a1bd541958ac6c00b01736fb3cf142216251e44011777b2cd2c36
MD5 f9a7ce049c97589e17b9acc9359c06b9
BLAKE2b-256 5f139831c2f15be0093b7966112e5b8e84671a8e95b36f7eacf085441bab5f3e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page