spotify / pedalboard

🎛 🔊 A Python library for audio.
https://spotify.github.io/pedalboard
GNU General Public License v3.0
4.96k stars 249 forks source link

Segmentation fault (usually) when loading Spectrasonics VST3 plugins #346

Open kmontag opened 4 days ago

kmontag commented 4 days ago

Most of the time, loading Spectrasonics' Omnisphere or Keyscape VST3 plugins (and possibly others, those are just the ones I have on my system) causes a segmentation fault:

$ python -c "import pedalboard; pedalboard.load_plugin('/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3')"
zsh: segmentation fault  python -c

This happens maybe 9 out of 10 times when running the command above. The rest of the time, the plugin simply loads without issue.

Possibly related: the AU variants don't throw segmentation faults, but they do print repeated JUCE Assertion failure in juce_AudioSampleBuffer.h:340 errors.

The segfault appears to happen when calling editController->getParameterCount() during plugin initialization. Here's an LLDB session (using a debug build from the latest master) with more detailed information:

lldb session with full backtrace ```bash $ lldb -- python -c "import pedalboard; pedalboard.load_plugin('/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3')" (lldb) target create "python" Current executable set to '[redacted]/python' (arm64). (lldb) settings set -- target.run-args "-c" "import pedalboard; pedalboard.load_plugin('/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3')" (lldb) r Process 57555 launched: '[redacted]/python' (arm64) Process 57555 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x180) frame #0: 0x0000000110123cc0 Omnisphere`___lldb_unnamed_symbol4997 + 12 Omnisphere`___lldb_unnamed_symbol4997: -> 0x110123cc0 <+12>: ldr x1, [x8, #0x180] 0x110123cc4 <+16>: br x1 0x110123cc8 <+20>: ret Omnisphere`___lldb_unnamed_symbol4998: 0x110123ccc <+0>: ldr x0, [x0, #0xe0] (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x180) * frame #0: 0x0000000110123cc0 Omnisphere`___lldb_unnamed_symbol4997 + 12 frame #1: 0x00000001054b9600 pedalboard_native.cpython-312-darwin.so`juce::getAllParamIDs(controller=0x0000000141f69e30) at juce_PatchedVST3PluginFormat.cpp:212:27 frame #2: 0x00000001054a54f0 pedalboard_native.cpython-312-darwin.so`juce::PatchedVST3PluginInstance::refreshParameterList(this=0x0000000142c3e000) at juce_PatchedVST3PluginFormat.cpp:3120:21 frame #3: 0x00000001054d1c14 pedalboard_native.cpython-312-darwin.so`juce::PatchedVST3PluginInstance::initialise(this=0x000000016fdfcba8)::'lambda'()::operator()() const at juce_PatchedVST3PluginFormat.cpp:2269:7 frame #4: 0x000000010549aacc pedalboard_native.cpython-312-darwin.so`juce::PatchedVST3PluginInstance::initialise(this=0x0000000142c3e000) at juce_PatchedVST3PluginFormat.cpp:2274:5 frame #5: 0x000000010549a3b0 pedalboard_native.cpython-312-darwin.so`juce::PatchedVST3PluginFormat::createPluginInstance(this=0x0000600002de7720, description=0x0000000141f3c138, (null)=44100, (null)=8192, callback=juce::AudioPluginFormat::PluginCreationCallback @ 0x000000016fdfcde8) at juce_PatchedVST3PluginFormat.cpp:3691:22 frame #6: 0x0000000104da3800 pedalboard_native.cpython-312-darwin.so`juce::AudioPluginFormat::createInstanceFromDescription(this=0x0000600002de7720, desc=0x0000000141f3c138, initialSampleRate=44100, initialBufferSize=8192, errorMessage=0x000000016fdfd260) at juce_AudioPluginFormat.cpp:65:9 frame #7: 0x0000000104da4334 pedalboard_native.cpython-312-darwin.so`juce::AudioPluginFormatManager::createPluginInstance(this=0x0000000141f3c1a0, description=0x0000000141f3c138, rate=44100, blockSize=8192, errorMessage=0x000000016fdfd260) const at juce_AudioPluginFormatManager.cpp:96:24 frame #8: 0x000000010563302c pedalboard_native.cpython-312-darwin.so`Pedalboard::ExternalPlugin::createPluginInstance(this=0x0000000141f3c0d8, foundPluginDescription=0x0000000141f3c138, rate=44100, blockSize=8192, loadError=0x000000016fdfd260) at ExternalPlugin.h:1353:36 frame #9: 0x00000001056315dc pedalboard_native.cpython-312-darwin.so`Pedalboard::ExternalPlugin::reinstantiatePlugin(this=0x0000000141f3c0d8) at ExternalPlugin.h:708:11 frame #10: 0x0000000105630d18 pedalboard_native.cpython-312-darwin.so`Pedalboard::ExternalPlugin::ExternalPlugin(this=0x0000000141f3c0d8, _pathToPluginFile="/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3", pluginName= Has Value=false , initializationTimeout=10) at ExternalPlugin.h:590:7 frame #11: 0x00000001056301b8 pedalboard_native.cpython-312-darwin.so`Pedalboard::ExternalPlugin::ExternalPlugin(this=0x0000000141f3c0d8, _pathToPluginFile="/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3", pluginName= Has Value=false , initializationTimeout=10) at ExternalPlugin.h:526:54 frame #12: 0x0000000105630118 pedalboard_native.cpython-312-darwin.so`void std::__1::allocator>::construct[abi:ne180100], std::__1::basic_string, std::__1::allocator>&, std::__1::optional, std::__1::allocator>>&, float&>(this=0x000000016fdfd7ab, __p=0x0000000141f3c0d8, __args="/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3", __args= Has Value=false , __args=0x000000016fdfd94c) at allocator.h:173:24 frame #13: 0x000000010562ff2c pedalboard_native.cpython-312-darwin.so`void std::__1::allocator_traits>>::construct[abi:ne180100], std::__1::basic_string, std::__1::allocator>&, std::__1::optional, std::__1::allocator>>&, float&, void>(__a=0x000000016fdfd7ab, __p=0x0000000141f3c0d8, __args="/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3", __args= Has Value=false , __args=0x000000016fdfd94c) at allocator_traits.h:296:9 frame #14: 0x000000010562fe44 pedalboard_native.cpython-312-darwin.so`std::__1::__shared_ptr_emplace, std::__1::allocator>>::__shared_ptr_emplace[abi:ne180100], std::__1::allocator>&, std::__1::optional, std::__1::allocator>>&, float&, std::__1::allocator>, 0>(this=0x0000000141f3c0c0, __a=allocator > @ 0x000000016fdfd7df, __args="/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3", __args= Has Value=false , __args=0x000000016fdfd94c) at shared_ptr.h:265:5 frame #15: 0x000000010562fb10 pedalboard_native.cpython-312-darwin.so`std::__1::__shared_ptr_emplace, std::__1::allocator>>::__shared_ptr_emplace[abi:ne180100], std::__1::allocator>&, std::__1::optional, std::__1::allocator>>&, float&, std::__1::allocator>, 0>(this=0x0000000141f3c0c0, __a=allocator > @ 0x000000016fdfd81f, __args="/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3", __args= Has Value=false , __args=0x000000016fdfd94c) at shared_ptr.h:262:115 frame #16: 0x000000010562fa34 pedalboard_native.cpython-312-darwin.so`std::__1::shared_ptr> std::__1::allocate_shared[abi:ne180100], std::__1::allocator>, std::__1::basic_string, std::__1::allocator>&, std::__1::optional, std::__1::allocator>>&, float&, void>(__a=0x000000016fdfd8df, __args="/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3", __args= Has Value=false , __args=0x000000016fdfd94c) at shared_ptr.h:823:51 frame #17: 0x000000010562f8c4 pedalboard_native.cpython-312-darwin.so`std::__1::shared_ptr> std::__1::make_shared[abi:ne180100], std::__1::basic_string, std::__1::allocator>&, std::__1::optional, std::__1::allocator>>&, float&, void>(__args="/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3", __args= Has Value=false , __args=0x000000016fdfd94c) at shared_ptr.h:831:10 frame #18: 0x000000010562f730 pedalboard_native.cpython-312-darwin.so`Pedalboard::init_external_plugins(this=0x0000600001ff0db8, pathToPluginFile="/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3", parameterValues=object @ 0x000000016fdfda18, pluginName= Has Value=false , initializationTimeout=10)::'lambda'(std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float)::operator()(std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float) const at ExternalPlugin.h:1614:26 frame #19: 0x000000010562f524 pedalboard_native.cpython-312-darwin.so`void pybind11::detail::initimpl::factory, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::detail::void_type (*)(), std::__1::shared_ptr> (std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::detail::void_type ()>::execute, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>>, pybind11::arg, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v>(this=0x0000600001ff0db8, v_h=0x000000016fdfe3b0, args="/Library/Audio/Plug-Ins/VST3/Omnisphere.vst3", args=object @ 0x000000016fdfdad8, args= Has Value=false , args=10) &&::'lambda'(pybind11::detail::value_and_holder&, std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float)::operator()(pybind11::detail::value_and_holder&, std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float) const at init.h:304:26 frame #20: 0x000000010562f444 pedalboard_native.cpython-312-darwin.so`pybind11::class_, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>> pybind11::detail::argument_loader, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float>::call_impl, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::detail::void_type (*)(), std::__1::shared_ptr> (std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::detail::void_type ()>::execute, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>>, pybind11::arg, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v>(pybind11::class_, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>>&, pybind11::arg const&, pybind11::arg_v const&, pybind11::arg_v const&, pybind11::arg_v const&) &&::'lambda'(pybind11::detail::value_and_holder&, std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float)&, 0ul, 1ul, 2ul, 3ul, 4ul, pybind11::detail::void_type>(this=0x000000016fdfdbb8, f=0x0000600001ff0db8, (null)=std::__1::index_sequence<0UL, 1UL, 2UL, 3UL, 4UL> @ 0x000000016fdfdaff, (null)=0x000000016fdfdb1e) && at cast.h:1613:16 frame #21: 0x000000010562e8f4 pedalboard_native.cpython-312-darwin.so`std::__1::enable_if, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>>>::value, pybind11::detail::void_type>::type pybind11::detail::argument_loader, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float>::call, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::detail::void_type (*)(), std::__1::shared_ptr> (std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::detail::void_type ()>::execute, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>>, pybind11::arg, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v>(pybind11::class_, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>>&, pybind11::arg const&, pybind11::arg_v const&, pybind11::arg_v const&, pybind11::arg_v const&) &&::'lambda'(pybind11::detail::value_and_holder&, std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float)&>(this=0x000000016fdfdbb8, f=0x0000600001ff0db8) && at cast.h:1587:35 frame #22: 0x000000010562e740 pedalboard_native.cpython-312-darwin.so`void pybind11::cpp_function::initialize, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::detail::void_type (*)(), std::__1::shared_ptr> (std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::detail::void_type ()>::execute, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>>, pybind11::arg, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v>(pybind11::class_, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>>&, pybind11::arg const&, pybind11::arg_v const&, pybind11::arg_v const&, pybind11::arg_v const&) &&::'lambda'(pybind11::detail::value_and_holder&, std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), void, pybind11::detail::value_and_holder&, std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float, pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::detail::is_new_style_constructor, pybind11::arg, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v>(this=0x000000016fdfdc3f, call=0x000000016fdfe2c8)(pybind11::detail::value_and_holder&, std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&, pybind11::detail::is_new_style_constructor const&, pybind11::arg const&, pybind11::arg_v const&, pybind11::arg_v const&, pybind11::arg_v const&)::'lambda'(pybind11::detail::function_call&)::operator()(pybind11::detail::function_call&) const at pybind11.h:297:56 frame #23: 0x000000010562e5f4 pedalboard_native.cpython-312-darwin.so`void pybind11::cpp_function::initialize, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::detail::void_type (*)(), std::__1::shared_ptr> (std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::detail::void_type ()>::execute, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>>, pybind11::arg, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v>(pybind11::class_, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>>&, pybind11::arg const&, pybind11::arg_v const&, pybind11::arg_v const&, pybind11::arg_v const&) &&::'lambda'(pybind11::detail::value_and_holder&, std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), void, pybind11::detail::value_and_holder&, std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float, pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::detail::is_new_style_constructor, pybind11::arg, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v>(pybind11::class_, Pedalboard::AbstractExternalPlugin, std::__1::shared_ptr>>&&, void (*)(pybind11::detail::value_and_holder&, std::__1::basic_string, std::__1::allocator>&, pybind11::object, std::__1::optional, std::__1::allocator>>, float), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&, pybind11::detail::is_new_style_constructor const&, pybind11::arg const&, pybind11::arg_v const&, pybind11::arg_v const&, pybind11::arg_v const&)::'lambda'(pybind11::detail::function_call&)::__invoke(call=0x000000016fdfe2c8) at pybind11.h:267:21 frame #24: 0x000000010552c590 pedalboard_native.cpython-312-darwin.so`pybind11::cpp_function::dispatcher(self=0x00000001008f0450, args_in=0x00000001000a6d70, kwargs_in=0x0000000100103600) at pybind11.h:987:30 frame #25: 0x0000000100b2212c libpython3.12.dylib`cfunction_call + 92 frame #26: 0x0000000100ad2f44 libpython3.12.dylib`_PyObject_MakeTpCall + 308 frame #27: 0x0000000100ad5e98 libpython3.12.dylib`method_vectorcall + 236 frame #28: 0x0000000100ad3508 libpython3.12.dylib`_PyVectorcall_Call + 116 frame #29: 0x0000000100b4241c libpython3.12.dylib`slot_tp_init + 260 frame #30: 0x0000000100b3be38 libpython3.12.dylib`type_call + 436 frame #31: 0x0000000105524b68 pedalboard_native.cpython-312-darwin.so`pybind11_meta_call(type=0x0000000111e11480, args=0x0000000100f072c8, kwargs=0x0000000100134180) at class.h:186:22 frame #32: 0x0000000100ad2f44 libpython3.12.dylib`_PyObject_MakeTpCall + 308 frame #33: 0x0000000100bc3b90 libpython3.12.dylib`_PyEval_EvalFrameDefault + 37508 frame #34: 0x0000000100bba6ac libpython3.12.dylib`PyEval_EvalCode + 288 frame #35: 0x0000000100c1aea4 libpython3.12.dylib`run_mod + 168 frame #36: 0x0000000100c19fd8 libpython3.12.dylib`PyRun_SimpleStringFlags + 132 frame #37: 0x0000000100c3c394 libpython3.12.dylib`Py_RunMain + 1204 frame #38: 0x0000000100c3ca98 libpython3.12.dylib`pymain_main + 328 frame #39: 0x0000000100c3cb38 libpython3.12.dylib`Py_BytesMain + 40 frame #40: 0x000000018c33a0e0 dyld`start + 2360 (lldb) frame select 1 frame #1: 0x00000001054b9600 pedalboard_native.cpython-312-darwin.so`juce::getAllParamIDs(controller=0x0000000141f69e30) at juce_PatchedVST3PluginFormat.cpp:212:27 209 getAllParamIDs(Vst::IEditController &controller) { 210 std::vector result; 211 -> 212 auto count = controller.getParameterCount(); 213 214 for (decltype(count) i = 0; i < count; ++i) { 215 Vst::ParameterInfo info{}; (lldb) ```

I'm not sure to what extent this is actually an issue with the plugins themselves not implementing the VST3 spec correctly, as the EXC_BAD_ACCESS occurs in a native plugin method - but they do load fine in other DAWs.

System: MacOS Sonoma python version: 3.12.1 pedalboard version: 0.9.8

Let me know if there's any other info I can provide. Thanks!