spotify / pedalboard

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

Windows VST plugins on Linux? #227

Open DavidDiazGuerra opened 1 year ago

DavidDiazGuerra commented 1 year ago

Hello,

I know that VST plugins are not cross-compatible with different operating systems. However, there is some software to use Windows plugins in Linux digital audio workstations using WINE (e.g., yabridge, carla, or LinVst), so I was wondering if there are any hacks to load Windows plugins in Linux with pedalboard.

I guess WINE by itself won't be enough to load the plugins in pedalboard and that the programs I cited before overlap with pedalboard and they aren't something that you can just easily put in the middle between the plugin and pedalboard, but I am asking just in case.

I am sorry if this is a very stupid question, but I am new to working with VST plugins.

psobot commented 1 year ago

Hey @DavidDiazGuerra!

I haven't kept up-to-date with the latest advancements in running VSTs under WINE, nor have I tried those projects - but if the three projects you linked allow any plugin host to load Windows VSTs through a wrapper, then Pedalboard should be able to load that same wrapper. If there's a Linux-compatible .vst3 file exposed by any of those wrappers, you should be able to do something like:

wrapped_plugin = pedalboard.load_plugin(
    "/path/to/wrapper",
    plugin_name="optional plugin name if the wrapper exposes multiple plugins"
)
DavidDiazGuerra commented 1 year ago

Thanks for the answer! I'm not sure if they expose a .vst3 file or if they just run the whole plugin themselves so a DAW can communicate with them. I'll try to install them and let you know if I am finally able to load a Windows plugin in pedalboard in Linux.

DavidDiazGuerra commented 1 year ago

Hi again! I could finally find some time to try this and I can confirm that WINE+yabridge works well with pedalboard. Installing WINE from the Ubuntu repositories and following the yabridge installation instructions I could load Spitfire's BBC Symphony Orchestra Discover with pedalboard on Ubuntu 22.04.

Everything was surprisingly smooth actually. The only issue I found was the one described here, but that's very specific for that plugin and has nothing to do with pedalboard or even yabridge. I haven't tested the computational efficiency tho.

psobot commented 1 year ago

This is super great to hear @DavidDiazGuerra! I haven't had time to try yabridge just yet, but it sounds like this might be worth adding to Pedalboard's documentation. Do you have any example code showing how you were able to invoke yabridge from load_plugin?

DavidDiazGuerra commented 1 year ago

There's no need for any specific code to use yabridge with pedalboard. Yabridge exposes the VST plugins of your WINE prefix in your Linux folders (by default in ~/.vst3/yabridge so you just have to call pedalboard.load_plugin with that path.

Btw, I haven't tried LinVst and Carla, but I guess they should work well too. I think LinVst is similar to yabridge and exposes the plugins in WINE into the Linux folders while Carla runs its own VST host where you load the Windows (or Linux) plugins you want and exposes a plugin that other hosts can use to communicate with the Carla host.

MaxMalmer commented 1 year ago

Hey, I've lately been trying to get this to work. But I am facing a problem where pedalboard won't load any plugins on Linux. I just keep getting the following error: ImportError: Failed to load plugin as VST3Plugin. Errors were: VST3Plugin: Unable to load plugin /home/../reaper_linux_x86_64/REAPER/Plugins/FX/reacomp.vst.so: unsupported plugin format or load failure. Plugin files or shared library dependencies may be missing. (Try runningldd "/home/../reaper_linux_x86_64/REAPER/Plugins/FX/reacomp.vst.so/Contents/x86_64-linux/reacomp.vst.so"to see which dependencies might be missing.).

If I run the ldd binary on the vst I don't see any undefined libraries. This is the same for both plugins made with LinVst, yabridge and native Linux vst's.

Was this anything you faced while trying to get this to work?

MaxMalmer commented 1 year ago

Nevermind, I solved it. One way to do it is to install wine and then python3.11 inside of wine. There's ways to run conda environments and use pedalboard within the windows shell in wine. You start this shell by typing wine cmd.

DavidDiazGuerra commented 1 year ago

I didn't need to do that in my case, I was able to run Spitfire's BBC Symphony Orchestra Discover with pedalboard in an older Python installation out of the wine prefix. But from the error log you included in your previous message it seems like you were trying to load a Linux plugin that wasn't inside any wine prefix.

maxiedaniels commented 7 months ago

