ONLamp.com
oreilly.comSafari Books Online.Conferences.

advertisement


Linux Audio Plug-Ins: A Look Into LADSPA
Pages: 1, 2, 3, 4

LADSPA plug-in collections

The typical procedure for adding a plug-in to an application involves downloading the sources or a pre-compiled binary, then building and installing it just as you would do with any other application. Well-behaved LADSPA plug-in collections install themselves in the directories specified by LADSPA_PATH, and LADSPA-friendly hosts know to look there first for the available plug-ins.



Implementation details vary between hosts: Plug-ins may be listed in a menu or not at all within the host application, the plug-in's user-interface might be a nice GUI or a bare command-line, and some plug-ins are unusable on certain hosts. However, if the host recognizes the plug-in, then ideally the plug-in should behave as if it were an integral built-in part of the host. We'll look into some of those hosts, but first let's do a quick survey of some of the available sets of LADSPA plug-ins.

First you'll want to return to Richard Furse's LADSPA site and pick up the Computer Music Tool kit (CMT), a collection of more than 50 plug-ins free for your study and use. These plug-ins are available as a precompiled objects (cmt.so) or as source code. Compiling and installing the library object is a simple process: Download the source package to your $HOME directory, unpack it with tar xzvf cmt_src.tgz, enter your new CMT source directory, run make to build the plug-ins, and run (as root) make install to complete the installation.

The CMT has been planned as a complete plug-in tool kit for the electroacoustic musician: It already includes an impressive variety of synthesizer modules, filters, delay lines, envelope followers, and spatialization modules. The indefatigable Richard Furse has contributed the bulk of the plug-ins now in the tool kit, along with some excellent contributions from programmer David Bartold. Richard encourages plug-in writers to join the project and help expand the collection.

Developer Steve Harris has contributed a set of plug-ins available from his web site. The package is easy to build and install, and includes dynamics processors, distortion effects, chorus and flange, ring modulation, and pitch scaling. It also includes his Hermes filter, a remarkable plug-in with more than 50 control ports.

Stephane Conversy has translated some of the opcodes from Paul Davis's Quasimodo into LADSPA plug-ins. This set is very experimental and was created to showcase LADSPA's possibilities, so it should not be considered a finished package. Many of the Quasimodo opcodes derive from the Csound sound synthesis software, and the concept of turning them into plug-ins is quite novel. If you'd like to try some "edgier" plug-ins you can pick up Stephane's set here. Be sure to read the README file for the instructions on building the set: It isn't difficult at all, just a bit different.

You can test the plug-ins from these collections with your tools from the LADSPA SDK, or with a LADSPA-friendly host application. Let's take a look at some of those friendly hosts now.

LADSPA hosts

Note: The test platform for this section was a Pentium III 550 with lots of RAM, a decently fast and tuned IDE drive, a SoundBlaster SBLive Value soundcard (with ALSA and OSS/Linux drivers), and Linux kernel 2.4.0-test9 configured with Andrew Morton's low-latency patch. As with all audio software, performance will be best on a fast optimized system. Your results may vary.

In this part of our tour you'll see how some Linux audio applications manage and apply LADSPA plug-ins. LADSPA-friendly hosts include the following programs:

  • Ardour professional quality hard-disk recorder.
  • ecasound multitrack recorder, audio processor.
  • GDAM multipurpose audio mixer/processor.
  • ladspaToy Qt interface for testing LADSPA plug-ins.
  • MusE audio/MIDI sequencer.
  • PD iconic synthesis/performance/composition environment.
  • Snd sound file editor.
  • Sweep sound file editor.
  • terminatorX DJ-style "scratcher" and audio processor.

Both X and console applications can use LADSPA plug-ins so we'll test applications in both environments. You'll also use a "mini-network" GUI to build your own LADSPA plug-in. Let's start our tour of LADSPA hosts with a visit to Snd.

Snd

