A light-weight, streaming speech activity detection (SAD) module, designed for real-time speech-only classification
Project description
streamsad
streamsad is a streaming-oriented Speech Activity Detection (SAD) module that operates frame by frame, without requiring access to the full audio signal (unlike batch processing). Unlike simple energy-based Voice Activity Detection (VAD), it accurately detects human speech while ignoring music, background noise, and silence. Powered by an efficient ONNX model and a post-processing algorithm inspired by WebRTC (using ring buffer smoothing), it runs entirely on the CPU with minimal overhead, making it ideal for real-time voice interfaces, ASR frontends, and low-resource deployments.
Dependencies
The following third-party dependencies are required to use streamsad:
numpyonnxruntime
How to Use
Here is an example of how to use the streamsad module:
from streamsad.sad import SAD
import numpy as np
# Initialize the SAD model
sad = SAD()
# Create an example audio stream (e.g., 2 seconds of random audio at 16kHz)
audio_np_array = np.random.randn(32000).astype(np.float32)
# Detect speech segments
segments = sad(audio_np_array)
# Print the detected segments
print(segments)
Installation
You can install streamsad using pip:
pip install streamsad
Testing
After installing the module, you can run unit tests using pytest:
pytest -s tests/test_sad.py
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamsad-0.1.1.tar.gz.
File metadata
- Download URL: streamsad-0.1.1.tar.gz
- Upload date:
- Size: 258.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a92c30432fa6d2d7c28e7a8736437a4bce44fe35764b7f5d63f0e07f5f4e00f1
|
|
| MD5 |
346639e760ea761850db7a74b1ffed00
|
|
| BLAKE2b-256 |
6d0cc5b1387ac534a6229b64b1bd673b6c0b5579b9437080f7cdaaee77fa4e47
|
File details
Details for the file streamsad-0.1.1-py3-none-any.whl.
File metadata
- Download URL: streamsad-0.1.1-py3-none-any.whl
- Upload date:
- Size: 256.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ce8270741d3f301d9e4f4bb5af9f9202509ae5ecd9558cf6a968c4cc5d92c28
|
|
| MD5 |
18a3b5500f346267c99a42d8afbc083b
|
|
| BLAKE2b-256 |
035ebc4f4b51d5b709e6ecf4cee29a6a8708c6e206581eaa680bf9d74f17c69f
|