Skip to main content

Cross-platform audio capture, output, and voice activity detection

Project description

Decibri

Cross-platform audio capture, output, and processing for Python.

PyPI version Python versions License

Decibri is a native Python package that delivers microphone capture, speaker output, local voice activity detection, device enumeration, and sample format conversion. It is written in Rust (via PyO3 / abi3) and ships pre-built wheels for Linux, macOS Apple Silicon, and Windows.

Install

pip install decibri

Quickstart

Capture audio

import decibri

mic = decibri.Microphone(sample_rate=16000, channels=1)
mic.start()
for chunk in mic:
    print(f"Got {len(chunk)} bytes")
    break  # exit after first chunk for demo
mic.stop()

Record one second to a WAV file

import decibri

decibri.record_to_file("output.wav", seconds=1.0, sample_rate=16000)

Capture with Silero VAD

import decibri

mic = decibri.Microphone(sample_rate=16000, vad="silero")
mic.start()
for chunk in mic:
    print(f"Got {len(chunk)} bytes; VAD score {mic.vad_score}; speaking={mic.is_speaking}")
    break  # exit after first chunk for demo
mic.stop()

Async capture

import asyncio
import decibri

async def main():
    async with await decibri.AsyncMicrophone.open(sample_rate=16000, vad="silero") as mic:
        async for chunk in mic:
            print(f"Got {len(chunk)} bytes; VAD score {mic.vad_score}")
            break  # exit after first chunk for demo

asyncio.run(main())

Speaker output

import decibri

spk = decibri.Speaker(sample_rate=24000, channels=1)
spk.start()
spk.write(audio_bytes)  # int16 PCM
spk.drain()
spk.stop()

Public API

Core classes

  • Microphone: synchronous audio capture
  • Speaker: synchronous audio output
  • AsyncMicrophone: async-await audio capture
  • AsyncSpeaker: async-await audio output

Module-level functions

  • decibri.input_devices(): enumerate available input devices
  • decibri.output_devices(): enumerate available output devices
  • decibri.version(): version + audio backend info
  • decibri.record_to_file(path, seconds, ...): record N seconds to a WAV file
  • decibri.async_record_to_file(path, seconds, ...): async equivalent

Value types

DeviceInfo, OutputDeviceInfo, VersionInfo, Chunk.

Exceptions

The full hierarchy lives at decibri.exceptions. Top-level catch-targets surfaced at the package root:

  • DecibriError: base of the hierarchy
  • DeviceError: input / output device problems
  • OrtError: ONNX Runtime issues
  • OrtPathError: ORT dylib path resolution issues
  • ForkAfterOrtInit: Linux fork-after-ORT-init detection

Voice Activity Detection

Decibri ships with two VAD modes: a lightweight RMS energy threshold (opt-in via vad="energy") and a Silero ONNX model (~2.3 MB, bundled in the wheel; no API keys required).

# Energy mode (lightweight, no model)
mic = decibri.Microphone(vad="energy", vad_threshold=0.01)

# Silero mode (ML-based, more accurate in noisy environments)
mic = decibri.Microphone(vad="silero", vad_threshold=0.5)

Use mic.vad_score (a value in [0, 1]) to gate downstream processing. mic.is_speaking returns the boolean above-threshold view.

Compatibility

Python Platforms
3.10, 3.11, 3.12, 3.13, 3.14 Linux x64, Linux ARM64, macOS Apple Silicon, Windows x64

Bundled assets

The wheel includes:

  • Silero VAD ONNX model (~2.3 MB): no downloads or API keys required for vad="silero".
  • ONNX Runtime dylib (~15-20 MB platform-specific): no system dependency on pip install onnxruntime.

First ORT load on vad="silero" initialization is ~100 to 500 ms (amortized across subsequent calls).

Async usage

For Silero VAD in async code, use the open() factory to dispatch the synchronous ORT init off the event loop:

async with await decibri.AsyncMicrophone.open(vad="silero") as mic:
    async for chunk in mic:
        ...

Synchronous constructors (AsyncMicrophone(...)) remain supported and unchanged; open() is the recommended pattern when ORT load cost matters.

Multiprocessing

Linux multiprocessing with Silero VAD requires set_start_method('spawn'). Calling fork() after ORT initialization raises ForkAfterOrtInit:

import multiprocessing as mp

mp.set_start_method('spawn')  # required on Linux for Silero

See the ecosystem guides under bindings/python/docs/ecosystem/ (jupyter, docker, multiprocessing) for environment-specific details.

Documentation

License

Apache-2.0. See LICENSE for details.

Copyright (c) 2026 Decibri.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

decibri-0.1.0-cp310-abi3-win_amd64.whl (8.1 MB view details)

Uploaded CPython 3.10+Windows x86-64

decibri-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

decibri-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl (3.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

decibri-0.1.0-cp310-abi3-macosx_14_0_arm64.whl (12.3 MB view details)

Uploaded CPython 3.10+macOS 14.0+ ARM64

File details

Details for the file decibri-0.1.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: decibri-0.1.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 8.1 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for decibri-0.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f15fff5c506776e427ade6ee499b0654415de3d136f8f8bb2c7f78740bbfd513
MD5 d5d2cf7ce84cb1f79c2a177af41253a3
BLAKE2b-256 bb5c7b005701f2684e67a1b2a99b309d8a2028003758ba67159c6a7813a34dbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for decibri-0.1.0-cp310-abi3-win_amd64.whl:

Publisher: publish-pypi.yml on decibri/decibri

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file decibri-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for decibri-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1a49a921e53976b9e6bb9701724ef4f1163c74c582ca4d59a981a0475f8e0dfc
MD5 c99a3fe13b78704b078f2e198cd64c5c
BLAKE2b-256 b32261914d94f3d5eabf87439d3c1308cd6b2fa37cd5e5da4ef535d8c5127bf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for decibri-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: publish-pypi.yml on decibri/decibri

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file decibri-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for decibri-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d17514f75be087edd518e9da345d9eb32f883978c3d1da0c1f46b876474f6449
MD5 976a4b9154b6b82e87f06765ddb891ea
BLAKE2b-256 60643fe142c8e59515a75f849f4ed26e14419b69389560629cf740e70ef19c6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for decibri-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl:

Publisher: publish-pypi.yml on decibri/decibri

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file decibri-0.1.0-cp310-abi3-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for decibri-0.1.0-cp310-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 a0c386bd4094126a3de031007443e0f45b23a806883d4fda62955da30c167942
MD5 4a88215fa2b5f066c9b3737ef32d0970
BLAKE2b-256 a1ded1419c2caf05c8ba89916a28dfa95ee0a1e6487fe89160c13550b1efb051

See more details on using hashes here.

Provenance

The following attestation bundles were made for decibri-0.1.0-cp310-abi3-macosx_14_0_arm64.whl:

Publisher: publish-pypi.yml on decibri/decibri

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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