Bill Schottstaedt's Snd is a very powerful audio application available for a wide variety of *NIX platforms, including Alpha machines, SGI computers, Solaris, and machines running Linux and LinuxPPC. Snd presents a rather simple graphic interface, but it is truly deep audio software. Thanks to its LISP and Emacs heritage, the user interface can be completely customized; however, the audio processing engine is also extensible, providing hook-ups for extensions from many sources, including a Common LISP Music module (for MusicV-type sound synthesis), external programs such as Perry Cook's STK (the Synthesis Tool Kit, a set of C++ classes for music synthesis), Guile/Scheme code (via dynamically loaded shared objects or directly entered into Snd's Listener window), and LADSPA plug-ins, of course.

Note: To enable LADSPA support Snd must be compiled with the --with-ladspa configuration option.

Snd's LADSPA module was contributed by Richard Furse. It contains four basic support functions: an initialization search (init-ladspa), a list function (list-ladspa), a plug-in analyzer (analyse-ladspa), and the plug-in loader (apply-ladspa). LADSPA plug-ins are invoked in the Listener, Snd's interactive Guile\Scheme programming interface, following this syntax:

(apply-ladspa reader (plugin-library plugin-type [param1 [param2 ...]]) samples origin)

In Figure 1 we see these command parameters in the Listener:

(apply-ladspa (make-sample-reader 57264) (list "cmt" "delay_5s" .3 .5) 32556 "ibm.wav")

This sequence tells Snd to read a block of 32556 samples from the ibm.wav file, starting at sample number 57264, and apply the delay_5s LADSPA plug-in (Richard Furse's delay plug-in, also found in cmt.so) with a delay time of .3 seconds and a 50/50 dry/wet balance. Figure 2 shows the sound file after the effect has been applied.

If all that seems a bit cumbersome, bear in mind that the Listener works with standard Emacs key bindings, including those for text cut/copy/paste operations, and the Listener window area is itself very flexible about text entry. You may freely position the cursor for editing anywhere within the window, and a command can be repeated merely by clicking the cursor at the end of the previous entry and pressing Enter.

Alas, I don't have space to give Snd the attention it deserves. For now, I recommend downloading it, playing with it, and studying its copious and excellent documentation. And don't forget to try out all those LADSPA plug-ins.

Ecasound

Kai Vehmanen's ecasound accommodates the LADSPA plug-ins to extend its real-time signal processing options. Here's how ecasound plays a WAV file and applies the delay_5s effect to it while controlling one of the plug-in's parameters in real time with an external MIDI device:

ecasound -c -r -i:/home/dlphilp/soundfiles/wav/ibm.wav \
        -el:delay_5s,0.0,0.50 \
        -km:1,0.0,5.0,7,0 \
        -o:alsa,0,0

The flags set up the performance as follows:

  • -c opens ecasound in interactive mode
  • -r sets real-time priority (SCHED_FIFO)
  • -i input, can be file or device name
  • -el a LADSPA effect (unique name, parameter-1,,,parameter-N)
  • -km MIDI control (parameter number, minimum value, maximum value, controller, channel)
  • -o output, can be file or device name

Figure 3 displays ecasound's informative status report on the results of this command sequence.

This line:

-el:delay_5s,0.0,0.50

opens the delay_5s plug-in with the delay time initialized to 0.0 (its value will be dynamically controlled via MIDI) and the balance of wet and dry (effected and uneffected signals) set to 50/50. The next line:

-km:1,0.0,5.0,7,0

binds the first LADSPA plug-in effect parameter to MIDI controller #7 on channel 0 and maps the controller's range to values between 0.0 and 5.0.

I ran the example above with -i:alsa,0,0,0 for real-time audio input and controlled the delay time with a looping controller track on an external sequencer. I set my mixer to record from the CD channel, popped in a disc of poetry readings and enjoyed some rather interesting delay effects upon the spoken word.

Pages: 1, 2, 3, 4

Next Pagearrow





Sponsored by: