Skip to main content

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

This module has been tested and works correctly with Python 3.10 through 3.13.

The following third-party dependencies are required to use streamsad:

  • numpy
  • onnxruntime

How to Use

Here is an example of how to use the streamsad module:

import numpy as np
from streamsad import SAD

# 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

streamsad-0.1.2.tar.gz (259.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamsad-0.1.2-py3-none-any.whl (256.1 kB view details)

Uploaded Python 3

File details

Details for the file streamsad-0.1.2.tar.gz.

File metadata

  • Download URL: streamsad-0.1.2.tar.gz
  • Upload date:
  • Size: 259.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for streamsad-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4413feab940b7c053536d7fcf7c0c959e922fc5047cd4d6ed62f2e53741859ee
MD5 29ef0d5d84b124d50a620c0f5fb09d00
BLAKE2b-256 8e5586add67a98edf921e9f0298e5621e2188e87be8a0c3edc501534c235cfb8

See more details on using hashes here.

File details

Details for the file streamsad-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: streamsad-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 256.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for streamsad-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2cfe0adbe57343a0e491ab4da21f75202090c8683933b1eec39a386113f6419f
MD5 3b6ee68dff3c691d7bd5d2cad014b5b1
BLAKE2b-256 370f5261119eb8bfdfe75c3c84d623bb39aad82f39c3adef7943f1093b4e9da7

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