Audio

Audio class

Audio now uses a backend abstraction:

  • sounddevice: low-latency backend (recommended for timing-critical runs).

  • dummy: no-op backend for CI/headless testing.

  • auto: selects sounddevice when available, otherwise dummy.

Backend selection

Select backend in code:

from tachypy import Audio
audio = Audio(sample_rate=44100, channels=1, backend="sounddevice")

Or through environment:

TACHYPY_AUDIO_BACKEND=dummy pytest

CI guidance

Use the dummy backend in CI to avoid native audio-driver requirements. Keep hardware/audio integration tests in dedicated jobs or local validation passes.

Installing sounddevice prerequisites

sounddevice may require PortAudio system libraries.

Linux (Debian/Ubuntu):

sudo apt update
sudo apt install libportaudio2 libportaudiocpp0 portaudio19-dev

macOS:

Install Homebrew (if needed):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then install PortAudio:

brew install portaudio

Windows:

Pip wheels for sounddevice often work directly. If not, one workaround is:

choco install portaudio