DSPRelated.com
Free Books

Generating a VST Plugin via Faust

This section describes generation of a Windows VST plugin starting from Faust code, again using the constant-peak-gain resonator example.

The VST (Virtual Studio Technology) plugin standard was developed by Steinberg Media Technologies (makers of Cubase). It enjoys wide usage on Windows and Macintosh platforms. The Faust distribution contains the make-file /usr/lib/faust/Makefile.vstcompile for compiling and installing VST plugins using Xcode on a Mac OS-X machine. For our example, however, we'll create a Windows-format VST plugin (.dll file) using Microsoft Visual C++. The example was tested on a Muse Receptor.K.15

Because the Receptor does not support mono plugins, the process line in the Faust source in Fig.K.7 was modified as follows to make it stereo-compatible:

  process = + : firpart : + ~ feedback <: (_,_)
This version was named cpgrui_vst.dsp. To generate a VST plugin, we simply use a VST architecture file:
  faust -a vst2p4.cpp cpgrui_vst.dsp -o cpgrui_vst.cpp
Next, the file cpgrui_vst.cpp was copied over to a Windows-XP machine with Microsoft Visual Studio Express installed (including Visual C++ 2008). The programming sample ``again'' from the Steinberg VST-2.4 SDK was copied to an adjacent directory cpgr and trivially modified to create a compilable C++ project. (Specifically, replace again.cpp by cpgrui_vst.cpp, rename again.vcproj to cpgr.vcproj, and change all occurrences of ``again'' to ``cpgrui_vst'' in cpgr.vcproj, and change ``Gain'' to ``CPGR'' to rename the plugin. Finally, double-click on cpgr.vcproj to launch Visual C++ on the cpgr project.) Selecting the menu item ``Build / Build cpgr'' creates cpgr/win/Debug/cpgr.dll (the VST plugin itself). To test the plugin, it was copied into the ``Unsupported Plugins'' folder on the Receptor, and installed by clicking the ``1 installs'' button on the Receptor's Setup page. After that, the plugin could be instantiated on a Receptor ``Mix'' channel, as shown in Fig.K.13, and Fig.K.14 shows the automatically generated edit window of the plugin.

Figure K.13: Screenshot of the Receptor Remote Control program, showing the ``Mix'' view. The constant-peak-gain resonator (named cpgr) is instantiated as a plugin processing the ``Piano'' source signal.
\includegraphics[width=\twidth]{eps/ReceptorRemoteControl}

Figure K.14: Screenshot of the upper-left corner of the parameter-editing window of the Receptor's remote-control program showing the constant-peak-gain resonator parameters.
\includegraphics[width=3.5in]{eps/ReceptorParamsScreenShot}

Bypassing Windows

Beginning with Faust version 0.9.9.4j-par, a new makefile called Makefile.w32vstcompile is distributed in the examples directory. This makefile can be adapted to work on Fedora F8 Linux as follows.

  1. Download and install the following RPMs from SourceForge:
    mingw-binutils-2.18.50-6.fc8.i386.rpm
    mingw-gcc-core-4.2.1-6.fc8.i386.rpm
    mingw-gcc-g++-4.2.1-6.fc8.i386.rpm
    mingw-runtime-3.14-3.fc8.i386.rpm
    mingw-w32api-3.11-3.fc8.i386.rpm
    
    (Unfortunately, mingw is not in the standard yum repos yet.)

  2. In Makefile.w32vstcompile, edit the VST line to say where your vstsdk2.4 directory is located, and change all occurrences of i586-mingw32msvc to i386-mingw32.

  3. The plugin name defaults to ``FaustFx''. You can change this by declaring the name in your Faust source. For the example of the previous section, we could say
    declare name "CPGR";
    
    in place of the longer name used in Fig.K.7. (The longer name results in a plugin called ``ConstantPeakGainResonator''.)

  4. After the make, simply copy the dll file to the Receptor and tell the Receptor to install it on the Setup page of the Receptor Remote Control program as before (which requires Windows or a Mac). While one can press the Setup button on the Receptor front panel and rotate the Top Display Knob to ``Install/Upgrade'' (the next-to-last entry), there you will find ``0 files'' even when there is a file to install. The manual documents that it is not allowed to install plugins from the Receptor front panel, because some installs require a user interface (such as to receive an authorization code). This is an unfortunate and unnecessary restriction in our case that prevents working entirely directly with the Receptor from a Linux environment.

The Receptor's ``Unsupported Plugins'' directory can be mounted as follows:

> mkdir /mnt/receptor
> mount -t cifs <ReceptorIPA>:hard\ drive/Program\ Files/VST\ Plugins/Unsupported\ Plugins \
        /mnt/receptor
(Remember to say umount /mnt/receptor when you are done.) The Receptor's IP Address (typically assigned by DHCP) can also be viewed by pressing the Setup button and rotating the Top Display Knob to that field.


Next Section:
Generating a MIDI Synthesizer for PD
Previous Section:
Generating a LADSPA Plugin via Faust