python-sounddevice
Play and record NumPy audio arrays via PortAudio, with blocking and callback streaming.
| Language | Python |
|---|---|
| Category | Synthesis & DSP |
| License | MIT |
| Platforms | macOS Windows Linux |
| Install | pip install sounddevice |
| First released | 2015 |
| Maintained | Yes |
| Links | Website · Source |
Strengths
- Simple cross-platform audio I/O over PortAudio
- Blocking and low-latency callback stream modes
- Integrates directly with NumPy
Limitations
- Requires a working PortAudio backend
- I/O only; no DSP or file decoding of its own
Best for
Recording and playback of audio in Python scripts and realtime callback pipelines.
Minimal example
import sounddevice as sd
rec = sd.rec(int(3 * 44100), samplerate=44100, channels=2)
sd.wait()
Alternatives to python-sounddevice
See all python-sounddevice alternatives & how they compare →