Pedalboard
🎛 🔊 A Python library for audio.
Install / Use
/learn @spotify/PedalboardREADME

pedalboard is a Python library for working with audio: reading, writing, rendering, adding effects, and more. It supports most popular audio file formats and a number of common audio effects out of the box, and also allows the use of VST3® and Audio Unit formats for loading third-party software instruments and effects.
pedalboard was built by Spotify's Audio Intelligence Lab to enable using studio-quality audio effects from within Python and TensorFlow. Internally at Spotify, pedalboard is used for data augmentation to improve machine learning models and to help power features like Spotify's AI DJ and AI Voice Translation. pedalboard also helps in the process of content creation, making it possible to add effects to audio without using a Digital Audio Workstation.
Features
- Built-in audio I/O utilities (pedalboard.io)
- Support for reading and writing AIFF, FLAC, MP3, OGG, and WAV files on all platforms with no dependencies
- Additional support for reading AAC, AC3, WMA, and other formats depending on platform
- Support for on-the-fly resampling of audio files and streams with
O(1)memory usage - Live audio effects via <a href="https://spotify.github.io/pedalboard/reference/pedalboard.io.html#pedalboard.io.AudioStream"><code class="docutils literal"><span class="pre">AudioStream</span></code></a>
- Built-in support for a number of basic audio transformations, including:
- Guitar-style effects:
Chorus,Distortion,Phaser,Clipping - Loudness and dynamic range effects:
Compressor,Gain,Limiter - Equalizers and filters:
HighpassFilter,LadderFilter,LowpassFilter - Spatial effects:
Convolution,Delay,Reverb - Pitch effects:
PitchShift - Lossy compression:
GSMFullRateCompressor,MP3Compressor - Quality reduction:
Resample,Bitcrush
- Guitar-style effects:
- Supports VST3® instrument and effect plugins on macOS, Windows, and Linux (<a href="https://spotify.github.io/pedalboard/reference/pedalboard.html#pedalboard.load_plugin"><code class="docutils literal"><span class="pre">pedalboard.load_plugin</span></code></a>)
- Supports instrument and effect Audio Units on macOS
- Strong thread-safety, memory usage, and speed guarantees
- Releases Python's Global Interpreter Lock (GIL) to allow use of multiple CPU cores
- No need to use
multiprocessing!
- No need to use
- Even when only using one thread:
- Processes audio up to 300x faster than pySoX for single transforms, and 2-5x faster than SoxBindings (via iCorv)
- Reads audio files up to 4x faster than librosa.load (in many cases)
- Releases Python's Global Interpreter Lock (GIL) to allow use of multiple CPU cores
- Tested compatibility with TensorFlow - can be used in
tf.datapipelines!
Installation
pedalboard is available via PyPI (via Platform Wheels):
pip install pedalboard
If you are new to Python, follow INSTALLATION.md for a robust guide.
Compatibility
pedalboard is thoroughly tested with Python 3.10, 3.11, 3.12, 3.13, and 3.14.
- Linux
- Tested heavily in production use cases at Spotify
- Tested automatically on GitHub with VSTs
- Platform
manylinuxandmusllinuxwheels built forx86_64(Intel/AMD) andaarch64(ARM/Apple Silicon) - Most Linux VSTs require a relatively modern Linux installation (with glibc > 2.27)
- macOS
- Tested manually with VSTs and Audio Units
- Tested automatically on GitHub with VSTs
- Platform wheels available for both Intel and Apple Silicon
- Compatible with a wide range of VSTs and Audio Units
- Windows
- Tested automatically on GitHub with VSTs
- Platform wheels available for
amd64(x86-64, Intel/AMD)
Examples
Note: If you'd rather watch a video instead of reading examples or documentation, <strong>watch <a href="https://www.youtube.com/watch?v=NYhkqXpFAlg" target="_blank"><em>Working with Audio in Python (feat. Pedalboard)</em> on YouTube</a></strong>.
Quick start
from pedalboard import Pedalboard, Chorus, Reverb
from pedalboard.io import AudioFile
# Make a Pedalboard object, containing multiple audio plugins:
board = Pedalboard([Chorus(), Reverb(room_size=0.25)])
# Open an audio file for reading, just like a regular file:
with AudioFile('some-file.wav') as f:
# Open an audio file to write to:
with AudioFile('output.wav', 'w', f.samplerate, f.num_channels) as o:
# Read one second of audio at a time, until the file is empty:
while f.tell() < f.frames:
chunk = f.read(f.samplerate)
# Run the audio through our pedalboard:
effected = board(chunk, f.samplerate, reset=False)
# Write the output to our output file:
o.write(effected)
Note: For more information about how to process audio through Pedalboard plugins, including how the
resetparameter works, see <a href="https://spotify.github.io/pedalboard/reference/pedalboard.html#pedalboard.Plugin.process"> the documentation for <code class="docutils literal"><span class="pre">pedalboard.Plugin.process</span></code></a>.
Making a guitar-style pedalboard
# Don't do import *! (It just makes this example smaller)
from pedalboard import *
from pedalboard.io import AudioFile
# Read in a whole file, resampling to our desired sample rate:
samplerate = 44100.0
with AudioFile('guitar-input.wav').resampled_to(samplerate) as f:
audio = f.read(f.frames)
# Make a pretty interesting sounding guitar pedalboard:
board = Pedalboard([
Compressor(threshold_db=-50, ratio=25),
Gain(gain_db=30),
Chorus(),
LadderFilter(mode=LadderFilter.Mode.HPF12, cutoff_hz=900),
Phaser(),
Convolution("./guitar_amp.wav", 1.0),
Reverb(room_size=0.25),
])
# Pedalboard objects behave like lists, so you can add plugins:
board.append(Compressor(threshold_db=-25, ratio=10))
board.append(Gain(gain_db=10))
board.append(Limiter())
# ... or change parameters easily:
board[0].threshold_db = -40
# Run the audio through this pedalboard!
effected = board(audio, samplerate)
# Write the audio back as a wav file:
with AudioFile('processed-output.wav', 'w', samplerate, effected.shape[0]) as f:
f.write(effected)
Using VST3® or Audio Unit instrument and effect plugins
from pedalboard import Pedalboard, Reverb, load_plugin
from pedalboard.io import AudioFile
from mido import Message # not part of Pedalboard, but convenient!
# Load a VST3 or Audio Unit plugin from a known path on disk:
instrument = load_plugin("./VSTs/Magical8BitPlug2.vst3")
effect = load_plugin("./VSTs/RoughRider3.vst3")
print(effect.parameters.keys())
# dict_keys([
# 'sc_hpf_hz', 'input_lvl_db', 'sensitivity_db',
# 'ratio', 'attack_ms', 'release_ms', 'makeup_db',
# 'mix', 'output_lvl_db', 'sc_active',
# 'full_bandwidth', 'bypass', 'program',
# ])
# Set the "ratio" parameter to 15
effect.ratio = 15
# Render some audio by passing MIDI to an instrument:
sample_rate = 44100
audio = instrument(
[Message("note_on", note=60), Message("note_off", note=60, time=5)],
duration=5, # seconds
sample_rate=sample_rate,
)
# Apply effects to this audio:
effected = effect(audio, sample_rate)
# ...or put the effect into a chain with other plugins:
board = Pedalboard([effect, Reverb()])
# ...and run that pedalboard with the same VST instance!
effected = board(audio, sample_rate)
Creating parallel effects chains
This example creates a delayed pitch-shift e
