I've noticed that some open source DAWs such as Ardour and Audacity are able to access audio plugins (e.g. VST, AU) that the user has installed on their system. This makes me think that "there ought to be a way" to do this in general.
Specifically, I'd like to call some plugins from within my own audio-processing application, which I'm writing in Python. Is there a recommended method or library that one can use for this?
My own searches have turned up nearly nothing. The only relevant post I've seen is this one but it's 5 years old. There is some mention of using JUCE and there are some 2-year-old Python bindings called PyJUCE (which seem to be setup for Windows), but so far I haven't gotten anything working, mostly due my poor acclimation to the sheer "bulk" of JUCE.
Any suggestions?
Perhaps the only remaining option is to start from scratch by writing one's own VST host, and then proceed as one would when calling any external C++ code from within Python. I just thought I'd ask before reinventing the wheel, because it's often the case that "whatever you want to do, someone else has already written a Python package for it." ;-)
...Two years later, here's an answer:
Igor Gadelha wrote a GitHub repo dpm that includes his vstRender class, which he wrote in JUCE. Currently it only works for mono plugins. I wrote some simple code to illustrate how to use vstRender, which Igor included in his "contrib" section: run_plugin.py.
Spotify has released pedalboard
, a pip
-installable Python library based on JUCE with support for loading and running audio plugins on macOS, Windows, and Linux. VST3 plugins are supported on all platforms, and Audio Units are supported on macOS. (As of September 2021, Pedalboard only supports audio effects, but contributors may add support for instrument plug-ins in the future.)
An example of using pedalboard
:
# After installing with `pip install pedalboard`:
import soundfile as sf
from pedalboard import Pedalboard, Compressor, Chorus, Distortion, Reverb
audio, sample_rate = soundfile.read('some-file.wav')
# Make a Pedalboard object, containing multiple plugins:
board = Pedalboard([
Compressor(threshold_db=-50, ratio=25),
Distortion(drive_db=30),
Chorus(),
load_plugin("./VSTs/SomePlugin.vst3"), # Load a VST3 plugin
Reverb(room_size=0.25),
], sample_rate=sample_rate)
# Run the audio through this pedalboard!
effected = board(audio)
The other libraries shared are great. I want to share DawDreamer, which I developed as an evolution of Renderman. It has many features:
Some people have expressed an interest in LV2 plugins, which I haven't tested. I would suggest trying Faust as an open-source alternative, but I'll get to testing LV2 too.
I hope to demonstrate a reinforcement learning environment soon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With