π π A Python library for audio.
C audioaudio-processingaudio-productionaudio-researchaudio-unitaugmentationjucemachine-learningpybind11pythonvst3vst3-host
Add support for rendering MIDI notes via instrument plugins.
Peter Sobot706f8c4d6ca8
diff --git a/pedalboard/ExternalPlugin.h b/pedalboard/ExternalPlugin.hindex 6502054..cfef61b 100644--- a/pedalboard/ExternalPlugin.h+++ b/pedalboard/ExternalPlugin.h@@ -29,6 +29,8 @@#include "Plugin.h"#include <pybind11/stl.h>+#include "process.h"+#if JUCE_MAC#include <AudioToolbox/AudioUnitUtilities.h>#endif@@ -59,6 +61,65 @@ inline std::vector<std::string> findInstalledVSTPluginPaths() {return pluginPaths;}+/**+ * Given a py::object representing a Python list object filled with Tuple[bytes,+ * float], each representing a MIDI message at a specific timestamp, return a+ * juce::MidiBuffer.+ */+juce::MidiBuffer parseMidiBufferFromPython(py::object midiMessages,+ float sampleRate) {+ juce::MidiBuffer buf;+ py::object normalizeFunction = py::module_::import("pedalboard.midi_utils")+ .attr("normalize_midi_messages");++ {+ py::gil_scoped_acquire acquire;+ if (PyErr_Occurred() != nullptr)+ throw py::error_already_set();+ }++ if (normalizeFunction == py::none()) {+ throw std::runtime_error(+ "Failed to import pedalboard.midi_utils.normalize_midi_messages! This "+ "is an internal Pedalboard error and should be reported.");+ }++ py::object pyNormalizedBuffer = normalizeFunction(midiMessages);++ {+ py::gil_scoped_acquire acquire;+ if (PyErr_Occurred() != nullptr)+ throw py::error_already_set();+ }++ if (pyNormalizedBuffer == py::none()) {+ throw std::runtime_error(+ "pedalboard.midi_utils.normalize_midi_messages returned None without "+ "throwing an exception. This is an internal Pedalboard error and "+ "should be reported.");+ }++ std::vector<std::tuple<py::bytes, float>> normalizedBuffer =+ pyNormalizedBuffer.cast<std::vector<std::tuple<py::bytes, float>>>();++ for (const std::tuple<py::bytes, float> &tuple : normalizedBuffer) {+ char *messagePointer;+ py::ssize_t messageLength;++ if (PYBIND11_BYTES_AS_STRING_AND_SIZE(std::get<0>(tuple).ptr(),+ &messagePointer, &messageLength)) {+ throw std::runtime_error(+ "Failed to decode Python bytes object. This is an internal "+ "Pedalboard error and should be reported.");+ }++ long sampleIndex = (std::get<1>(tuple) * sampleRate);+ buf.addEvent(messagePointer, messageLength, sampleIndex);+ }++ return buf;+}+/*** The VST3 and Audio Unit format managers differ in how they look up plugins* that are already installed on the current machine. This approach allows us to@@ -543,13 +604,6 @@ public:auto mainInputBus = pluginInstance->getBus(true, 0);auto mainOutputBus = pluginInstance->getBus(false, 0);- if (!mainInputBus) {- throw std::invalid_argument(- "Plugin '" + pluginInstance->getName().toStdString() +- "' does not accept audio input. It may be an instrument plug-in "- "and not an audio effect processor.");- }-// Try to disable all non-main input buses if possible:for (int i = 1; i < pluginInstance->getBusCount(true); i++) {auto *bus = pluginInstance->getBus(true, i);@@ -564,34 +618,38 @@ public:bus->enable(false);}- if (mainInputBus->getNumberOfChannels() == numChannels &&+ if ((!mainInputBus || mainInputBus->getNumberOfChannels() == numChannels) &&mainOutputBus->getNumberOfChannels() == numChannels) {return;}// Cache these values in case the plugin fails to update:- auto previousInputChannelCount = mainInputBus->getNumberOfChannels();+ auto previousInputChannelCount =+ mainInputBus ? mainInputBus->getNumberOfChannels() : 0;auto previousOutputChannelCount = mainOutputBus->getNumberOfChannels();// Try to change the input and output bus channel counts...- mainInputBus->setNumberOfChannels(numChannels);+ if (mainInputBus)+ mainInputBus->setNumberOfChannels(numChannels);mainOutputBus->setNumberOfChannels(numChannels);// If, post-reload, we still can't use the right number of channels, let's// conclude the plugin doesn't allow this channel count.- if (mainInputBus->getNumberOfChannels() != numChannels ||+ if ((!mainInputBus || mainInputBus->getNumberOfChannels() != numChannels) ||mainOutputBus->getNumberOfChannels() != numChannels) {// Reset the bus configuration to what it was before, so we don't// leave one of the buses smaller than the other:- mainInputBus->setNumberOfChannels(previousInputChannelCount);+ if (mainInputBus)+ mainInputBus->setNumberOfChannels(previousInputChannelCount);mainOutputBus->setNumberOfChannels(previousOutputChannelCount);throw std::invalid_argument("Plugin '" + pluginInstance->getName().toStdString() +"' does not support " + std::to_string(numChannels) +- "-channel input and output. (Main bus currently expects " +- std::to_string(mainInputBus->getNumberOfChannels()) ++ "-channel output. (Main bus currently expects " ++ std::to_string(mainInputBus ? mainInputBus->getNumberOfChannels()+ : 0) +" input channels and " +std::to_string(mainOutputBus->getNumberOfChannels()) +" output channels.)");@@ -627,6 +685,8 @@ public:const float sampleRate = 44100.0f;if (numInputChannels == 0) {+ // TODO: For instrument plugins, figure out how to measure audio+ // persistence across resets.return ExternalPluginReloadType::Unknown;}@@ -760,40 +820,45 @@ public:if (pluginInstance) {juce::MidiBuffer emptyMidiBuffer;- if (context.usesSeparateInputAndOutputBlocks()) {- throw std::runtime_error("Not implemented yet - "- "no support for using separate "- "input and output blocks.");++ if (pluginInstance->getMainBusNumInputChannels() == 0 &&+ context.getInputBlock().getNumChannels() > 0) {+ throw std::invalid_argument(+ "Plugin '" + pluginInstance->getName().toStdString() ++ "' does not accept audio input. It may be an instrument plugin "+ "instead of an effect plugin.");}+ const juce::dsp::AudioBlock<const float> &inputBlock =+ context.getInputBlock();juce::dsp::AudioBlock<float> &outputBlock = context.getOutputBlock();- // This should already be true, as prepare() should have been called- // before this!if ((size_t)pluginInstance->getMainBusNumInputChannels() !=- outputBlock.getNumChannels()) {+ inputBlock.getNumChannels()) {throw std::invalid_argument("Plugin '" + pluginInstance->getName().toStdString() +"' was instantiated with " +std::to_string(pluginInstance->getMainBusNumInputChannels()) +- "-channel input, but data provided was " +- std::to_string(outputBlock.getNumChannels()) + "-channel.");+ "-channel input, but provided audio data contained " ++ std::to_string(inputBlock.getNumChannels()) + " channel" ++ (inputBlock.getNumChannels() == 1 ? "" : "s") + ".");}if ((size_t)pluginInstance->getMainBusNumOutputChannels() <- outputBlock.getNumChannels()) {+ inputBlock.getNumChannels()) {throw std::invalid_argument("Plugin '" + pluginInstance->getName().toStdString() +"' produces " +std::to_string(pluginInstance->getMainBusNumOutputChannels()) +- "-channel output, but data provided was " +- std::to_string(outputBlock.getNumChannels()) +- "-channel. (The number of channels returned must match the "+ "-channel output, but provided audio data contained " ++ std::to_string(inputBlock.getNumChannels()) + " channel" ++ (inputBlock.getNumChannels() == 1 ? " " : "s") ++ ". (The number of channels returned must match the ""number of channels passed in.)");}std::vector<float *> channelPointers(- pluginInstance->getTotalNumInputChannels());+ pluginInstance->getTotalNumOutputChannels());for (size_t i = 0; i < outputBlock.getNumChannels(); i++) {channelPointers[i] = outputBlock.getChannelPointer(i);@@ -807,7 +872,7 @@ public:i++) {std::vector<float> dummyChannel(outputBlock.getNumSamples());channelPointers[i] = dummyChannel.data();- dummyChannels.push_back(dummyChannel);+ dummyChannels.push_back(std::move(dummyChannel));}// Create an audio buffer that doesn't actually allocate anything, but@@ -830,6 +895,73 @@ public:return 0;}+ py::array_t<float> renderMIDIMessages(py::object midiMessages, float duration,+ float sampleRate,+ unsigned int numChannels,+ unsigned long bufferSize, bool reset) {+ py::array_t<float> outputArray;++ unsigned long outputSampleCount = duration * sampleRate;++ if (pluginInstance) {+ if (reset)+ this->reset();++ juce::dsp::ProcessSpec spec;+ spec.sampleRate = sampleRate;+ spec.maximumBlockSize = (juce::uint32)bufferSize;+ spec.numChannels = (juce::uint32)numChannels;+ prepare(spec);++ if ((size_t)pluginInstance->getMainBusNumOutputChannels() !=+ numChannels) {+ throw std::invalid_argument(+ "Plugin '" + pluginInstance->getName().toStdString() ++ "' produces " ++ std::to_string(pluginInstance->getMainBusNumOutputChannels()) ++ "-channel output, but " + std::to_string(numChannels) ++ " channels of output were requested.");+ }++ juce::MidiBuffer midiInputBuffer =+ parseMidiBufferFromPython(midiMessages, sampleRate);++ outputArray =+ py::array_t<float>({numChannels, (unsigned int)outputSampleCount});++ float *outputArrayPointer =+ static_cast<float *>(outputArray.request().ptr);++ std::memset((void *)outputArrayPointer, 0,+ sizeof(float) * numChannels * outputSampleCount);++ py::gil_scoped_release release;++ for (unsigned long i = 0; i < outputSampleCount; i += bufferSize) {+ unsigned long chunkSampleCount =+ std::min((unsigned long)bufferSize, outputSampleCount - i);++ std::vector<float *> channelPointers(numChannels);+ for (size_t c = 0; c < numChannels; c++) {+ channelPointers[c] =+ (outputArrayPointer + (outputSampleCount * c) + i);+ }++ // Create an audio buffer that doesn't actually allocate anything, but+ // just points to the data in the output array.+ juce::AudioBuffer<float> audioChunk(+ channelPointers.data(), channelPointers.size(), chunkSampleCount);++ juce::MidiBuffer midiChunk;+ midiChunk.addEvents(midiInputBuffer, i, chunkSampleCount, 0);++ pluginInstance->processBlock(audioChunk, midiChunk);+ }+ }++ return outputArray;+ }+std::vector<juce::AudioProcessorParameter *> getParameters() const {std::vector<juce::AudioProcessorParameter *> parameters;for (auto *parameter : pluginInstance->getParameters()) {@@ -853,6 +985,10 @@ public:return pluginInstance->getLatencySamples();}+ virtual bool acceptsAudioInput() override {+ return pluginInstance && pluginInstance->getMainBusNumInputChannels() > 0;+ }+void showEditor() {if (!pluginInstance) {throw std::runtime_error(@@ -1064,7 +1200,53 @@ inline void init_external_plugins(py::module &m) {"Show the UI of this plugin as a native window. This method ""will ""block until the window is closed or a KeyboardInterrupt is "- "received.");+ "received.")+ .def(+ "__call__",+ [](std::shared_ptr<Plugin> self, const py::array inputArray,+ double sampleRate, unsigned int bufferSize, bool reset) {+ return process(inputArray, sampleRate, {self}, bufferSize, reset);+ },+ R"(+Run a 32-bit or 64-bit floating point audio buffer through this plugin.+(If calling this multiple times with multiple plugins, consider creating a+:class:`pedalboard.Pedalboard` object instead.)++The returned array may contain up to (but not more than) the same number of+samples as were provided. If fewer samples were returned than expected, the+plugin has likely buffered audio inside itself. To receive the remaining+audio, pass another audio buffer into ``process`` with ``reset`` set to+``True``.++If the provided buffer uses a 64-bit datatype, it will be converted to 32-bit+for processing.++The provided ``buffer_size`` argument will be used to control the size of+each chunk of audio provided to the plugin. Higher buffer sizes may speed up+processing at the expense of memory usage.++The ``reset`` flag determines if all of the plugins should be reset before+processing begins, clearing any state from previous calls to ``process``.+If calling ``process`` multiple times while processing the same audio file+or buffer, set ``reset`` to ``False``.++.. note::+ The :py:meth:`process` method can also be used via :py:meth:`__call__`;+ i.e.: just calling this object like a function (``my_plugin(...)``) will+ automatically invoke :py:meth:`process` with the same arguments.++ )",+ py::arg("input_array"), py::arg("sample_rate"),+ py::arg("buffer_size") = DEFAULT_BUFFER_SIZE, py::arg("reset") = true)+ .def(+ "__call__",+ &ExternalPlugin<juce::VST3PluginFormat>::renderMIDIMessages,+ "Pass MIDI messages into this plugin to render audio. Only supported "+ "if this plugin is an instrument plugin, rather than an effect.",+ py::arg("midi_messages"), py::arg("duration"), py::arg("sample_rate"),+ py::arg("num_channels") = 2,+ py::arg("buffer_size") = DEFAULT_BUFFER_SIZE,+ py::arg("reset") = true);#endif#if JUCE_PLUGINHOST_AU && JUCE_MAC@@ -1129,7 +1311,53 @@ inline void init_external_plugins(py::module &m) {&ExternalPlugin<juce::AudioUnitPluginFormat>::showEditor,"Show the UI of this plugin as a native window. This method will ""block until the window is closed or a KeyboardInterrupt is "- "received.");+ "received.")+ .def(+ "__call__",+ [](std::shared_ptr<Plugin> self, const py::array inputArray,+ double sampleRate, unsigned int bufferSize, bool reset) {+ return process(inputArray, sampleRate, {self}, bufferSize, reset);+ },+ R"(+Run a 32-bit or 64-bit floating point audio buffer through this plugin.+(If calling this multiple times with multiple plugins, consider creating a+:class:`pedalboard.Pedalboard` object instead.)++The returned array may contain up to (but not more than) the same number of+samples as were provided. If fewer samples were returned than expected, the+plugin has likely buffered audio inside itself. To receive the remaining+audio, pass another audio buffer into ``process`` with ``reset`` set to+``True``.++If the provided buffer uses a 64-bit datatype, it will be converted to 32-bit+for processing.++The provided ``buffer_size`` argument will be used to control the size of+each chunk of audio provided to the plugin. Higher buffer sizes may speed up+processing at the expense of memory usage.++The ``reset`` flag determines if all of the plugins should be reset before+processing begins, clearing any state from previous calls to ``process``.+If calling ``process`` multiple times while processing the same audio file+or buffer, set ``reset`` to ``False``.++.. note::+ The :py:meth:`process` method can also be used via :py:meth:`__call__`;+ i.e.: just calling this object like a function (``my_plugin(...)``) will+ automatically invoke :py:meth:`process` with the same arguments.++ )",+ py::arg("input_array"), py::arg("sample_rate"),+ py::arg("buffer_size") = DEFAULT_BUFFER_SIZE, py::arg("reset") = true)+ .def(+ "__call__",+ &ExternalPlugin<juce::AudioUnitPluginFormat>::renderMIDIMessages,+ "Pass MIDI messages into this plugin to render audio. Only supported "+ "if this plugin is an instrument plugin, rather than an effect.",+ py::arg("midi_messages"), py::arg("duration"), py::arg("sample_rate"),+ py::arg("num_channels") = 1,+ py::arg("buffer_size") = DEFAULT_BUFFER_SIZE,+ py::arg("reset") = true);#endif}diff --git a/pedalboard/Plugin.h b/pedalboard/Plugin.hindex 9ad7d7d..dfe6c85 100644--- a/pedalboard/Plugin.h+++ b/pedalboard/Plugin.h@@ -72,6 +72,11 @@ public:*/virtual int getLatencyHint() { return 0; }+ /**+ * Returns true iff this plugin accepts audio input (i.e.: is an effect).+ */+ virtual bool acceptsAudioInput() { return true; }+// A mutex to gate access to this plugin, as its internals may not be// thread-safe. Note: use std::lock or std::scoped_lock when locking multiple// plugins to avoid deadlocking.diff --git a/pedalboard/PluginContainer.h b/pedalboard/PluginContainer.hindex 7386616..d342fdf 100644--- a/pedalboard/PluginContainer.h+++ b/pedalboard/PluginContainer.h@@ -29,8 +29,31 @@ namespace Pedalboard {*/class PluginContainer : public Plugin {public:- PluginContainer(std::vector<std::shared_ptr<Plugin>> plugins)- : plugins(plugins) {}+ PluginContainer(std::vector<std::shared_ptr<Plugin>> _plugins) {+ std::vector<std::shared_ptr<Plugin>> nonEffectPlugins;+ for (std::shared_ptr<Plugin> plugin : _plugins) {+ if (plugin && !plugin->acceptsAudioInput()) {+ nonEffectPlugins.push_back(plugin);+ }+ }++ if (!nonEffectPlugins.empty()) {+ std::string number = nonEffectPlugins.size() == 1 ? "One" : "Some";+ std::string description =+ nonEffectPlugins.size() == 1+ ? "is an instrument plugin, which does not accept"+ : "are instrument plugins, which do not accept";+ throw std::domain_error(number + " of the " ++ std::to_string(nonEffectPlugins.size()) ++ " provided plugins " + description ++ " audio input. Instrument plugins cannot be "+ "added to Pedalboard, Mix, "+ "or Chain objects.");+ }++ plugins = _plugins;+ }+virtual ~PluginContainer(){};std::vector<std::shared_ptr<Plugin>> &getPlugins() { return plugins; }@@ -102,6 +125,14 @@ inline void init_plugin_container(py::module &m) {throw py::index_error("index out of range");if (i >= s.getPlugins().size())throw py::index_error("index out of range");++ if (plugin && !plugin->acceptsAudioInput()) {+ throw std::domain_error(+ "Provided plugin is an instrument plugin "+ "that does not accept audio input. Instrument plugins cannot "+ "be added to Pedalboard, Mix, or Chain objects.");+ }+s.getPlugins()[i] = plugin;},py::arg("index"), py::arg("plugin"),@@ -140,6 +171,14 @@ inline void init_plugin_container(py::module &m) {throw py::index_error("index out of range");if (i > s.getPlugins().size())throw py::index_error("index out of range");++ if (plugin && !plugin->acceptsAudioInput()) {+ throw std::domain_error(+ "Provided plugin is an instrument plugin "+ "that does not accept audio input. Instrument plugins cannot "+ "be added to Pedalboard, Mix, or Chain objects.");+ }+auto &plugins = s.getPlugins();plugins.insert(plugins.begin() + i, plugin);},@@ -149,6 +188,14 @@ inline void init_plugin_container(py::module &m) {"append",[](PluginContainer &s, std::shared_ptr<Plugin> plugin) {std::scoped_lock lock(s.mutex);++ if (plugin && !plugin->acceptsAudioInput()) {+ throw std::domain_error(+ "Provided plugin is an instrument plugin "+ "that does not accept audio input. Instrument plugins cannot "+ "be added to Pedalboard, Mix, or Chain objects.");+ }+s.getPlugins().push_back(plugin);},py::arg("plugin"), "Append a plugin to the end of this container.")diff --git a/pedalboard/midi_utils.py b/pedalboard/midi_utils.pynew file mode 100644index 0000000..fd9da66--- /dev/null+++ b/pedalboard/midi_utils.py@@ -0,0 +1,59 @@+#! /usr/bin/env python+#+# Copyright 2023 Spotify AB+#+# Licensed under the GNU Public License, Version 3.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# https://www.gnu.org/licenses/gpl-3.0.html+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.++from typing import List, Tuple, Union+++def parse_midi_message_part(byte: Union[int, str, bytes]) -> int:+ if isinstance(byte, int):+ return byte+ elif isinstance(byte, bytes):+ if len(byte) == 1:+ return byte[0]+ else:+ raise NotImplementedError("Not sure how to interpret provided MIDI message.")+ elif isinstance(byte, str):+ try:+ return int(byte)+ except ValueError as e:+ raise NotImplementedError("Not sure how to interpret provided MIDI message.") from e+ raise NotImplementedError("MIDI messages must currently be bytes or lists of byte values.")+++def parse_midi_message_string(midi_message_string: str) -> bytes:+ raise NotImplementedError("MIDI messages must currently be bytes or lists of byte values.")+++def normalize_midi_messages(_input) -> List[Tuple[bytes, float]]:+ """+ Given a duck-typed Python input, usually an iterable of MIDI messages,+ normalize the input to a list of tuples of bytes which can be converted+ into a juce::MidiBuffer on the C++ side.+ """+ output = []+ for message in _input:+ if hasattr(message, "bytes") and hasattr(message, "time"):+ output.append((bytes(message.bytes()), message.time))+ elif (isinstance(message, tuple) or isinstance(message, list)) and len(message) == 2:+ message, time = message+ if isinstance(message, str):+ message = parse_midi_message_string(message)+ if isinstance(message, list):+ message = bytes([parse_midi_message_part(x) for x in message])+ elif not isinstance(message, bytes):+ message = bytes(message)+ output.append((message, time))+ return outputdiff --git a/pedalboard/process.h b/pedalboard/process.hindex 41794c1..52e8833 100644--- a/pedalboard/process.h+++ b/pedalboard/process.h@@ -23,6 +23,7 @@#include "BufferUtils.h"#include "Plugin.h"+#include "PluginContainer.h"namespace py = pybind11;diff --git a/pedalboard/python_bindings.cpp b/pedalboard/python_bindings.cppindex cefa992..0416bdd 100644--- a/pedalboard/python_bindings.cpp+++ b/pedalboard/python_bindings.cpp@@ -73,11 +73,11 @@ using namespace Pedalboard;PYBIND11_MODULE(pedalboard_native, m) {m.doc() =- ("This module provides classes and functions for adding effects to "- "audio. Most classes in this module are subclasses of ``Plugin``, each "- "of which allows applying effects to an audio buffer or stream.\n\nFor "- "audio I/O classes (i.e.: reading and writing audio files), see "- "``pedalboard.io``.");+ ("This module provides classes and functions for generating and adding "+ "effects to audio. Most classes in this module are subclasses of "+ "``Plugin``, each of which allows applying effects to an audio buffer "+ "or stream.\n\nFor audio I/O classes (i.e.: reading and writing audio "+ "files), see ``pedalboard.io``.");auto plugin = py::class_<Plugin, std::shared_ptr<Plugin>>(m, "Plugin",@@ -170,8 +170,21 @@ or buffer, set ``reset`` to ``False``."Run an audio buffer through this plugin. Alias for "":py:meth:`process`.",py::arg("input_array"), py::arg("sample_rate"),- py::arg("buffer_size") = DEFAULT_BUFFER_SIZE,- py::arg("reset") = true);+ py::arg("buffer_size") = DEFAULT_BUFFER_SIZE, py::arg("reset") = true)+ .def_property_readonly(+ "is_effect",+ [](std::shared_ptr<Plugin> self) {+ return self->acceptsAudioInput();+ },+ "True iff this plugin is an audio effect (i.e.: accepts audio "+ "input.)")+ .def_property_readonly(+ "is_instrument",+ [](std::shared_ptr<Plugin> self) {+ return !self->acceptsAudioInput();+ },+ "True iff this plugin is not an audio effect (i.e.: accepts only "+ "MIDI input, not audio.)");init_plugin_container(m);diff --git a/test-requirements.txt b/test-requirements.txtindex c2f98e3..c1c6684 100644--- a/test-requirements.txt+++ b/test-requirements.txt@@ -28,3 +28,6 @@ docutils==0.19; python_version > '3.6'm2r2==0.3.3; python_version > '3.6'furo==2022.9.29; python_version > '3.6'sphinxext-opengraph==0.7.3; python_version > '3.6'++# For MIDI support - only in test though!+mido\ No newline at end of filediff --git a/tests/plugins/Linux/CHOWTapeModel.vst3/Contents/x86_64-linux/CHOWTapeModel.so b/tests/plugins/Linux/CHOWTapeModel.vst3/Contents/x86_64-linux/CHOWTapeModel.sodeleted file mode 100755index 7b2ebbc..0000000Binary files a/tests/plugins/Linux/CHOWTapeModel.vst3/Contents/x86_64-linux/CHOWTapeModel.so and /dev/null differdiff --git a/tests/plugins/Darwin/CHOWTapeModel.component/Contents/Info.plist b/tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/Info.plistsimilarity index 100%rename from tests/plugins/Darwin/CHOWTapeModel.component/Contents/Info.plistrename to tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/Info.plistdiff --git a/tests/plugins/Darwin/CHOWTapeModel.component/Contents/MacOS/CHOWTapeModel b/tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/MacOS/CHOWTapeModelsimilarity index 100%rename from tests/plugins/Darwin/CHOWTapeModel.component/Contents/MacOS/CHOWTapeModelrename to tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/MacOS/CHOWTapeModeldiff --git a/tests/plugins/Darwin/CHOWTapeModel.component/Contents/PkgInfo b/tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/PkgInfosimilarity index 100%rename from tests/plugins/Darwin/CHOWTapeModel.component/Contents/PkgInforename to tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/PkgInfodiff --git a/tests/plugins/Darwin/CHOWTapeModel.component/Contents/Resources/CHOWTapeModel.rsrc b/tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/Resources/CHOWTapeModel.rsrcsimilarity index 100%rename from tests/plugins/Darwin/CHOWTapeModel.component/Contents/Resources/CHOWTapeModel.rsrcrename to tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/Resources/CHOWTapeModel.rsrcdiff --git a/tests/plugins/Darwin/CHOWTapeModel.component/Contents/Resources/Icon.icns b/tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/Resources/Icon.icnssimilarity index 100%rename from tests/plugins/Darwin/CHOWTapeModel.component/Contents/Resources/Icon.icnsrename to tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/Resources/Icon.icnsdiff --git a/tests/plugins/Darwin/CHOWTapeModel.component/Contents/_CodeSignature/CodeResources b/tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/_CodeSignature/CodeResourcessimilarity index 100%rename from tests/plugins/Darwin/CHOWTapeModel.component/Contents/_CodeSignature/CodeResourcesrename to tests/plugins/effect/Darwin/CHOWTapeModel.component/Contents/_CodeSignature/CodeResourcesdiff --git a/tests/plugins/Darwin/CHOWTapeModel.vst3/Contents/Info.plist b/tests/plugins/effect/Darwin/CHOWTapeModel.vst3/Contents/Info.plistsimilarity index 100%rename from tests/plugins/Darwin/CHOWTapeModel.vst3/Contents/Info.plistrename to tests/plugins/effect/Darwin/CHOWTapeModel.vst3/Contents/Info.plistdiff --git a/tests/plugins/Darwin/CHOWTapeModel.vst3/Contents/MacOS/CHOWTapeModel b/tests/plugins/effect/Darwin/CHOWTapeModel.vst3/Contents/MacOS/CHOWTapeModelsimilarity index 100%rename from tests/plugins/Darwin/CHOWTapeModel.vst3/Contents/MacOS/CHOWTapeModelrename to tests/plugins/effect/Darwin/CHOWTapeModel.vst3/Contents/MacOS/CHOWTapeModeldiff --git a/tests/plugins/Darwin/CHOWTapeModel.vst3/Contents/PkgInfo b/tests/plugins/effect/Darwin/CHOWTapeModel.vst3/Contents/PkgInfosimilarity index 100%rename from tests/plugins/Darwin/CHOWTapeModel.vst3/Contents/PkgInforename to tests/plugins/effect/Darwin/CHOWTapeModel.vst3/Contents/PkgInfodiff --git a/tests/plugins/Darwin/CHOWTapeModel.vst3/Contents/Resources/Icon.icns b/tests/plugins/effect/Darwin/CHOWTapeModel.vst3/Contents/Resources/Icon.icnssimilarity index 100%rename from tests/plugins/Darwin/CHOWTapeModel.vst3/Contents/Resources/Icon.icnsrename to tests/plugins/effect/Darwin/CHOWTapeModel.vst3/Contents/Resources/Icon.icnsdiff --git a/tests/plugins/Darwin/CHOWTapeModel.vst3/Contents/_CodeSignature/CodeResources b/tests/plugins/effect/Darwin/CHOWTapeModel.vst3/Contents/_CodeSignature/CodeResourcessimilarity index 100%rename from tests/plugins/Darwin/CHOWTapeModel.vst3/Contents/_CodeSignature/CodeResourcesrename to tests/plugins/effect/Darwin/CHOWTapeModel.vst3/Contents/_CodeSignature/CodeResourcesdiff --git a/tests/plugins/Windows/CHOWTapeModel.vst3 b/tests/plugins/effect/Windows/CHOWTapeModel.vst3similarity index 100%rename from tests/plugins/Windows/CHOWTapeModel.vst3rename to tests/plugins/effect/Windows/CHOWTapeModel.vst3diff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/CodeResources b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/CodeResourcesnew file mode 100644index 0000000..fdadfa6Binary files /dev/null and b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/CodeResources differdiff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Info.plist b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Info.plistnew file mode 100644index 0000000..7e15bcf--- /dev/null+++ b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Info.plist@@ -0,0 +1,73 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>AudioComponents</key>+ <array>+ <dict>+ <key>description</key>+ <string>8bit sound generator 2nd ver. by YMCK</string>+ <key>factoryFunction</key>+ <string>Magical8bitPlug2AUFactory</string>+ <key>manufacturer</key>+ <string>Ymck</string>+ <key>name</key>+ <string>Ymck: Magical 8bit Plug 2</string>+ <key>sandboxSafe</key>+ <true/>+ <key>subtype</key>+ <string>synj</string>+ <key>type</key>+ <string>aumu</string>+ <key>version</key>+ <integer>65537</integer>+ </dict>+ </array>+ <key>BuildMachineOSBuild</key>+ <string>19H1030</string>+ <key>CFBundleDisplayName</key>+ <string>Magical8bitPlug2</string>+ <key>CFBundleExecutable</key>+ <string>Magical8bitPlug2</string>+ <key>CFBundleIconFile</key>+ <string>Icon.icns</string>+ <key>CFBundleIdentifier</key>+ <string>com.ymck.magical8bitPlug2Juce</string>+ <key>CFBundleName</key>+ <string>Magical8bitPlug2</string>+ <key>CFBundlePackageType</key>+ <string>BNDL</string>+ <key>CFBundleShortVersionString</key>+ <string>1.0.1</string>+ <key>CFBundleSignature</key>+ <string>????</string>+ <key>CFBundleSupportedPlatforms</key>+ <array>+ <string>MacOSX</string>+ </array>+ <key>CFBundleVersion</key>+ <string>1.0.1</string>+ <key>DTCompiler</key>+ <string>com.apple.compilers.llvm.clang.1_0</string>+ <key>DTPlatformBuild</key>+ <string>12D4e</string>+ <key>DTPlatformName</key>+ <string>macosx</string>+ <key>DTPlatformVersion</key>+ <string>11.1</string>+ <key>DTSDKBuild</key>+ <string>20C63</string>+ <key>DTSDKName</key>+ <string>macosx11.1</string>+ <key>DTXcode</key>+ <string>1240</string>+ <key>DTXcodeBuild</key>+ <string>12D4e</string>+ <key>LSMinimumSystemVersion</key>+ <string>10.11</string>+ <key>NSHighResolutionCapable</key>+ <true/>+ <key>NSHumanReadableCopyright</key>+ <string></string>+</dict>+</plist>diff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/MacOS/Magical8bitPlug2 b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/MacOS/Magical8bitPlug2new file mode 100755index 0000000..94a93eeBinary files /dev/null and b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/MacOS/Magical8bitPlug2 differdiff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/PkgInfo b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/PkgInfonew file mode 100644index 0000000..19a9cf6--- /dev/null+++ b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/PkgInfo@@ -0,0 +1 @@+BNDL????\ No newline at end of filediff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Resources/Icon.icns b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Resources/Icon.icnsnew file mode 100644index 0000000..655901aBinary files /dev/null and b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Resources/Icon.icns differdiff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Resources/Magical8bitPlug2.rsrc b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Resources/Magical8bitPlug2.rsrcnew file mode 100644index 0000000..d0a2644Binary files /dev/null and b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Resources/Magical8bitPlug2.rsrc differdiff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Resources/RecentFilesMenuTemplate.nib b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Resources/RecentFilesMenuTemplate.nibnew file mode 100644index 0000000..cec7f7cBinary files /dev/null and b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/Resources/RecentFilesMenuTemplate.nib differdiff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/_CodeSignature/CodeResources b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/_CodeSignature/CodeResourcesnew file mode 100644index 0000000..8bbe065--- /dev/null+++ b/tests/plugins/instrument/Darwin/Magical8bitPlug2.component/Contents/_CodeSignature/CodeResources@@ -0,0 +1,162 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>files</key>+ <dict>+ <key>Resources/Icon.icns</key>+ <data>+ Mn+X8v6ho5YDIz4t4XfIgUvFOhU=+ </data>+ <key>Resources/Magical8bitPlug2.rsrc</key>+ <data>+ EZd2k1nJjI3bIPpZJHnSY8Fn6XU=+ </data>+ <key>Resources/RecentFilesMenuTemplate.nib</key>+ <data>+ 4cEN55flubpq9bxeGSBG3zMPYQw=+ </data>+ </dict>+ <key>files2</key>+ <dict>+ <key>Resources/Icon.icns</key>+ <dict>+ <key>hash</key>+ <data>+ Mn+X8v6ho5YDIz4t4XfIgUvFOhU=+ </data>+ <key>hash2</key>+ <data>+ jc9Qxds/CM/cNc+08tYwuwZRaAAhvMpGMgyfsDkg4mc=+ </data>+ </dict>+ <key>Resources/Magical8bitPlug2.rsrc</key>+ <dict>+ <key>hash</key>+ <data>+ EZd2k1nJjI3bIPpZJHnSY8Fn6XU=+ </data>+ <key>hash2</key>+ <data>+ I1YKv3rKXtcMb4TqYY/oysMLKdQqMQ0dodf6EgCCbvA=+ </data>+ </dict>+ <key>Resources/RecentFilesMenuTemplate.nib</key>+ <dict>+ <key>hash</key>+ <data>+ 4cEN55flubpq9bxeGSBG3zMPYQw=+ </data>+ <key>hash2</key>+ <data>+ cY60xaOlVk3YMq6aNs9knz7yV86JbdkhaT7rYQG9AIo=+ </data>+ </dict>+ </dict>+ <key>rules</key>+ <dict>+ <key>^Resources/</key>+ <true/>+ <key>^Resources/.*\.lproj/</key>+ <dict>+ <key>optional</key>+ <true/>+ <key>weight</key>+ <real>1000</real>+ </dict>+ <key>^Resources/.*\.lproj/locversion.plist$</key>+ <dict>+ <key>omit</key>+ <true/>+ <key>weight</key>+ <real>1100</real>+ </dict>+ <key>^Resources/Base\.lproj/</key>+ <dict>+ <key>weight</key>+ <real>1010</real>+ </dict>+ <key>^version.plist$</key>+ <true/>+ </dict>+ <key>rules2</key>+ <dict>+ <key>.*\.dSYM($|/)</key>+ <dict>+ <key>weight</key>+ <real>11</real>+ </dict>+ <key>^(.*/)?\.DS_Store$</key>+ <dict>+ <key>omit</key>+ <true/>+ <key>weight</key>+ <real>2000</real>+ </dict>+ <key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>+ <dict>+ <key>nested</key>+ <true/>+ <key>weight</key>+ <real>10</real>+ </dict>+ <key>^.*</key>+ <true/>+ <key>^Info\.plist$</key>+ <dict>+ <key>omit</key>+ <true/>+ <key>weight</key>+ <real>20</real>+ </dict>+ <key>^PkgInfo$</key>+ <dict>+ <key>omit</key>+ <true/>+ <key>weight</key>+ <real>20</real>+ </dict>+ <key>^Resources/</key>+ <dict>+ <key>weight</key>+ <real>20</real>+ </dict>+ <key>^Resources/.*\.lproj/</key>+ <dict>+ <key>optional</key>+ <true/>+ <key>weight</key>+ <real>1000</real>+ </dict>+ <key>^Resources/.*\.lproj/locversion.plist$</key>+ <dict>+ <key>omit</key>+ <true/>+ <key>weight</key>+ <real>1100</real>+ </dict>+ <key>^Resources/Base\.lproj/</key>+ <dict>+ <key>weight</key>+ <real>1010</real>+ </dict>+ <key>^[^/]+$</key>+ <dict>+ <key>nested</key>+ <true/>+ <key>weight</key>+ <real>10</real>+ </dict>+ <key>^embedded\.provisionprofile$</key>+ <dict>+ <key>weight</key>+ <real>20</real>+ </dict>+ <key>^version\.plist$</key>+ <dict>+ <key>weight</key>+ <real>20</real>+ </dict>+ </dict>+</dict>+</plist>diff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/CodeResources b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/CodeResourcesnew file mode 100644index 0000000..4ab4e86Binary files /dev/null and b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/CodeResources differdiff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/Info.plist b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/Info.plistnew file mode 100644index 0000000..826aca9--- /dev/null+++ b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/Info.plist@@ -0,0 +1,52 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>BuildMachineOSBuild</key>+ <string>19H1030</string>+ <key>CFBundleDisplayName</key>+ <string>Magical8bitPlug2</string>+ <key>CFBundleExecutable</key>+ <string>Magical8bitPlug2</string>+ <key>CFBundleIconFile</key>+ <string>Icon.icns</string>+ <key>CFBundleIdentifier</key>+ <string>com.ymck.magical8bitPlug2Juce</string>+ <key>CFBundleName</key>+ <string>Magical8bitPlug2</string>+ <key>CFBundlePackageType</key>+ <string>BNDL</string>+ <key>CFBundleShortVersionString</key>+ <string>1.0.1</string>+ <key>CFBundleSignature</key>+ <string>????</string>+ <key>CFBundleSupportedPlatforms</key>+ <array>+ <string>MacOSX</string>+ </array>+ <key>CFBundleVersion</key>+ <string>1.0.1</string>+ <key>DTCompiler</key>+ <string>com.apple.compilers.llvm.clang.1_0</string>+ <key>DTPlatformBuild</key>+ <string>12D4e</string>+ <key>DTPlatformName</key>+ <string>macosx</string>+ <key>DTPlatformVersion</key>+ <string>11.1</string>+ <key>DTSDKBuild</key>+ <string>20C63</string>+ <key>DTSDKName</key>+ <string>macosx11.1</string>+ <key>DTXcode</key>+ <string>1240</string>+ <key>DTXcodeBuild</key>+ <string>12D4e</string>+ <key>LSMinimumSystemVersion</key>+ <string>10.11</string>+ <key>NSHighResolutionCapable</key>+ <true/>+ <key>NSHumanReadableCopyright</key>+ <string></string>+</dict>+</plist>diff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/MacOS/Magical8bitPlug2 b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/MacOS/Magical8bitPlug2new file mode 100755index 0000000..01a977aBinary files /dev/null and b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/MacOS/Magical8bitPlug2 differdiff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/PkgInfo b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/PkgInfonew file mode 100644index 0000000..19a9cf6--- /dev/null+++ b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/PkgInfo@@ -0,0 +1 @@+BNDL????\ No newline at end of filediff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/Resources/Icon.icns b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/Resources/Icon.icnsnew file mode 100644index 0000000..655901aBinary files /dev/null and b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/Resources/Icon.icns differdiff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/Resources/RecentFilesMenuTemplate.nib b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/Resources/RecentFilesMenuTemplate.nibnew file mode 100644index 0000000..cec7f7cBinary files /dev/null and b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/Resources/RecentFilesMenuTemplate.nib differdiff --git a/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/_CodeSignature/CodeResources b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/_CodeSignature/CodeResourcesnew file mode 100644index 0000000..061ac78--- /dev/null+++ b/tests/plugins/instrument/Darwin/Magical8bitPlug2.vst3/Contents/_CodeSignature/CodeResources@@ -0,0 +1,147 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>files</key>+ <dict>+ <key>Resources/Icon.icns</key>+ <data>+ Mn+X8v6ho5YDIz4t4XfIgUvFOhU=+ </data>+ <key>Resources/RecentFilesMenuTemplate.nib</key>+ <data>+ 4cEN55flubpq9bxeGSBG3zMPYQw=+ </data>+ </dict>+ <key>files2</key>+ <dict>+ <key>Resources/Icon.icns</key>+ <dict>+ <key>hash</key>+ <data>+ Mn+X8v6ho5YDIz4t4XfIgUvFOhU=+ </data>+ <key>hash2</key>+ <data>+ jc9Qxds/CM/cNc+08tYwuwZRaAAhvMpGMgyfsDkg4mc=+ </data>+ </dict>+ <key>Resources/RecentFilesMenuTemplate.nib</key>+ <dict>+ <key>hash</key>+ <data>+ 4cEN55flubpq9bxeGSBG3zMPYQw=+ </data>+ <key>hash2</key>+ <data>+ cY60xaOlVk3YMq6aNs9knz7yV86JbdkhaT7rYQG9AIo=+ </data>+ </dict>+ </dict>+ <key>rules</key>+ <dict>+ <key>^Resources/</key>+ <true/>+ <key>^Resources/.*\.lproj/</key>+ <dict>+ <key>optional</key>+ <true/>+ <key>weight</key>+ <real>1000</real>+ </dict>+ <key>^Resources/.*\.lproj/locversion.plist$</key>+ <dict>+ <key>omit</key>+ <true/>+ <key>weight</key>+ <real>1100</real>+ </dict>+ <key>^Resources/Base\.lproj/</key>+ <dict>+ <key>weight</key>+ <real>1010</real>+ </dict>+ <key>^version.plist$</key>+ <true/>+ </dict>+ <key>rules2</key>+ <dict>+ <key>.*\.dSYM($|/)</key>+ <dict>+ <key>weight</key>+ <real>11</real>+ </dict>+ <key>^(.*/)?\.DS_Store$</key>+ <dict>+ <key>omit</key>+ <true/>+ <key>weight</key>+ <real>2000</real>+ </dict>+ <key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>+ <dict>+ <key>nested</key>+ <true/>+ <key>weight</key>+ <real>10</real>+ </dict>+ <key>^.*</key>+ <true/>+ <key>^Info\.plist$</key>+ <dict>+ <key>omit</key>+ <true/>+ <key>weight</key>+ <real>20</real>+ </dict>+ <key>^PkgInfo$</key>+ <dict>+ <key>omit</key>+ <true/>+ <key>weight</key>+ <real>20</real>+ </dict>+ <key>^Resources/</key>+ <dict>+ <key>weight</key>+ <real>20</real>+ </dict>+ <key>^Resources/.*\.lproj/</key>+ <dict>+ <key>optional</key>+ <true/>+ <key>weight</key>+ <real>1000</real>+ </dict>+ <key>^Resources/.*\.lproj/locversion.plist$</key>+ <dict>+ <key>omit</key>+ <true/>+ <key>weight</key>+ <real>1100</real>+ </dict>+ <key>^Resources/Base\.lproj/</key>+ <dict>+ <key>weight</key>+ <real>1010</real>+ </dict>+ <key>^[^/]+$</key>+ <dict>+ <key>nested</key>+ <true/>+ <key>weight</key>+ <real>10</real>+ </dict>+ <key>^embedded\.provisionprofile$</key>+ <dict>+ <key>weight</key>+ <real>20</real>+ </dict>+ <key>^version\.plist$</key>+ <dict>+ <key>weight</key>+ <real>20</real>+ </dict>+ </dict>+</dict>+</plist>diff --git a/tests/plugins/instrument/Windows/Magical8bitPlug2.vst3 b/tests/plugins/instrument/Windows/Magical8bitPlug2.vst3new file mode 100644index 0000000..5255fd1Binary files /dev/null and b/tests/plugins/instrument/Windows/Magical8bitPlug2.vst3 differdiff --git a/tests/test_external_plugins.py b/tests/test_external_plugins.pyindex e9e6944..fbfa843 100644--- a/tests/test_external_plugins.py+++ b/tests/test_external_plugins.py@@ -27,6 +27,8 @@ import subprocessfrom glob import globfrom pathlib import Path+import mido+from pedalboard._pedalboard import (WrappedBool,strip_common_float_suffixes,@@ -38,21 +40,35 @@ import numpy as npfrom typing import Optional-TEST_PLUGIN_BASE_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "plugins")+TEST_EFFECT_PLUGIN_BASE_PATH = os.path.join(+ os.path.abspath(os.path.dirname(__file__)), "plugins", "effect"+)+TEST_INSTRUMENT_PLUGIN_BASE_PATH = os.path.join(+ os.path.abspath(os.path.dirname(__file__)), "plugins", "instrument"+)TEST_PRESET_BASE_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), "presets")-AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT = [+AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT = [+ os.path.basename(filename)+ for filename in glob(os.path.join(TEST_EFFECT_PLUGIN_BASE_PATH, platform.system(), "*"))+]++AVAILABLE_INSTRUMENT_PLUGINS_IN_TEST_ENVIRONMENT = [os.path.basename(filename)- for filename in glob(os.path.join(TEST_PLUGIN_BASE_PATH, platform.system(), "*"))+ for filename in glob(os.path.join(TEST_INSTRUMENT_PLUGIN_BASE_PATH, platform.system(), "*"))]# Disable Audio Unit tests on GitHub Actions, as the# action container fails to load Audio Units:if os.getenv("CIBW_TEST_REQUIRES") or os.getenv("CI"):- AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT = [- f for f in AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT if "component" not in f+ AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT = [+ f for f in AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT if "component" not in f]+AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT = (+ AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT + AVAILABLE_INSTRUMENT_PLUGINS_IN_TEST_ENVIRONMENT+)+def is_container_plugin(filename: str):for klass in pedalboard._AVAILABLE_PLUGIN_CLASSES:@@ -63,8 +79,10 @@ def is_container_plugin(filename: str):return False-AVAILABLE_CONTAINER_PLUGINS_IN_TEST_ENVIRONMENT = [- filename for filename in AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT if is_container_plugin(filename)+AVAILABLE_CONTAINER_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT = [+ filename+ for filename in AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT+ if is_container_plugin(filename)]@@ -80,6 +98,17 @@ PLUGIN_FILES_TO_DELETE = set()MACOS_PLUGIN_INSTALL_PATH = Path.home() / "Library" / "Audio" / "Plug-Ins" / "Components"+def find_plugin_path(plugin_filename: str) -> str:+ plugin_path = os.path.join(TEST_EFFECT_PLUGIN_BASE_PATH, platform.system(), plugin_filename)+ if not os.path.exists(plugin_path):+ plugin_path = os.path.join(+ TEST_INSTRUMENT_PLUGIN_BASE_PATH, platform.system(), plugin_filename+ )+ if not os.path.exists(plugin_path):+ raise ValueError(f"Failed to find plugin named {plugin_path}!")+ return plugin_path++def load_test_plugin(plugin_filename: str, disable_caching: bool = False, *args, **kwargs):"""Load a plugin file from disk, or use an existing instance to save@@ -91,7 +120,7 @@ def load_test_plugin(plugin_filename: str, disable_caching: bool = False, *args,key = repr((plugin_filename, args, tuple(kwargs.items())))if key not in TEST_PLUGIN_CACHE or disable_caching:- plugin_path = os.path.join(TEST_PLUGIN_BASE_PATH, platform.system(), plugin_filename)+ plugin_path = find_plugin_path(plugin_filename)if platform.system() == "Darwin" and plugin_filename.endswith(".component"):# On macOS, AudioUnit components must be installed in@@ -150,14 +179,14 @@ if os.environ.get("ENABLE_TESTING_WITH_LOCAL_PLUGINS", False):for plugin_path in plugin_class.installed_plugins:try:load_test_plugin(plugin_path)- AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT.append(plugin_path)+ AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT.append(plugin_path)except Exception as e:print(f"Tried to load {plugin_path} for local testing, but failed with: {e}")# Even if the plugin failed to load, add it to# the list of known container plugins if necessary:if is_container_plugin(plugin_path):- AVAILABLE_CONTAINER_PLUGINS_IN_TEST_ENVIRONMENT.append(plugin_path)+ AVAILABLE_CONTAINER_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT.append(plugin_path)def plugin_named(*substrings: str) -> Optional[str]:@@ -166,7 +195,7 @@ def plugin_named(*substrings: str) -> Optional[str]:provided substrings from the list of available test plugins."""for plugin_filename in AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT:- if all([s in plugin_filename for s in substrings]):+ if all([s.lower() in plugin_filename.lower() for s in substrings]):return plugin_filename@@ -175,7 +204,7 @@ def max_volume_of(x: np.ndarray) -> float:def test_at_least_one_plugin_is_available_for_testing():- assert AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT+ assert AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT@pytest.mark.parametrize(@@ -212,7 +241,7 @@ def test_at_least_one_parameter(plugin_filename: str):"plugin_filename,plugin_preset",[(plugin, os.path.join(TEST_PRESET_BASE_PATH, plugin + ".vstpreset"))- for plugin in AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT+ for plugin in AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENTif os.path.isfile(os.path.join(TEST_PRESET_BASE_PATH, plugin + ".vstpreset"))],)@@ -279,15 +308,87 @@ def test_import_error_on_missing_path(loader):loader("./")[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("plugin_filename", AVAILABLE_INSTRUMENT_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("num_channels,sample_rate", [(2, 48000), (2, 44100), (2, 22050)])+ "notes",+ [+ # Accept note-like objects via duck typing:+ [+ mido.Message("note_on", note=100, velocity=3, time=0),+ mido.Message("note_off", note=100, time=5.0),+ ],+ # Accept tuples of MIDI bytes and their timestamps:+ [+ (mido.Message("note_on", note=100, velocity=3).bytes(), 0),+ (mido.Message("note_off", note=100).bytes(), 5),+ ],+ # Accept bytes objects representing MIDI messages, plus their timestamps:+ [+ (bytes(mido.Message("note_on", note=100, velocity=3).bytes()), 0),+ (bytes(mido.Message("note_off", note=100).bytes()), 5),+ ],+ ],+)+def test_instrument_plugin_accepts_notes(+ plugin_filename: str, num_channels: int, sample_rate: float, notes+):+ plugin = load_test_plugin(plugin_filename)+ assert plugin.is_instrument+ assert not plugin.is_effect+ output = plugin(notes, 6.0, sample_rate, num_channels=num_channels)+ assert np.amax(np.abs(output)) > 0++[email protected]("plugin_filename", AVAILABLE_INSTRUMENT_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("num_channels,sample_rate", [(2, 48000), (2, 44100), (2, 22050)])+def test_instrument_plugin_accepts_buffer_size(+ plugin_filename: str, num_channels: int, sample_rate: float+):+ notes = [+ mido.Message("note_on", note=100, velocity=3, time=0),+ mido.Message("note_off", note=100, time=5.0),+ ]+ plugin = load_test_plugin(plugin_filename)+ assert plugin.is_instrument+ assert not plugin.is_effect++ outputs = [+ plugin(notes, 6.0, sample_rate, num_channels=num_channels, buffer_size=buffer_size)+ for buffer_size in [1, 32, 1024]+ ]+ for a, b in zip(outputs, outputs[1:]):+ np.testing.assert_allclose(a, b, atol=0.02)++[email protected]("plugin_filename", AVAILABLE_INSTRUMENT_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("num_channels,sample_rate", [(2, 48000), (2, 44100), (2, 22050)])+def test_instrument_plugin_does_not_accept_audio(+ plugin_filename: str, num_channels: int, sample_rate: float+):+ plugin = load_test_plugin(plugin_filename)+ assert plugin.is_instrument+ assert not plugin.is_effect+ with pytest.raises(ValueError):+ plugin(np.random.rand(num_channels, sample_rate), sample_rate)++[email protected]("plugin_filename", AVAILABLE_INSTRUMENT_PLUGINS_IN_TEST_ENVIRONMENT)+def test_pedalboard_does_not_accept_instruments(plugin_filename: str):+ with pytest.raises(ValueError):+ pedalboard.Pedalboard([load_test_plugin(plugin_filename)])++[email protected]("plugin_filename", AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)@pytest.mark.parametrize("num_channels,sample_rate",[(1, 48000), (2, 48000), (1, 44100), (2, 44100), (1, 22050), (2, 22050)],)-def test_plugin_accepts_variable_channel_count(+def test_effect_plugin_accepts_variable_channel_count(plugin_filename: str, num_channels: int, sample_rate: float):plugin = load_test_plugin(plugin_filename)+ assert plugin.is_effectnoise = np.random.rand(num_channels, sample_rate)try:effected = plugin(noise, sample_rate)@@ -297,8 +398,8 @@ def test_plugin_accepts_variable_channel_count(raise[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)-def test_plugin_accepts_variable_channel_count_without_reloading(plugin_filename: str):[email protected]("plugin_filename", AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)+def test_effect_plugin_accepts_variable_channel_count_without_reloading(plugin_filename: str):plugin = load_test_plugin(plugin_filename)for num_channels, sample_rate in [(1, 48000),@@ -317,7 +418,7 @@ def test_plugin_accepts_variable_channel_count_without_reloading(plugin_filenameraise[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("plugin_filename", AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)def test_all_parameters_are_accessible_as_properties(plugin_filename: str):plugin = load_test_plugin(plugin_filename)assert plugin.parameters@@ -325,7 +426,7 @@ def test_all_parameters_are_accessible_as_properties(plugin_filename: str):assert hasattr(plugin, parameter_name)[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("plugin_filename", AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)def test_parameters_cant_be_assigned_to_directly(plugin_filename: str):plugin = load_test_plugin(plugin_filename)assert plugin.parameters@@ -335,7 +436,7 @@ def test_parameters_cant_be_assigned_to_directly(plugin_filename: str):plugin.parameters[parameter_name] = current_value[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("plugin_filename", AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)def test_all_parameters_have_accessors(plugin_filename: str):plugin = load_test_plugin(plugin_filename)assert plugin.parameters@@ -349,7 +450,7 @@ def test_all_parameters_have_accessors(plugin_filename: str):assert parameter_value.range is not None[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("plugin_filename", AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)def test_attributes_proxy(plugin_filename: str):plugin = load_test_plugin(plugin_filename)@@ -365,7 +466,7 @@ def test_attributes_proxy(plugin_filename: str):"plugin_filename,parameter_name",[(path, parameter)- for path in AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT+ for path in AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENTfor parameter in [k for k, v in get_parameters(path).items() if v.type == bool]],)@@ -390,7 +491,7 @@ def test_bool_parameters(plugin_filename: str, parameter_name: str):"plugin_filename,parameter_name",[(path, parameter)- for path in AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT+ for path in AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENTfor parameter in [k for k, v in get_parameters(path).items() if v.type == bool]],)@@ -404,7 +505,7 @@ def test_bool_parameter_valdation(plugin_filename: str, parameter_name: str):"plugin_filename,parameter_name",[(path, parameter)- for path in AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT+ for path in AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENTfor parameter in [k for k, v in get_parameters(path).items() if v.type == float]],)@@ -443,7 +544,7 @@ def test_float_parameters(plugin_filename: str, parameter_name: str):"plugin_filename,parameter_name",[(path, parameter)- for path in AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT+ for path in AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENTfor parameter in [k for k, v in get_parameters(path).items() if v.type == float]],)@@ -477,7 +578,7 @@ def test_float_parameter_valdation(plugin_filename: str, parameter_name: str):"plugin_filename,parameter_name",[(path, parameter)- for path in AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT+ for path in AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENTfor parameter in [k for k, v in get_parameters(path).items() if v.type == str]],)@@ -502,7 +603,7 @@ def test_str_parameters(plugin_filename: str, parameter_name: str):"plugin_filename,parameter_name",[(path, parameter)- for path in AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT+ for path in AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENTfor parameter in [k for k, v in get_parameters(path).items() if v.type == str]],)@@ -517,7 +618,7 @@ def test_string_parameter_valdation(plugin_filename: str, parameter_name: str):setattr(plugin, parameter_name, "some value not present")[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("plugin_filename", AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)def test_plugin_parameters_persist_between_calls(plugin_filename: str):plugin = load_test_plugin(plugin_filename)sr = 44100@@ -565,7 +666,7 @@ def test_plugin_parameters_persist_between_calls(plugin_filename: str):), f"Expected {name} to match saved value"[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("plugin_filename", AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)def test_plugin_state_cleared_between_invocations_by_default(plugin_filename: str):plugin = load_test_plugin(plugin_filename, disable_caching=True)@@ -582,7 +683,7 @@ def test_plugin_state_cleared_between_invocations_by_default(plugin_filename: stassert max_volume_of(plugin(silence, sr)) < 0.00001[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("plugin_filename", AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)def test_plugin_state_not_cleared_between_invocations_if_reset_is_false(plugin_filename: str):plugin = load_test_plugin(plugin_filename, disable_caching=True)@@ -597,8 +698,8 @@ def test_plugin_state_not_cleared_between_invocations_if_reset_is_false(plugin_fassert 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):[email protected]("plugin_filename", AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)+def test_explicit_effect_reset(plugin_filename: str):plugin = load_test_plugin(plugin_filename, disable_caching=True)sr = 44100@@ -613,7 +714,17 @@ def test_explicit_reset(plugin_filename: str):assert max_volume_of(plugin(silence, sr, reset=False)) < 0.00001[email protected]("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)[email protected](not plugin_named("Magical8BitPlug"), reason="Missing Magical8BitPlug 2 plugin.")+def test_explicit_instrument_reset():+ plugin = load_test_plugin(plugin_named("Magical8BitPlug"), disable_caching=True)+ sr = 44100+ notes = [mido.Message("note_on", note=100, velocity=127, time=0)]+ assert max_volume_of(plugin(notes, 5.0, sr, reset=False)) >= 0.5+ plugin.reset()+ assert max_volume_of(plugin([], 5.0, sr, reset=False)) < 0.00001++[email protected]("plugin_filename", AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)def test_explicit_reset_in_pedalboard(plugin_filename: str):sr = 44100board = pedalboard.Pedalboard([load_test_plugin(plugin_filename, disable_caching=True)])@@ -683,7 +794,7 @@ def test_external_plugin_latency_compensation(buffer_size: int, oversampling: in@pytest.mark.parametrize("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)def test_show_editor(plugin_filename: str):# Run this test in a subprocess, as otherwise we'd block this thread:- full_plugin_filename = os.path.join(TEST_PLUGIN_BASE_PATH, platform.system(), plugin_filename)+ full_plugin_filename = find_plugin_path(plugin_filename)try:subprocess.check_output([@@ -713,10 +824,10 @@ def test_show_editor(plugin_filename: str):@pytest.mark.skipif(- not AVAILABLE_CONTAINER_PLUGINS_IN_TEST_ENVIRONMENT,+ not AVAILABLE_CONTAINER_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT,reason="No plugin containers installed in test environment!",)[email protected]("plugin_filename", AVAILABLE_CONTAINER_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("plugin_filename", AVAILABLE_CONTAINER_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)def test_plugin_container_handling(plugin_filename: str):"""Some plugins can have multiple sub-plugins within them.@@ -741,7 +852,7 @@ def test_plugin_container_handling(plugin_filename: str):@pytest.mark.parametrize("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)def test_get_plugin_name_from_regular_plugin(plugin_filename: str):- plugin_path = os.path.join(TEST_PLUGIN_BASE_PATH, platform.system(), plugin_filename)+ plugin_path = find_plugin_path(plugin_filename)if ".vst3" in plugin_filename:names = pedalboard.VST3Plugin.get_plugin_names_for_file(plugin_path)elif ".component" in plugin_filename:@@ -754,12 +865,12 @@ def test_get_plugin_name_from_regular_plugin(plugin_filename: str):@pytest.mark.skipif(- not AVAILABLE_CONTAINER_PLUGINS_IN_TEST_ENVIRONMENT,+ not AVAILABLE_CONTAINER_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT,reason="No plugin containers installed in test environment!",)[email protected]("plugin_filename", AVAILABLE_CONTAINER_PLUGINS_IN_TEST_ENVIRONMENT)[email protected]("plugin_filename", AVAILABLE_CONTAINER_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT)def test_get_plugin_names_from_container(plugin_filename: str):- plugin_path = os.path.join(TEST_PLUGIN_BASE_PATH, platform.system(), plugin_filename)+ plugin_path = find_plugin_path(plugin_filename)if ".vst3" in plugin_filename:names = pedalboard.VST3Plugin.get_plugin_names_for_file(plugin_path)elif ".component" in plugin_filename:diff --git a/tests/test_midi_utils.py b/tests/test_midi_utils.pynew file mode 100644index 0000000..82e457a--- /dev/null+++ b/tests/test_midi_utils.py@@ -0,0 +1,38 @@+#! /usr/bin/env python+#+# Copyright 2023 Spotify AB+#+# Licensed under the GNU Public License, Version 3.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# https://www.gnu.org/licenses/gpl-3.0.html+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.++from typing import List, Tuple++import mido+import pytest++from pedalboard.midi_utils import normalize_midi_messages+++ "_input,expected",+ [+ (+ [+ mido.Message("note_on", note=100, velocity=3, time=0),+ mido.Message("note_off", note=100, time=5.0),+ ],+ [(bytes([144, 100, 3]), 0.0), (bytes([128, 100, 64]), 5.0)],+ )+ ],+)+def test_mido_normalization(_input, expected: List[Tuple[bytes, float]]):+ assert normalize_midi_messages(_input) == expected