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.4.tar.gz (258.9 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.4-py3-none-any.whl (256.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: streamsad-0.1.4.tar.gz
  • Upload date:
  • Size: 258.9 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.4.tar.gz
Algorithm Hash digest
SHA256 03667957be027c340e5cf59dfa34725da65d85964f1d900a1e9ae745551ab961
MD5 4709b5a3e8054e3d5a45ca02347d87b9
BLAKE2b-256 d104fa395fc3476be8415846a0d4c8153c33077b92ed4c2df90f316d6787b33e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: streamsad-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 256.2 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c3584a18de6506bb07d59f481aa89621ca42fb56c4cc60f6dccd305549719524
MD5 668f6effeb2333a8adce426e7a832e02
BLAKE2b-256 3d329796f6526854a3e26460ec51b9f64250dbba205c6784607518918ff9b10b

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