Generating a LADSPA Plugin via Faust

LADSPA stands for ``Linux Audio Developer Simple Plugin API'', and it is the most common audio plugin API for Linux applications. It can be considered the Linux counterpart of the widely used VST plugin standard for Windows applications. In the Planet CCRMA distribution, most of the LADSPA plugins are found in the directory /usr/lib/ladspa/. At the time of this writing, there are 161 audio plugins (.so files) in or under that directory.

To generate a LADSPA plugin from Faust source, it is merely necessary to use the ladspa.cpp architecture file, as in the following example:

  > faust -a ladspa.cpp cpgrui.dsp -o cpgruilp.cpp
  > g++ -fPIC -shared -O3 \
        -Dmydsp='Constant_Peak_Gain_Resonator' \
        cpgruilp.cpp -o
  > cp /usr/local/lib/ladspa/
(Recall that cpgrui.dsp was listed in Fig.K.7.) We see that the C++ compilation step calls for ``position-independent code'' (option -fPIC) and a ``shared object'' format (option -shared) in order that the file be dynamically loadable by a running program. (Recall that pd similarly required its externals to be compiled -shared.) The Faust distribution provides the make file /usr/lib/faust/Makefile.ladspacompile (among others) which documents such details.

Many Linux programs support LADSPA programs, such as the sound editor Audacity, the multitrack audio recorder/mixer Ardour, and the sequencer Rosegarden. However, for our example, we'll use a simple application-independent LADSPA effects rack called JACK Rack (select ``Applications / Planet CCRMA / Jack / JACK Rack'').

Figure K.11 shows the appearance of the jack-rack main window after addingK.13the plugin named Constant_Peak_Gain_Resonator. Note that the two numeric entry fields have been converted to horizontal sliders. (Vertical sliders are also converted to horizontal.) Also, the controller names have been simplified. A bug is that the default values for the controls are not set correctly when the plugin loads. (They were set manually to obtain Fig.K.11 as shown.)

Figure K.11: JACK Rack screenshot after adding the LADSPA plugin Constant_Peak_Gain_Resonator. Additional LADSPA plugins can be loaded in the space below (and connected in series).

To test the LADSPA plugin, any program's audio output can be routed through jack-rack to the sound-out driver (typically ``ALSA PCM'' these days). For example, pd's audio output can be routed through jack-rack to alsa_pcm as shown in Fig.K.12.K.14

Figure: JACK audio connections routing pd through jack-rack to the ALSA sound-out driver alsa_pcm.

Next Section:
Generating a VST Plugin via Faust
Previous Section:
Generating a Pure Data (PD) Plugin