Using VST/VSTi Plugins In Linux

A Quick Toot from Dave Phillips

Last update: 27 November 2005

Next

!!!NOTICE!!!

As of November 2005 this page is officially deprecated. Kjetil Matheussen has ceased support of his vstserver project, leaving the field to the FST project and to the VST hosting capabilities of the DSSI project. Please see the Web sites for these projects for details regarding their installation and use. You will still need WINE and the Steinberg VST SDK. Fortunately the FST and dssi-vst projects are concerned with their ability to perform under recent versions of WINE, and I recommend them over all previous solutions. Of course, if the WINE version is of no importance you can continue to use the methods detailed on this page. However, please be aware that Kjetil no longer maintains the vstserver project and that the code for libfst, jack_fst, and xfst has been folded into the FST project.

In my opinion both the FST and DSSI projects now offer the preferred solutions to using VST/VSTi plugins under Linux. Hopefully we will see improved collaboration between the WINE development teams and the Linux audio development community, perhaps acting to mitigate the performance issues that frequently occur with WINE updates. Users of these systems should also consider joining the Linux audio users mail list for current news and reports. Recent VST-specific news includes Nigel Henry's report on using the SAVIHost software to load and run VST plugins under WINE without the use of an external system such as FST or the dssi-vst host.

Some new resources :

You might also want to look over the sites listed in the Resources at the end of this page.

WARNING! WARNING! WARNING!

This tutorial is not intended to be a primer. It assumes some knowledge of audio plugins, especially with plugins in the VST/VSTi format. It also assumes familiarity with downloading and unpacking tarballs (files with .tar.gz, .tgz, and .tar.bz2 extensions), with compiling programs from source code, and running applications from an xterm prompt. Finally, the tutorial assumes working ALSA and JACK systems, complete with development support files.

Preparations

As of December 2004 there are three methods available for using VST/VSTi plugins in Linux, Kjetil Matheussen's original vstserver, the fst project from Paul Davis and Torben Hohn, and Chris Cannam's dssi-vst wrapper plugin. All these methods require software from the WINE and JACK projects: WINE emulates the Microsoft Windows APIs in X, JACK is a native Linux low-latency audio server. Alas, WINE and JACK are not yet default packages in mainstream Linux distributions, so you may need to install and configure them yourself. Please see their Web home pages for details regarding these packages.

Note: I have not yet set up and used the DSSI system, so there is as yet no further information here regarding the dssi-vst software. I hope to remedy this lack as soon as possible, but if you would like to contribute comments and/or guidance I'll be happy to add your experience to the User Reports section (see below).

These systems work their magic by using functions and services of the WINE binary (wine) and its library (libwine). WINE is either a Windows emulator or it's not, depending on how you want to see it, but we don't really care about that. Right now, we're only interested in it as a component in a system for running VST plugins in Linux. You can download source code and pre-built binaries from the WINE Web site, but for the best compatibility you should compile and install one of the WINE source packages Kjetil Matheussen keeps on the same page as the vstserver sources.

Note: Kjetil's last "officially approved" version is dated from December 2003, and if you're using a recent version of WINE you may experience considerable difficulty getting VST/VSTi support working. See the report below sent from Mark Knecht regarding his experiences using the libfst system with more recent versions of WINE.

If you're running a Planet CCRMA or AGNULA/Demudi system then JACK is already installed. Building JACK from sources is simple enough, but be sure to read the README for important recommendations regarding tmpfs and disk I/O. When you're ready, invoke this familiar mantra to build and install JACK (installing as root, of course) :

	./configure; make; make install

It is beyond the intent of this tutorial to explain how to configure and tweak JACK to perfection. However, I highly recommend Rui Nuno Capela's qjackctl, an excellent graphic interface for JACK's settings. Qjackctl also includes GUI patch bays for both audio and MIDI connections, a very welcome feature.

These projects also require files found in the Steinberg VST/VSTi SDK (system development kit). Although only two files are needed from the SDK, the kit cannot be freely redistributed, so you must retrieve it yourself from the Steinberg Web site at http://www.steinberg.net/steinberg/ygrabit/index.html. Unpack it in your home directory, then follow the instructions regarding the necessary header files as found in the README texts for the vstserver and fst source packages.

Once you've installed WINE, JACK, and the necessary VST headers, you're ready to compile and run the vstserver and fst systems.

The vstserver System

Kjetil Matheussen's VST server system has evolved to include the following components :

Note: I say again: This system is unlikely to work with recent versions of WINE. If you want to run the vstserver and its clients you are well-advised to download and install the version of WINE found on Kjetil's site.

The source code for this software is located at http://www.notam02.no/arkiv/src/. Kjetil's instructions for building the server and its clients are brief and clear. First, set your VST_PATH environment variable to the location of your VST/VSTi plugins directory :

	export VST_PATH=/path/to/your/plugins

You can set the path from an xterm command prompt, or you can add the export statement to your ~/.bashrc file to set it automatically when you log in as a normal user.

Note: Be sure to place the required headers from the Steinberg SDK in vsterver-x.x.x/include/vst. [1Feb05: Apparently the headers are now included with Kjetil's source tree.]

Next, beginning with the server sources, run

make
and (as root)
make install
in each component's top directory to build and install the system. With all the pieces in place you can start the server from an xterm prompt with the vstserver command. Type Ctrl-C to kill the process.

That's it, now you're ready to try the examples in this tutorial.

The LADSPA/VST Connection

Our first test will employ the LADSPA plugin within the Snd soundfile editor. Follow these steps :

The version of Snd used for this example has been heavily customized. The default Snd does not include a LADSPA effects menu, but you can add such a menu (and others) by using Kjetil Matheussen's Snd configuration code which is activated by adding the following line into your $HOME/.snd file :

	(load-from-path "snd_conffile.scm")

The widget that appears when you call the plugin frm Snd may bear little resemblance to the colorful GUI of the original, and the arrangement and functions of the sliders may not correspond to the layout of the VST graphic interface. I prefer to do without the native Linux GUI sliders entirely and use Snd's widget only to turn on the VST GUI and loop play the selection while I adjust the settings on the original plugin's graphic interface. When I'm happy with the effect I return to the GTK or Motif widget, click Stop, push Apply, and behold, a cool VST plugin effect has been added to my sound. Figure 1 shows Snd running a VST plugin via the LADSPA plugin host.

Figure 1: Snd meets a VST plugin

Using ladspavst with other applications

Audacity 1.2.1 handled the dfx Transverb and NorthPole plugins nicely, presenting usable Linux GUIs with decently organized switches and banks of sliders. Alas, the otherwise very fine Sweep 0.8.2 segfaulted when I tried running the same two plugins [2]. The native widgets presented by Snd, Audacity, and Sweep all suffer from a confusion of sliders and labels when translated from the original VST GUI. However, the effects do work when applied. Note also that different applications account for VST plugins in different ways, i.e., Snd lists them by name, but JACK-Rack lists them under Uncategorized. You might have to do some searching through your application's LADSPA menu to find your VST plugins.

Figures 2 and 3 illustrate the use of the ladspavst plugin to host VST plugins in Audacity and JACK-Rack.

Figure 2: Using the NorthPole VST plugin with ladspavst in Audacity

Figure 3: Using the dfx Transverb VST plugin with ladspavst in JACK-Rack

Remember: If an application supports LADSPA plugins, it can now support VST plugins. All caveats included, of course...

Using VST/VSTi Plugins With Pd

The next two examples use the k_vst~ object for Miller Puckette's Pd. If you don't already have Pd installed on your system, shame on you: it's one of the most powerful audio/video synthesis/processing environments available for Linux, and no Linux audio workstation is complete without it. The Pd Web site is listed in the Resources at the end of this tutorial, so if you don't have it go get it.

Note: The following example was run on Pd 0.37.

The VST object for Pd is again quite simple to use. As in our LADSPA example, start JACK, start the vstserver, then fire up Pd with the k_vst~ object and an appropriate patch. Figure 4 shows a simple patch that will read an audio stream from the mixer's designated capture channel and pass it through an indicated VST plugin (the North Pole filter/delay processor). The patch also includes controls for toggling the GUI.

Figure 4: Linux Pd hosts a VST plugin

Here's the patch in text mode :

  
  #N canvas 225 72 952 850 10; 
  #X msg 47 21 opengui; 
  #X msg 97 45 closegui;
  #X obj 229 87 adc~; 
  #X obj 233 164 dac~; 
  #X obj 163 125 k_vst~ NorthPole;
  #X connect 0 0 4 0; 
  #X connect 1 0 4 0; 
  #X connect 2 0 4 1; 
  #X connect 2 1 4 2; 
  #X connect 4 1 3 0; 
  #X connect 4 2 3 1;
I named this patch dp_01-kvst.pd and invoked it in this manner :

	pd -lib /home/dlphilp/k_vst~/k_vst~ -open /home/dlphilp/dp-pd/dp_01-kvst.pd

As you can see in Figure 4 the adc~ object receives its data from the Wave channel. Note also that the plugin name does not require an extension or path specification: the object will search the VST_PATH for the plugin name. The plugin controls work in realtime, they work well, and that's about all there is to say about this patch.

The next example plays the Monsta Media Compakt VSTi synthesizer from an external MIDI keyboard. Here's the text content of the patch :

  
  #N canvas 235 288 533 397 12; 
  #X msg 289 171 opengui; 
  #X msg 289 198 closegui; 
  #X obj 267 290 dac~; 
  #X obj 189 239 k_vst~ compakt; 
  #X obj 189 70 notein 1; 
  #X msg 381 106 \; pd dsp 1; 
  #X msg 380 149 \; pd dsp 0; 
  #X obj 189 106 pack 0 0; 
  #X msg 189 136 noteon \$1 \$2; 
  #X connect 0 0 3 0;
  #X connect 1 0 3 0; 
  #X connect 3 1 2 0; 
  #X connect 3 2 2 1; 
  #X connect 4 0 7 0; 
  #X connect 4 1 7 1; 
  #X connect 7 0 8 0; 
  #X connect 8 0 3 0;
The results are shown in Figure 5.

Incidentally, at first I used a simple MIDI module with only the notein object and the noteon message. It worked, but my MIDI keyboard (a Casio CZ101) retriggered the sound on key-release. Worse, the synth was not receiving a note-off so the sound would not stop until I switched off the audio computation in Pd. Not good at all. I knew that the Casio sends a note-on with a velocity of 0 at key-release, but the synth was not getting it. Neither was I, so I figured it was time to consult a guru, in this case Mr. Frank Barknecht. His added pack object orders the notein data and ensures a correctly formatted noteon message is sent to the synth. Thus, the external keyboard control of the synth stops on the key-release. Thanks, Frank!

Figure 5: Linux Pd hosts a MIDI-controlled VSTi synth

The interested reader should also run Kjetil's help-k_vst~.pd and help-k_vst~-2.pd patches to learn about more uses for VST and VSTi plugins in Pd.

Running VST Instruments With vsti

The latest addition to Kjetil's VST software armory is his vsti program. This little application lets you run VSTi plugins in standalone mode, i.e., you don't need to launch another application to call the plugin. We have already seen a VSTi plugin instantiated within the Pd framework, but the process is a little different for the vsti program.

Here's how to launch a VSTi plugin using Kjetil's vsti binary :

	vsti Crystal

Yes, it's that simple, provided you've set your VST_PATH correctly. Figure 6 illustrates the results from running the invocation above. However, you still need to make the necessary audio and MIDI connections. Figure 6 also illustrates the audio and MIDI patch bay connections I used within the excellent qjackctl JACK control station.

Figure 6: The vsti program running the Crystal VSTi synth

Known Issues With vstserver

So the good news is that the VST server works. However, this software is all either alpha or beta-stage stuff, so there are problems. Here's a list of some of the known problems and possible solutions :
 
Problem: Solution:
Quitting Pd crashes the server  Stop server first, then quit Pd
WINE goes into an infinite error loop when adding plugin to Pd patch Restart server (update WINE ?)
Plugin won't load due to problem allocating shared memory Restart server
Not all plugins work See Tim Orford's database for info
Original plugin controls are not always mapped well to native GUI widgets  Native widget controls usually work
Some plugins work but will not display GUI See previous solution... 
Quite version-dependent on WINE Hmmm... 

Putting Pieces Together: libfst and jack_fst

Paul Davis (Ardour, JACK) and Torben Hohn (gAlan) have created another system for hosting VST/VSTi plugins in Linux. Their fst (FreeST) system is again based on WINE but replaces Kjetil's server with a library. The README for the fst package describes the difference :

"This work differs from Kjetil Matheussen's VSTserver because the plugin is loaded into the address space of the program using the library, not into a server. As a result, it is a more appropriate solution for audio applications that might support many VST plugins, where the context switches required in the VSTserver case do not scale well. The downside, of course, is that a misbehaving plugin will crash the host application, which VSTserver avoids."

The components for this system presently include the libfst library and jack_fst, an example program that loads and runs VST/VSTi plugins. As with Kjetil's software, building the fst system requires full installations of WINE and JACK along with the AEffect.h and aeffectx.h files from the Steinberg VST SDK.

Building and Installing the fst System

Download the source packages at http://www.linuxaudiosystems.com/fst/ and unpack them in your home directory. Enter the fst-x.x subdirectory and create a directory there named vst. Move the AEffect.h and aeffectx.h files from the VST SDK into your new $HOME/fst-x.x/vst/ directory, then from $HOME/fst-x.x/vst run

../fixheaders
to prepare the VST header files. Return to the top level ($HOME/fst-x.x) and run
./autogen.sh
to update the configuration files. Now invoke the familiar litany of
./configure; make; make install
(become root user to install). As root, update your system library cache with
/sbin/ldconfig
and the fst library is open for business.

Building and installing jack_fst is easier. Enter the ~/jack_fst-x.x directory, run

./configure; make; make install
as before, and the jack_fst progam is ready to run.

Running VST/VSTi Plugins with jack_fst

Using the jack_fst program is similar to using the vsti client, except there is no need to invoke a server. The following command loads and runs the VSTi plugin seen in Figure 7 :

	jack_fst vstplugins/Oberon-4

Note that the VST_PATH variable is not accessed, the .dll extension is not needed, and that audio and MIDI connections must be made manually with aconnect and jack_connect or by using the GUI patch bays in qjackctl.

Figure 7: jack_fst running the Oberon VSTi synth

Known fst Issues

Reported problems with the fst system include stuck notes and plugin zombification. I haven't had troubles with stuck notes when triggering plugins from my Casio CZ101, but breaking the connection in the patch bay while playing did cause a stuck note. Reconnecting silenced the note. Alas, zombification is more common: I can play with the plugin GUI for a while, but at some point the plugin ceases responding and becomes a zombie. However, this system is still maturing, and solutions to these problems will doubtless appear Real Soon Now. Meanwhile, be sure to report your fst problems to Paul or Torben.

Note: The libfst 1.6 package lacks a component critical for installing the library. You must link or copy the mkinstalldirs utility from /usr/share/automake-x.x (it might be in the /usr/local/share hierarchy) to your $HOME/fst-1.6 directory.

Note: The aeffectx.h file from the Steinberg SDK 2.3 is not properly fixed by libfst's fixheaders script. Currently I suggest editing the VstFileType structure to contain only these lines:

  struct VstFileType
  {       
        char name[128];
	char macType[8];
	char dosType[8];
	char unixType[8]; 
	char mimeType1[128];
	char mimeType2[128];
  };

User Reports

This section contains reports from users that may include details not found in my text. Be sure to read these reports, they may solve difficulties I have not yet experienced or have not been able to reproduce, and you might find answers here for your own problems with these systems.

This report was sent by Mark Knecht on 18 October 2004 :

  As you probably know I've been using jack_fst for the last few weeks. My main interest 
  so far has been the use of Battery - Native Instruments wonderful drum sample player. Up 
  until a few days ago it had been working perfectly on my Gentoo laptop, but it then 
  broke in a pretty major way.

  After a few days of messing around (in a pretty structured way) I've managed to get it 
  working again... I did run into a couple of issues :
	
        1) First, there may be multiple places to get the Steinberg SDK. I'm not exactly sure, 
	but this is implied from the fst README file:

	"To build the library from source, you will need the Steinberg SDK header files AEffect.h 
	and aeffectx.h. These cannot be redistributed by us or anyone else. The configure script 
	will tell you where to get them. The registration process with Steinberg points you to an 
	FTP URL that does not have the VST SDK on it. Use this instead:

	ftp://ext2asio:sdk1ext@ftp.pinnaclesys.com/SDK

	VST is a trademark of Steinberg Media Technologies GmbH"

  I did my download using the ftp address above. When you go to that address you are given two choices - 
  SDK-2.0 and SDK-2.3. In my experience so far neither SDK actually works, but I suspect that the right 
  decision is to download the 2.3 version.

	2) I had trouble with the two Steinberg VST header files. When I tried to compile jack_fst 
	it complained that the versions installed had problems... The fixheaders script does not seem 
	to correctly fix the headers for either the 2.0 or 2.3 SDK files. [See note above.]

	3) In researching why my working system started failing I looked at all the Gentoo portage 
	emerge logs for the last two weeks. Long story short, any glibc newer than glibc-2.3.3.20040420-r2 
	doesn't work with jack_fst. WINE continues to be able to run Battery with bad latency, but 
	jack_fst segfaults. I had to back my system down from the August glibc that just went stable. 
	Some change in glibc was the root cause of my specific failure.

        4) Along the way I tried a number of versions of WINE :
           wine-20040505
           wine-20040716
           wine-20040813
           wine-20040914

  I had a variety of results with these versions, but I'm comfortable saying the wine-20040505 does work. 
  The others may or may not workonce fst/jack_fst figure out what their issues are with the newer glibc.

  So here's what works reliably on my laptop:

	2.6.9-rc2-mm4-VP-S7-UMP-noACPI + realtime-lsm
	glibc-.3.3.20040420-r2
	fst-1.6
	jack_fst-1.2
	WINE-20040505
	Jack-0.99.0

  I can run a large number of Windows VSTs with this specific combination. I am sure that I cannot run any 
  with glibc-2.3.4, and I'm not sure about newer versions of WINE but they appear not to work very well, 
  if at all, on the VST side. They do work for normal Windows programs including some audio programs.

Mark sent this note on December 16 2004:

  In my experience the December 2003 version of WINE will not build on modern C compilers... 
  I can only go back to about February 2004 on my Gentoo box.

A brief report from Shayne O'Connor, dated 2 December 2004 :

  I am now a successful user of jack_fst! I managed to get it working with WINE 20040505 
  and the Planet CCRMA 2.6.8 R9 kernel on my Fedora Core 2 box ....

  The trick was to check the "No Memory Lock" box in qjackctl - now i'm running Crystal synth, 
  Pro-52, Slayer2, Plasticz plus a whole bunch of others as a normal user ... 

Shayne has also reported success building and running jack_fst and dssi-vst under WINE 20041201, without disabling memory lock in qjackctl.

Russell Hanaghan points out that it makes a difference how you install your VST/VSTi plugins. Some plugin installations are quite simple, requiring only that you copy the plugin DLL to your $VST_PATH directory. However, others are not so simple and will require installation exactly as though you were installing in Windows, i.e., you must follow the instructions presented by the installation wizard. You can then link the plugin from its installation directory to $VST_PATH.

On January 31 2005 Geoff Beasley sent the following report:

  I'm using RH9, Planet CCRMA, low latency 2.4.26 kernel, QJackctrl, latest JACK, WINE 20040505 (because 
  most reported good results with this one), fst 1.6 and jack_fst 1.2, and ALSA 1.0.4. I have a C-Port 
  audio interface (snd-ice1712 chipset) in an AMD 2400XP machine with  1G RAM. With a bit of fiddling 
  and a lot of help from Mark Knecht  Paul Davis and Dave Phillips I got this going. I tried initially 
  on Slackware 10/Audioslack and I had mixed results (though I am using Audioslack on two other machines 
  here brilliantly !). When Dave reported he was using Kontakt (my only reason for trying this at all !) 
  I just had to try. One important omission at first from my setup was the "devel" packages from CCRMA. 
  Without these JACK could not be found and so on. Once they went in I had no more than the issues 
  mentioned in Dave's Toot.

  Now to the results;
  I created a 4-bar loop in Rosegarden and mounted jack_fst with one instance of kontakt.dll loaded with 
  13 drum patches. I simply copied then renamed the kontakt.dll to kontakt2.dll then loaded a second 
  jack_fst with that and got another kontakt running, this one with 12 drum patches. I let this setup loop 
  for over 11 hours with no xruns, (256 frame buffers on an AC97 card no less... my C-Port breakout box was 
  still in the studio!). Today I got to use Kontakt with my keyboard controller.....perfect! I loaded my 
  Bosendoerfer Piano and was in heaven. This really is working for me.

  Cheers to Paul, Torben, Mark, Dave and all concerned.

  As from today my studio is 100% Linux...

