All projects

PyAudioCast

Python library · Rust/CPAL core

Cross-platform audio output for Python, powered by Rust and CPAL: stream to any device, virtual sinks included, and silence it instantly.

Languages
Rust · Python
PyPI
0.2.0
Python
≥ 3.9 (abi3)
License
MIT

Made for real-time voice

Audio is written in chunks into a ring buffer drained by a lock-free audio callback, which suits streaming TTS. clear() from any thread discards buffered audio, a write in progress included, so a voice assistant can stop talking the moment the user does.

Zero configuration

Sample rate and channels are detected from the device; when the device cannot take the source format, audio is resampled and remixed for it, for example 22050 Hz mono TTS to a 48000 Hz stereo device. Blocking calls release the GIL.

Stack

  • Rust
  • CPAL
  • PyO3
  • maturin
  • PipeWire
  • WASAPI
  • CoreAudio