A Python library for adding effects to audio.
Project description
pedalboard
is a Python library for adding effects to audio. It supports a number of common audio effects out of the box, and also allows the use of VST3® and Audio Unit plugin formats for third-party effects. It 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.
Features
- Built-in support for a number of basic audio transformations:
Convolution
Compressor
Chorus
Distortion
Gain
HighpassFilter
LadderFilter
Limiter
LowpassFilter
Phaser
Reverb
- Supports VST3® plugins on macOS, Windows, and Linux (
pedalboard.load_plugin
) - Supports 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 faster1 than SoxBindings
- Releases Python's Global Interpreter Lock (GIL) to allow use of multiple CPU cores
- Tested compatibility with TensorFlow - can be used in
tf.data
pipelines!
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.6, 3.7, 3.8, 3.9, and 3.10 as well as experimental support for PyPy 7.3.
- Linux
- Tested heavily in production use cases at Spotify
- Tested automatically on GitHub with VSTs
- Platform
manylinux
wheels 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)
Plugin Compatibility
pedalboard
allows loading VST3® and Audio Unit plugins, which could contain any code.
Most plugins that have been tested work just fine with pedalboard
, but some plugins may
not work with pedalboard
; at worst, some may even crash the Python interpreter without
warning and with no ability to catch the error. For an ever-growing compatibility list,
see COMPATIBILITY.md.
Most audio plugins are "well-behaved" and conform to a set of conventions for how audio
plugins are supposed to work, but many do not conform to the VST3® or Audio Unit
specifications. pedalboard
attempts to detect some common programming errors in plugins
and can work around many issues, including automatically detecting plugins that don't
clear their internal state when asked. Even so, plugins can misbehave without pedalboard
noticing.
If audio is being rendered incorrectly or if audio is "leaking" from one process()
call
to the next in an undesired fashion, try:
- Passing silence to the plugin in between calls to
process()
, to ensure that any reverb tails or other internal state has time to fade to silence - Reloading the plugin every time audio is processed (with
pedalboard.load_plugin
)
Examples
A very basic example of how to use pedalboard
's built-in plugins:
import soundfile as sf
from pedalboard import (
Pedalboard,
Convolution,
Compressor,
Chorus,
Gain,
Reverb,
Limiter,
LadderFilter,
Phaser,
)
audio, sample_rate = sf.read('some-file.wav')
# Make a Pedalboard object, containing multiple plugins:
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),
], sample_rate=sample_rate)
# 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())
# Run the audio through this pedalboard!
effected = board(audio)
# Write the audio back as a wav file:
with sf.SoundFile('./processed-output-stereo.wav', 'w', samplerate=sample_rate, channels=len(effected.shape)) as f:
f.write(effected)
Loading a VST3® plugin and manipulating its parameters
import soundfile as sf
from pedalboard import Pedalboard, Reverb, load_plugin
# Load a VST3 package 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:
audio, sample_rate = sf.read('some-file.wav')
effected = vst(audio, sample_rate=sample_rate)
# ...or put this VST into a chain with other plugins:
board = Pedalboard([vst, Reverb()], sample_rate=sample_rate)
# ...and run that pedalboard with the same VST instance!
effected = board(audio)
For more examples, see:
- the
examples
folder of this repository - the Pedalboard Demo Colab notebook
- an interactive web demo on Hugging Face Spaces and Gradio (via @AK391)
Contributing
Contributions to pedalboard
are welcomed! See CONTRIBUTING.md for details.
Frequently Asked Questions
Can Pedalboard be used with live (real-time) audio?
Technically, yes, Pedalboard could be used with live audio input/output. See @stefanobazzi's guitarboard project for an example that uses the python-sounddevice
library to wire Pedalboard up to live audio.
However, there are a couple big caveats when talking about using Pedalboard in a live context. Python, as a language, is garbage-collected, meaning that your code randomly pauses on a regular interval to clean up unused objects. In most programs, this is not an issue at all. However, for live audio, garbage collection can result in random pops, clicks, or audio drop-outs that are very difficult to prevent.
Note that if your application processes audio in a streaming fashion, but allows for large buffer sizes (multiple seconds of audio) or soft real-time requirements, Pedalboard can be used there without issue. Examples of this use case include streaming audio processing over the network, or processing data offline but chunk-by-chunk.
Does Pedalboard support changing a plugin's parameters over time?
Yes! While there's no built-in function for this, it is possible to vary the parameters of a plugin over time manually:
import numpy
from pedalboard import Pedalboard, Compressor, Reverb
input_audio = ...
output_audio = np.zeros_like(input_audio)
board = Pedalboard([Compressor(), Reverb()])
reverb = board[-1]
# smaller step sizes would give a smoother transition,
# at the expense of processing speed
step_size_in_samples = 100
# Manually step through the audio 100 samples at a time
for i in range(0, input_audio.shape[0], step_size_in_samples):
# Set the reverb's "wet" parameter to be equal to the percentage through the track
# (i.e.: make a ramp from 0% to 100%)
percentage_through_track = i / input_audio.shape[0]
reverb.wet_level = percentage_through_track
# Process this chunk of audio, setting `reset` to `False`
# to ensure that reverb tails aren't cut off
chunk = board.process(input_audio[i : i + step_size_in_samples], reset=False)
output_audio[i : i + step_size_in_samples] = chunk
With this technique, it's possible to automate any parameter. Usually, using a step size of somewhere between 100 and 1,000 (2ms to 22ms at a 44.1kHz sample rate) is small enough to avoid hearing any audio artifacts, but big enough to avoid slowing down the code dramatically.
Can Pedalboard be used with VST instruments, instead of effects?
Not yet! The underlying framework (JUCE) supports VST and AU instruments just fine, but Pedalboard itself would have to be modified to support instruments.
Can Pedalboard plugins accept MIDI?
Not yet, either - although the underlying framework (JUCE) supports passing MIDI to plugins, so this would also be possible to add.
License
pedalboard
is Copyright 2021 Spotify AB.
pedalboard
is licensed under the GNU General Public License v3, because:
- The core audio processing code is pulled from JUCE 6, which is dual-licensed under a commercial license and the GPLv3
- The VST3 SDK, bundled with JUCE, is owned by Steinberg® Media Technologies GmbH and licensed under the GPLv3.
VST is a registered trademark of Steinberg Media Technologies GmbH.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for pedalboard-0.3.9-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cc044754809be1040471d0242bdbadbbfa0e17569146f03d318c33b2e1a664b |
|
MD5 | 88579cb1c61a00f9148f3beaab2ba730 |
|
BLAKE2b-256 | ca9a9105b3d3f94b2c95a4a195bc5a2198d464687f6240402997160dd853b984 |
Hashes for pedalboard-0.3.9-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b444adb2bfa4e7326a8de7777bc6f7679ef3950edc20d7207edeacb5cd7d2e21 |
|
MD5 | 3fb7046cd8d9d64a45627c9318181f8b |
|
BLAKE2b-256 | 3ee4e53d578d8b1d9ace5019b553b3be685a35060356d9929afb914b52680693 |
Hashes for pedalboard-0.3.9-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f878edebaf223639240ae8cbae9a7f5d9d291535c93202daa0b8e60c79cebe7 |
|
MD5 | 08fc367607d60599b1d41a16dc87c543 |
|
BLAKE2b-256 | e11a70d69cde9af0d8ac1d01af53f8094c43caeb1a2d8c448ba29218605e63c3 |
Hashes for pedalboard-0.3.9-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24ffa98ec65d0d948f9b3c10d6dc74838bf8a36404706cb58b2a678a7cf31e9f |
|
MD5 | bb779d881026f27c1397995adda14171 |
|
BLAKE2b-256 | c3e915fd8b752ed1860ee15f467380ad7157b5ad0179d6da7a7da36db38d07cd |
Hashes for pedalboard-0.3.9-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 522f1359e9e4abf733db13c8b1b179b0cea94bfcdcd3aaf9d9e3b6f771ab4d15 |
|
MD5 | 370ace46600e17d5d9a38b769921b146 |
|
BLAKE2b-256 | 83b1be78b090eada8242e42a0fc2399de26477be6910fc370c2b952b83be14f8 |
Hashes for pedalboard-0.3.9-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9015c24cd4b8bcef793661a1a641a86260ddf0cee764db42947bbe764dd1877e |
|
MD5 | efd5b144d756a7d429f397ed6bfbcc4d |
|
BLAKE2b-256 | 215a093863829518029667f0a372efead837d4ceeb48910db70a762efc5705ce |
Hashes for pedalboard-0.3.9-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0f06cdfcefffeb94fda881a9657a69b3da2cce4737df8ded6b6e82cfa1cb161 |
|
MD5 | 02571ecc31c51aee44b12f1aeba554a2 |
|
BLAKE2b-256 | c8dd0428150c72081e0466d50f00b706907e8ab6ab8340dbe6f25dcfb8045355 |
Hashes for pedalboard-0.3.9-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db926036f122dc0edb2c579592ef553e688c5a854e5a3f01f40dafdfefefab31 |
|
MD5 | 9e53c627337a2554ac2c3f4b16f4e028 |
|
BLAKE2b-256 | eaebb56bea3e58b1c25e58106e0935b9cdbf96c495ffc8d4ce5b31b6e0e40d13 |
Hashes for pedalboard-0.3.9-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c361765a30977021853e11b997f47cca8a25fc1535e5c02811e0d08d57b591de |
|
MD5 | 2a52970c76baefdd2db292e4a8cae61c |
|
BLAKE2b-256 | 2320b0ee62c93b97fb397ce79ff569bc70c994848fc81f682237c2829b1ac7f7 |
Hashes for pedalboard-0.3.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9aacc82cc68a5b5780b32066494139ae81ddde941fbc131769a3563d3bf602ee |
|
MD5 | 00468a6fb5da671e93c6eb0845cfee69 |
|
BLAKE2b-256 | 9c0dcbae233c8605f8f71927f2e078db4139b33904e2caa04680db8b9345a60d |
Hashes for pedalboard-0.3.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0033ccdab4f45d156323022cfaf152bf2e17b0083a674d1fa7953d5e87a42ff4 |
|
MD5 | 7a9f2a56e2a127795aef3c7774c8be69 |
|
BLAKE2b-256 | 591da7572e90d4ddd926fb83f16711bad743faa5b03ffb8d4405c86813772a32 |
Hashes for pedalboard-0.3.9-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce6c2ddc4db1663781514d89b3e12117dfd0b63286d7968fdb9ef2d5c13c7205 |
|
MD5 | aa282030cf11cbb431a57345d44ea7fa |
|
BLAKE2b-256 | f4df609f03f557037d1cc009ae8b7755f7b5f74bc2f1997c588a1c28669668c5 |
Hashes for pedalboard-0.3.9-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dacfe8c225f37eddd7795f334875d78327c3944d32d0a459cb07abb4b5edceff |
|
MD5 | 85b5b7f594770c2a916312f16999dad4 |
|
BLAKE2b-256 | d480c45a5066cca8b974266f9524622a0f11cf8c929247840fbec049bf06d4c9 |
Hashes for pedalboard-0.3.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb69f952cf209d96c6d9d3665c9f765a196af1d3165a3cb85ca7c3845eb70ee2 |
|
MD5 | 4284f05cfa8e3d151454361cfcd6450d |
|
BLAKE2b-256 | b82d651aef5d39ec0fbc6a525dbc2db0103230c48c93eac1070656780f1d2806 |
Hashes for pedalboard-0.3.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38e501ffc6fac096d43a8f158fd6bec285d8609811e807f393e077c5b58863e0 |
|
MD5 | 85f106a8c19b3ea367b5d58a21939002 |
|
BLAKE2b-256 | eec013d23092aae895e4817295c81fd75ca6dfadb133d5d8fba6da01bb806647 |
Hashes for pedalboard-0.3.9-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9de239f21c40433347df44166a843bda560f6ef43a3d1921669d7461506c1a69 |
|
MD5 | bc208d6af878e04cd9b447d0dd63eb2b |
|
BLAKE2b-256 | 20fa88923fdffb01fa17e0cb6667dc8abb6875b3677ab95f4e30d57eabae52a3 |
Hashes for pedalboard-0.3.9-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 462e50ccca5c388b9bdba177de9d9854ce6bd23dec7afc79fed8a8daa1788d4a |
|
MD5 | cc90632b90365c6a6670dd987bb149a8 |
|
BLAKE2b-256 | 9a4effb077d3d36ef5fc14a0a0ed0c8c36c383a443cbc1c0685a859214e3c57e |
Hashes for pedalboard-0.3.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 398b4cec89940bc25dd2f48227242195e7663d7a32bcfb492d05b50c64d47633 |
|
MD5 | 44dd229d1ecbdf729fab6b420b4edc86 |
|
BLAKE2b-256 | e7cbbfd5d70155954809a1a2ccd6548a219cffb673f73eba5b4d070ccd45a767 |
Hashes for pedalboard-0.3.9-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba1eda71e145279329cf3eac674437fafd949d773ff9a350c2684d3354108c15 |
|
MD5 | 13e5623c97ff67a86e6fd30a42b986fc |
|
BLAKE2b-256 | 8705b8ebd38dd0dbf24424b4460ba6fe40e473ec9bfb5261dc44cf1ed59a74f8 |
Hashes for pedalboard-0.3.9-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb0e376ecb5813279278013590bc832547a418f78b0bc033af3bcff1337be21f |
|
MD5 | 5bc5c3aa2d9d9ac6a6191056dc3ed1fb |
|
BLAKE2b-256 | c9f23895d814126c3f1d719148bb6c91ef0df31dcfa946d287a11e4feda21725 |
Hashes for pedalboard-0.3.9-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 810c00a4d07a6da3d7dd972a64fe04bf5263543cd936a6982c986dce49b4c102 |
|
MD5 | 9d3abf915101d08b522df01fb4d766d8 |
|
BLAKE2b-256 | 9182255465f82710e15c2ea5e2eca33072bbe07768405e95a177310aaa3fe799 |
Hashes for pedalboard-0.3.9-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18bcc27039cd4be7f1d4025fd082328956e239c197f5325b140b4725a4c0921c |
|
MD5 | 14090fc9c1010dd212a398c3012a0e82 |
|
BLAKE2b-256 | a67288b5d03d6d1ba9bf42652cd4bc87586acca94bc99e26b2234e50e13acc1d |
Hashes for pedalboard-0.3.9-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ee4e96b33b7803ae796c9d1365782f3c633e2d4f4a316c6cacdec4570afdbc5 |
|
MD5 | 3b7e73490ed90cba2f896dca4096529a |
|
BLAKE2b-256 | e7ae502bb60939270eff14b77d2df17c97b588b36bcafacf2b4896742d2450d8 |
Hashes for pedalboard-0.3.9-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82ae455ed8c2923d1e889c411247a0fb19e5a991b161cd1c2bcdaa40e891ebe7 |
|
MD5 | ae64f2408fe5cb448599289a47c3c2a9 |
|
BLAKE2b-256 | b932af2cd1524fd69688374b0a4339e025e7fee4e9acb364a43f604d79e3a175 |
Hashes for pedalboard-0.3.9-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 950dc9408e2033caba6dfae1e6b14aeb9f995f142b0d48b0940a451ef8fdb716 |
|
MD5 | 54fc619f2616b3f9dcbdb4cca8f72f65 |
|
BLAKE2b-256 | 958fa6e53c57920c82fabe3fc13672f6ce25c77c2350d92d2a31f7300f28da85 |
Hashes for pedalboard-0.3.9-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0aa792aeb8622246049db705e9f13fa1ff3ea7bf122caf013d319b15395f1c1f |
|
MD5 | cd529e3d23c40f8419fe48d9dd09d8ca |
|
BLAKE2b-256 | c1ff9b38451a8fad66d9a1a160180d127d31ca5c65dea2e6c4ddca2f1ef3db7c |
Hashes for pedalboard-0.3.9-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba10e686f646eebb933c66c3cf987352a4cd6192104b52e3d24748156d903a11 |
|
MD5 | 10fb20bbf1956941529576d3a89d79be |
|
BLAKE2b-256 | c26161d225ded3f85d0decf40455035d0d2437e9d52266a146e506d1e6023679 |
Hashes for pedalboard-0.3.9-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ed39c119f1cfa695b3d25631405528a02f4074d06ec6893192513bd148471d4 |
|
MD5 | b7e7570cd4f59bf079007da43302f856 |
|
BLAKE2b-256 | 1ec86a05cd69354236aa313ae8b4a62c652cbbc2d68dd181d9d16bc45e4082ed |