Skip to content

๐ŸŽ› ๐Ÿ”Š A Python library for audio.

Support reset() on Pedalboard objects too, and add compatibility chart.

Peter Sobot549c1ff3c210
diff --git a/COMPATIBILITY.md b/COMPATIBILITY.md
new file mode 100644
index 0000000..887d210
--- /dev/null
+++ b/COMPATIBILITY.md
@@ -0,0 +1,10 @@
+# Pedalboard VST/Audio Unit Compatibility List
+
+| Plugin Name | Author | Format | macOS | Linux | Windows |
+|----------------------------------------------------------------------|--------------------------------------------------------|--------------|------------|------------------------|---------------------|
+| [CHOWTapeModel](https://github.com/jatinchowdhury18/AnalogTapeModel) | [Jatin Chowdhury](https://github.com/jatinchowdhury18) | VST3ยฎ | โœ… Working | โœ… Working | โœ… Working |
+| [CHOWTapeModel](https://github.com/jatinchowdhury18/AnalogTapeModel) | [Jatin Chowdhury](https://github.com/jatinchowdhury18) | Audio Unit | โœ… Working | โ˜‘๏ธ _No AU support_ | โ˜‘๏ธ _No AU support_ |
+| [dearVR MICRO](https://www.dear-reality.com/products/dearvr-micro) | [Dear Reality](https://www.dear-reality.com/) | VST3ยฎ | โœ… Working | โ˜‘๏ธ _Plugin not offered_ | โ“ Unknown |
+| [dearVR MICRO](https://www.dear-reality.com/products/dearvr-micro) | [Dear Reality](https://www.dear-reality.com/) | Audio Unit | โœ… Working | โ˜‘๏ธ _Plugin not offered_ | โ˜‘๏ธ _No AU support_ |
+| [RoughRider3](https://www.audiodamage.com/pages/free-downloads) | [Audio Damage](https://www.audiodamage.com/) | VST3ยฎ | โœ… Working | โœ… Working | โ“ Unknown |
+| [RoughRider3](https://www.audiodamage.com/pages/free-downloads) | [Audio Damage](https://www.audiodamage.com/) | Audio Unit | โœ… Working | โ˜‘๏ธ _No AU support_ | โ˜‘๏ธ _No AU support_ |
\ No newline at end of file
diff --git a/README.md b/README.md
index 23d63ad..f22cc53 100644
--- a/README.md
+++ b/README.md
@@ -61,6 +61,28 @@ pip install pedalboard
- Tested automatically on GitHub with VSTs
- Platform wheels available for `amd64` (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](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:
+
+1. 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
+1. 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:
diff --git a/pedalboard/ExternalPlugin.h b/pedalboard/ExternalPlugin.h
index 079cde7..e7b277a 100644
--- a/pedalboard/ExternalPlugin.h
+++ b/pedalboard/ExternalPlugin.h
@@ -290,11 +290,16 @@ public:
pluginInstance->setStateInformation(savedState.getData(),
savedState.getSize());
- for (auto *parameter : pluginInstance->getParameters()) {
- if (currentParameters.count(parameter->getParameterIndex()) > 0) {
- parameter->setValue(currentParameters[parameter->getParameterIndex()]);
+ // Set all of the parameters twice: we may have meta-parameters that change the
+ // validity of other `setValue` calls. (i.e.: param1 can't be set until param2 is set.)
+ for (int i = 0; i < 2; i++) {
+ for (auto *parameter : pluginInstance->getParameters()) {
+ if (currentParameters.count(parameter->getParameterIndex()) > 0) {
+ parameter->setValue(currentParameters[parameter->getParameterIndex()]);
+ }
}
}
+
if (lastSpec.numChannels != 0) {
const juce::dsp::ProcessSpec _lastSpec = lastSpec;
diff --git a/pedalboard/pedalboard.py b/pedalboard/pedalboard.py
index 786037b..e4a5b81 100644
--- a/pedalboard/pedalboard.py
+++ b/pedalboard/pedalboard.py
@@ -98,6 +98,15 @@ class Pedalboard(collections.MutableSequence):
def __getitem__(self, index: int) -> Optional[Plugin]:
return self.plugins.__getitem__(index)
+ def reset(self):
+ """
+ Clear any internal state (e.g.: reverb tails) kept by all of the plugins in this
+ Pedalboard. The values of plugin parameters will remain unchanged. For most plugins,
+ this is a fast operation; for some, this will cause a full re-instantiation of the plugin.
+ """
+ for plugin in self.plugins:
+ plugin.reset()
+
def process(
self,
audio: np.ndarray,
diff --git a/pedalboard/python_bindings.cpp b/pedalboard/python_bindings.cpp
index 4f41929..961f583 100644
--- a/pedalboard/python_bindings.cpp
+++ b/pedalboard/python_bindings.cpp
@@ -90,6 +90,13 @@ PYBIND11_MODULE(pedalboard_native, m) {
// type inference.
return nullptr;
}))
+ .def(
+ "reset",
+ &Plugin::reset,
+ "Clear any internal state kept by this plugin (e.g.: reverb "
+ "tails). The values of plugin parameters will remain unchanged. "
+ "For most plugins, this is a fast operation; for some, this will "
+ "cause a full re-instantiation of the plugin.")
.def(
"process",
[](Plugin *self,
diff --git a/tests/test_external_plugins.py b/tests/test_external_plugins.py
index 0152122..c270824 100644
--- a/tests/test_external_plugins.py
+++ b/tests/test_external_plugins.py
@@ -444,6 +444,38 @@ def test_plugin_state_not_cleared_between_invocations_if_reset_is_false(plugin_f
assert max_volume_of(plugin(silence, sr, reset=False)) > 0.00001
[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)
+def test_explicit_reset(plugin_filename: str):
+ plugin = load_test_plugin(plugin_filename, disable_caching=True)
+
+ sr = 44100
+ noise = np.random.rand(sr, 2)
+ assert max_volume_of(noise) > 0.95
+ silence = np.zeros_like(noise)
+ assert max_volume_of(silence) == 0.0
+
+ assert max_volume_of(plugin(silence, sr, reset=False)) < 0.00001
+ assert max_volume_of(plugin(noise, sr, reset=False)) > 0.00001
+ plugin.reset()
+ assert max_volume_of(plugin(silence, sr, reset=False)) < 0.00001
+
+
[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)
+def test_explicit_reset_in_pedalboard(plugin_filename: str):
+ sr = 44100
+ board = pedalboard.Pedalboard([load_test_plugin(plugin_filename, disable_caching=True)], sr)
+ noise = np.random.rand(sr, 2)
+
+ assert max_volume_of(noise) > 0.95
+ silence = np.zeros_like(noise)
+ assert max_volume_of(silence) == 0.0
+
+ assert max_volume_of(board(silence, reset=False)) < 0.00001
+ assert max_volume_of(board(noise, reset=False)) > 0.00001
+ board.reset()
+ assert max_volume_of(board(silence, reset=False)) < 0.00001
+
+
@pytest.mark.parametrize("value", (True, False))
def test_wrapped_bool(value: bool):
wrapped = WrappedBool(value)