Please send your own reports directly to me and I'll post them here. Be advised, I will edit all reports for readability.

But What About LADSPA ?

Well, what about it ? It's great, many of the available LADSPA plugins are as good as anything I've found in the VST world, and it's native Linux audio software. Obviously it is also necessary if you want to use Kjetil's ladspavst software, so you really do want the LADSPA system on your Linux audio workstation. I hope that LADSPA developers who are unfamiliar with the VST world will find some inspiration there and perhaps discover some useful ideas and implementations for their own excellent plugins. Furthermore, although WINE is licensed under the LGPL most VST/VSTi plugins are not free software as defined by the Free Software Foundation. If you intend to use only completely free software then LADSPA is the only way to go.

Parting Comments

The usability of the VST server and the fst library depends upon the stability of WINE, so send those debugging reports to the WINE development team. The WINE developers want to know what problems you encounter, and of course you should also let Kjetil, Paul, Torben, and Chris know how well their software is working.

You should also add your experiences to Tim Orford's database of VST/VSTi plugins that have been used with this software (see Resources). Not all plugins work with the systems, some will work only with some coaxing, and others work beautifully right out of the box. Tim's page will be most helpful if you add your own opinions and comments, so please help expand the database by letting us know you fare with this stuff.

Finally, I want to thank Kjetil Matheussen for his help with this tutorial and for making it possible in the first place. Thanks to his groundbreaking work we need no longer flinch when our Win/Mac brethren snipe at the lack of support for VST/VSTi plugins under Linux.

Resources

Notes:
[1] JACK is not absolutely necessary for running vstserver and its clients, but I strongly urge its use.
[2] Sweep is otherwise an excellent editor.

Next