Introducing Pedalboard: Spotify’s Audio Effects Library for Python

September 7, 2021 Published by Peter Sobot, Staff Machine Learning Engineer - Spotify Audio Intelligence Lab

We’ve just open sourced Pedalboard, Spotify’s framework for adding effects to audio in Python. Pedalboard makes it easy to use studio-quality audio effects in your code, rather than just in your digital audio workstation (DAW).

If you ask any music or podcast producer where they spend most of their time, chances are they’ll say their DAW — the app that lets them edit, manipulate, and perfect their audio. DAWs are powerful software packages that are used in the production of the vast majority of audio today. Most music or podcast content that you hear on Spotify has probably been processed through popular DAWs like Ableton Live, Logic Pro®, or Pro Tools®, or newer, more accessible tools like Soundtrap or Anchor. These apps are optimized for high performance and audio quality, and give producers both incredible flexibility and control over their audio.

This ability to play with sound is usually relegated to DAWs, and these apps are built for musicians, not programmers. But what if programmers want to use the power, speed, and sound quality of a DAW in their code? The engineers and researchers at Spotify’s Audio Intelligence Lab found themselves with that exact need as part of their cutting-edge audio research. They found that each existing solution met some (but not all) of the criteria they needed — so instead, they built their own. Enter Pedalboard, a new Python package.

Pedalboard is a Python audio effects library designed to bridge the gap between professional audio software and Python code. It’s built on top of JUCE, the industry-standard framework for performant and reliable audio applications. Just like a professional DAW, Pedalboard supports a number of built-in audio effects, as well as third-party VST3® and Audio Unit plugins. And just like a DAW, Pedalboard prioritizes speed and quality: in basic tests on common developer hardware, it’s up to 300 times faster than the currently widely used packages for Python audio effects.

Similar to the pedalboards used by guitar players, Pedalboard includes a variety of common stylistic effects and augmentations that you can use to alter sounds. You’ll find basic tools to control volume, like a noise gate, compressor, and limiter, as well as more stylistic tools like distortion, phaser, filter, and reverb. Pedalboard even includes a built-in convolution operator for high-quality simulation of speakers and microphones. If that’s not enough, any VST3® or Audio Unit effect plugin can be loaded to provide access to more sonic possibilities. Once you’ve got the sound you’re looking for, you can save your effects by grouping plugins together into a pedalboard, which has the added benefit of speeding up processing.

We’ve found a number of great uses for Pedalboard at Spotify so far, including:

  • Machine Learning (ML): Pedalboard makes the process of data augmentation for audio dramatically faster and produces more realistic results. Using Pedalboard, it’s easy to take a small dataset and augment it with audio effects — adding reverb, compression, distortion, and more — to vastly increase the size of your model’s training data and increase your model’s performance. Pedalboard has been thoroughly tested in high-performance and high-reliability ML use cases at Spotify, and is used heavily with TensorFlow.

  • Content Creation: Pedalboard makes it easy to script the application of audio effects with small amounts of Python code. This can help automate parts of the audio creation process. Applying a VST3® or Audio Unit plugin no longer requires launching your DAW, importing audio, and exporting it; a couple of lines of code can do it all in one command, or as part of a larger workflow.

  • Creativity: Artists, musicians, and producers with a bit of Python knowledge can use Pedalboard to produce new creative effects that would be extremely time consuming and difficult to produce in a DAW. And for those just getting started with Python, Pedalboard is a great place to begin, as it provides a bridge between code and music.

Spotify has a long tradition of contributing to open source software, and our research labs are active participants in the open source and academic communities. To continue that tradition, we’re open sourcing the project after nearly a year of internal use in the hopes that it will open up new possibilities for researchers, engineers, musicians, and tinkerers. Pedalboard is “stage ready” — it supports macOS, Windows, and Linux out of the box, and we’ve used it internally at Spotify to process millions of hours of audio.

If you’re interested in trying out Pedalboard, it’s ready now. You can find its code and documentation on GitHub, where we welcome contributions to the code. Installing Pedalboard on your computer is as simple as running one command: pip install pedalboard. We can’t wait to hear what you use Pedalboard for!

VST is a registered trademark of Steinberg Media Technologies GmbH.