pedalboard is a Python library for working with audio: reading, writing, 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 third-party plugins.
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.
pedalboard also helps in the process of content creation, making it possible to add effects to audio without using a Digital Audio Workstation.
pedalboard is available via PyPI (via Platform Wheels):
pip install pedalboard # That's it! No other dependencies required.
If you are new to Python, follow INSTALLATION.md for a robust guide.
pedalboard is thoroughly tested with Python 3.6, 3.7, 3.8, 3.9, and 3.10 as well as experimental support for Python 3.11 and PyPy 3.7, 3.8, and 3.9.
manylinuxwheels built for
from pedalboard import Pedalboard, Chorus, Reverb from pedalboard.io import AudioFile # Read in a whole audio file: with AudioFile('some-file.wav') as f: audio = f.read(f.frames) samplerate = f.samplerate # Make a Pedalboard object, containing multiple plugins: board = Pedalboard([Chorus(), Reverb(room_size=0.25)]) # 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) as f: f.write(effected)
# 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.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) as f: f.write(effected)
from pedalboard import Pedalboard, Reverb, load_plugin from pedalboard.io import AudioFile # Load a VST3 or Audio Unit plugin from a known path on disk: vst = load_plugin("./VSTs/RoughRider3.vst3") print(vst.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 vst.ratio = 15 # Use this VST to process some audio: with AudioFile('some-file.wav', 'r') as f: audio = f.read(f.frames) samplerate = f.samplerate effected = vst(audio, samplerate) # ...or put this VST into a chain with other plugins: board = Pedalboard([vst, Reverb()]) # ...and run that pedalboard with the same VST instance! effected = board(audio, samplerate)
This example creates a delayed pitch-shift effect by running
multiple Pedalboards in parallel on the same audio.
objects are themselves
Plugin objects, so you can nest them
as much as you like:
from pedalboard import Pedalboard, Compressor, Delay, Distortion, Gain, PitchShift, Reverb, Mix passthrough = Gain(gain_db=0) delay_and_pitch_shift = Pedalboard([ Delay(delay_seconds=0.25, mix=1.0), PitchShift(semitones=7), Gain(gain_db=-3), ]) delay_longer_and_more_pitch_shift = Pedalboard([ Delay(delay_seconds=0.5, mix=1.0), PitchShift(semitones=12), Gain(gain_db=-6), ]) board = Pedalboard([ # Put a compressor at the front of the chain: Compressor(), # Run all of these pedalboards simultaneously with the Mix plugin: Mix([ passthrough, delay_and_pitch_shift, delay_longer_and_more_pitch_shift, ]), # Add a reverb on the final mix: Reverb() ])
For more examples, see:
pedalboard are welcomed! See CONTRIBUTING.md for details.
pedalboard is Copyright 2021-2022 Spotify AB.
pedalboard is licensed under the GNU General Public License v3.
pedalboard includes a number of libraries that are statically compiled, and which carry the following licenses:
PitchShiftplugin uses the Rubber Band Library, which is dual-licensed under a commercial license and the GPLv2 (or newer).
MP3Compressorplugin uses libmp3lame from the LAME project, which is licensed under the LGPLv2 and upgraded to the GPLv3 for inclusion in this project (as permitted by the LGPLv2).
GSMFullRateCompressorplugin uses libgsm, which is licensed under the ISC license and compatible with the GPLv3.
VST is a registered trademark of Steinberg Media Technologies GmbH.