@DavidDiazGuerra @MaxMalmer How did you get Yabridge + Pedalboard working exactly? Yabridge sync ran fine and i'm trying to use a .dll windows plugin (Dimension Expander), so Yabridge makes a .dll and .so version in ~/.vst/yabridge. I try to load either of those with load_plugin but I get an error: VST3Plugin: Unable to load plugin /root/.vst/yabridge/DimensionExpander_x64.dll: unsupported plugin format or load failure. Plugin files or shared library dependencies may be missing. (Try running ldd "/root/.vst/yabridge/DimensionExpander_x64.dll/Contents/x86_64-linux/DimensionExpander_x64.so" to see which dependencies might be missing.).

It's almost like it thinks it's loading a folder rather than the .so directly

DavidDiazGuerra commented 7 months ago

Is your plugin VST or VST3? I think Pedalboard only supports VST3 plugins. When I used Yabridge + Pedalboard I was always loading .vst3 files.

MaxMalmer commented 7 months ago

To my knowledge the Dimension Expander isn't available in VST3(only in VST), so as David suggests that is probably the issue.

maxiedaniels commented 7 months ago

@DavidDiazGuerra @MaxMalmer Ah okay different question - you guys were right, I tried .vst3 (Fabfilter Pro Q 3) and get this output, one note is that it's within a docker container, but did you guys run into this?

23:13:43 [FabFilter Pro-Q 3-BGHNauvw] Initializing yabridge version 5.1.0
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] library:       '/root/.local/share/yabridge/libyabridge-vst3.so'
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] host:          '/root/.local/share/yabridge/yabridge-host.exe'
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] plugin:        '/yabridge/.wine/drive_c/Program Files/Common Files/VST3/FabFilter Pro-Q 3.vst3'
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] plugin type:   'VST3'
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] realtime:      'no'
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] sockets:       '/tmp/yabridge-FabFilter Pro-Q 3-BGHNauvw'
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] wine prefix:   '<default>'
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] wine version:  '9.6'
23:13:43 [FabFilter Pro-Q 3-BGHNauvw]
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] config from:   '<defaults>'
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] hosting mode:  'individually, 64-bit'
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] other options: '<none>'
23:13:43 [FabFilter Pro-Q 3-BGHNauvw]
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] Enabled features:
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] - bitbridge support
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] - CLAP support
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] - VST3 support
23:13:43 [FabFilter Pro-Q 3-BGHNauvw]
23:13:43 [FabFilter Pro-Q 3-BGHNauvw] The Wine host process has exited unexpectedly. Check the output above for more information.
23:13:43 [error] Could not connect to D-Bus session bus: /usr/bin/dbus-launch terminated abnormally without any error message
terminate called without an active exception
23:13:46 [FabFilter Pro-Q 3-BGHNauvw] [Wine STDOUT] Application could not be started, or no application associated with the specified file.
23:13:46 [FabFilter Pro-Q 3-BGHNauvw] [Wine STDOUT] ShellExecuteEx failed: File not found.
23:13:46 [FabFilter Pro-Q 3-BGHNauvw] [Wine STDOUT]
psobot commented 7 months ago

@maxiedaniels D-Bus (Desktop-Bus) is the system used by many Linux apps (including plugins, which have GUIs) to communicate with the window system to launch their GUIs. It sounds like FabFilter expects to be able to launch a GUI, but the Docker container you're running does not have a desktop environment.

maxiedaniels commented 7 months ago

@maxiedaniels D-Bus (Desktop-Bus) is the system used by many Linux apps (including plugins, which have GUIs) to communicate with the window system to launch their GUIs. It sounds like FabFilter expects to be able to launch a GUI, but the Docker container you're running does not have a desktop environment.

Got it. Well it's outside the scope of this repo then, but do you happen to know how to emulate a display within a Dockerfile setup?

yogeshpatki commented 2 months ago

@maxiedaniels D-Bus (Desktop-Bus) is the system used by many Linux apps (including plugins, which have GUIs) to communicate with the window system to launch their GUIs. It sounds like FabFilter expects to be able to launch a GUI, but the Docker container you're running does not have a desktop environment.

Got it. Well it's outside the scope of this repo then, but do you happen to know how to emulate a display within a Dockerfile setup?

Which version of wine are you running?

Try staging versions of wine from WineHQ WineHQ repositories if you using those already.

Per the doc here you need newer versions of wine.

0xdevalias commented 2 months ago

do you happen to know how to emulate a display within a Dockerfile setup?

@maxiedaniels It's been a long time since I looked into this myself, but I believe for some of the things I was doing at the time it was forwarding the host system's X11 / similar window management thing to the dockerised container.

A couple of quick google results: