Ladspa (plugin)

From the ALSA wiki

See http://www.ladspa.org/ for an overview of
LADSPA. Using LADSPA plugins for standard alsa apps has many uses. My
motive to get this working is so i can use a compressor when playing
movies with mplayer.

There is a "ladspa" plugin available for alsa's pcm plugin layer. See
.asoundrc for and overview on how to edit this
configuration file..

Here's an entry from the asoundrc.txt included in the alsa-lib source
package (It searches the "/usr/lib/ladspa" directory for a .so file that
has the plugin "delay_5s" stored in it. The controls section sets the
delay time and the dry/wet level i think):

Using aplay -Dplug:ladspa some_sound_file.wav will play this file with
the requested delay. To save the "plug:" prefix we can just define
another pcm device called "pladspa":

pcm.pladspa {
type plug
slave.pcm "ladspa";
}

We can use this pcm device by using
aplay -Dpladspa some_sound_file.wav

The usage of the plug plugin is important because LADSPA plugins only
can han handle FLOAT data. Most sound data is usually saved as some sort
of Integer data..

Ok, back to my objective. Getting compressed sound out of mplayer. I can
use the above pcm device for playback with mplayer:

mplayer -ao alsa:device=pladspa some_movie.avi

All alsa apps that can be configured to use a specific pcm device should
be compatible (i have to use "-abs 1" to make mplayer work with any
pcm-device. Depending on your hw this might be necessary, too). So
installing a compressor should just include finding the right label
string for the above pcm.ladspa definition and setting the parameters
appropriately..

Ok, i found the "Dyson Compressor" and here is my corresponding
.asoundrc entry:

If somebody might have a hint on how to set the parameters to
effectively compress typical movie audio streams, so they loose some of
their dynamic range (nice for watching movies late at night, so they
don't wake up the neighbours at loud spots), please add them here :)

kokoko3k

You could add a limiter after the compressor and tweak some parameters.
The one i'll use is fastLookaheadLimiter (from swh-plugins). My
.asoundrc follows:

As you see, the sound is first "smoothed" by dysonCompress slowly
(release time=1) then it is passed to fastLookaheadLimiter which pumps
it with 20db and limits it to 0 db. If you feel that this filter is too
strong, you may want to lower the input gain replacing

controls [ 20 0 0.8 ]

with

controls [ 10 0 0.8 ]

And so on, then play with mplayer:

mplayer MyNotSoLoudMovie.avi -ao alsa:device=ladcomp

tapas

You can find out which plugins you have on your system by installing the
ladspa-sdk (at least that is the name of the Debian package).

listplugins -- prints out a list of all plugins found in
LADSPA_PATH.

analyseplugin -- gives you details about a plugins i.e. what
controls exist

applyplugin -- applies a plugin to a wav file to hear how the plugin
sounds

jzedlitz

I figured out that many of the swh-plugins (like buttworth-bandpass
filters) are only working with recent versions of alsa-lib. With 1.0.3b
I got segfaults. After a change to 1.0.5 they are working fine!

julian

Since Alsa 1.0.11rc2 multichannel Ladspa plugins can now be used

rob

When using ladspa plugins in .asoundrc as above, aplay says:

aplay: set_params:860 Broken configuration for this PCM: no configurations available

What is wrong?

michael

A configuration for listening to highly dynamic (classical) music

I happily found this wiki page while searching for a way to listen to a
certain CD by Leonard
Bernstein
with a huge dynamic range to be compressed. Normally, I like to
leave the audio material untouched, but in this situation I wanted to
listen to it while working without disturbing my office neighbours.
Based on the documentation above, I figured out how to do it and I'd
like to share my results with you.

To play around with different ladspa compressor plugins and different
parameter settings, I set up a
Jack chain
with Amarok as the source. Of course, I had to select the Jack sink in
the Phonon settings to do so. The output of Amarok is fed into
Jack-Rack and its ouput is fed into
the system's sound card. I got the best results with the
se4_1883
compressor plugin with the following parameter values. BTW: The
different ladspa collections available on a Debian system are listed
here.

To make the virtual sound sink be usable with Phonon (the sound system
of KDE 4.x, for example used by Amarok you have to
add this "hint" block with a
description to your PCM entry. You can then select the virtual sound
sink you just configured in Amarok / Phonon by its description.

Please be aware that it now makes a difference whether you change the
volume in your player (e.g. Amarok) or you change the master volume. The
higher the volume in your player, the stronger the compression—and vice
versa. Micu 05:20, 26 March 2010 (EST)