Next  |  Prev  |  Top  |  REALSIMPLE Top


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 cpgruilp.so
  > cp cpgruilp.so /usr/local/lib/ladspa/
(Recall that cpgrui.dsp was listed in Fig.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 11 shows the appearance of the jack-rack main window after adding14the 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.11 as shown.)

Figure 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).
\resizebox{5in}{!}{\includegraphics{\figdir /jack-rack.eps}}

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.12.15

Figure: JACK audio connections routing pd through jack-rack to the ALSA sound-out driver alsa_pcm.
\resizebox{5in}{!}{\includegraphics{\figdir /jack-rack-connect.eps}}


Next  |  Prev  |  Top  |  REALSIMPLE Top

Download faust.pdf

``Signal Processing in Faust and PD'', by Julius O. Smith III,
REALSIMPLE Project — work supported by the Wallenberg Global Learning Network .
Released 2010-07-29 under the Creative Commons License (Attribution 2.5), by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA