spotify/pedalboard
🎛 🔊 A Python library for audio.
Pedalboard – Audio‑processing library for Python
What it is – A Python package that lets you read, write, and transform audio files, stream live audio, and run studio‑quality effects (including VST3 and Audio Unit plugins) directly from Python code. It was created by Spotify’s Audio Intelligence Lab and is used internally for data‑augmentation in machine‑learning pipelines and features such as Spotify’s AI DJ.
Key capabilities
- File I/O – Supports WAV, AIFF, FLAC, MP3, OGG and many other formats on macOS, Windows and Linux. Files can be resampled on‑the‑fly with constant‑memory usage.
- Built‑in effects – A collection of ready‑to‑use plugins (e.g., Chorus, Distortion, Compressor, Gain, Limiter, High‑/Low‑pass filters, Reverb, Delay, PitchShift, Bitcrush, MP3/GSM compression, etc.).
- Third‑party plugins – Load VST3 instruments/effects on all platforms and Audio Units on macOS, enabling any commercial or open‑source plugin to be used.
- Thread‑safe & fast – Releases the Python GIL, allowing multi‑core processing without
multiprocessing. Benchmarks claim up to 300× faster thanpySoXfor single transforms and 4× faster file loading thanlibrosa. - TensorFlow integration – Designed to work inside
tf.datapipelines for on‑the‑fly audio augmentation. - Live streaming –
AudioStreamlets you route input from a device through a Pedalboard chain and output to speakers in real time.
Typical usage – Load an audio file, build a Pedalboard (a list‑like container of plugins), call it with a NumPy audio buffer and a sample‑rate, then write the result back to disk or stream it live. The same object can be nested, mixed, or run in parallel for complex effect routing.
Installation – pip install pedalboard (pre‑built wheels for macOS, Windows, Linux, including Apple‑Silicon). Works with Python 3.10‑3.15.
Why it matters for AI/ML – By providing fast, GPU‑friendly audio augmentation (e.g., adding reverb, distortion, pitch‑shifts) directly in data pipelines, Pedalboard helps improve robustness of speech‑ and music‑related models. Its ability to run VST plugins also lets researchers experiment with realistic studio effects without a DAW.
License – GPL v3 (with several bundled libraries under compatible licences).
Quick example
from pedalboard import Pedalboard, Chorus, Reverb
from pedalboard.io import AudioFile
board = Pedalboard([Chorus(), Reverb(room_size=0.25)])
with AudioFile('input.wav') as src, \
AudioFile('output.wav', 'w', src.samplerate, src.num_channels) as dst:
while src.tell() < src.frames:
chunk = src.read(src.samplerate) # 1‑second blocks
processed = board(chunk, src.samplerate) # apply effects
dst.write(processed)
Further resources – Full docs, examples, and a Colab notebook are linked from the repository; there’s also a YouTube walkthrough and a Hugging Face Spaces demo.
Related
- Project
- Project
- Project
- Project
- Project