Next  |  Prev  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search


Generating a LADSPA Plugin via FAUST

LADSPA stands for ``Linux Audio Developer Simple Plugin API'', and it is a common audio plugin API for Linux applications. [Note: LADSPA has been superseded by LV2, and this section should be updated to show how to create lv2 plugins instead. See the faust2lv2 script for details. It's not significantly different at this level.] 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.11.) 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 13 shows the appearance of the jack-rack main window after adding16the 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.13 as shown.)

Figure 13: 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).
\includegraphics[width=5in]{eps/jackrack}

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

Figure: JACK audio connections routing pd through jack-rack to the ALSA sound-out driver alsa_pcm.
\includegraphics[width=5in]{eps/jackrackconnect}

Next  |  Prev  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Download aspf.pdf
[Comment on this page via email]

``Audio Signal Processing in Faust'', by Julius O. Smith III.
Copyright © 2022-05-05 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA