[MPlayer-dev-eng] [PATCH] [RFC] New audio filter: LADSPA plugin loader

Ivo ivop at euronet.nl
Sat Dec 11 03:23:37 CET 2004


Hi all,

I have written a new audio filter. It allows MPlayer to load and use plugins 
that conform to the Linux Audio Developer's Simple Plugin API standard, 
which is also used by many other high-end audio applications, like Ardour, 
Ecasound and Audacity.

Currently it supports both mono and stereo plugins. For stereo (or more) 
channel input and mono effects, it uses multiple instances of the same 
filter. It's also re-entrant, so you can use as many LADSPA plugins as you 
like.

For more info on LADSPA, see: http://www.ladspa.org/

Computer Music Toolkit (bunch of LADSPA plugins):
http://www.ladspa.org/cmt/

Steve Harris' plugin collection:
http://plugin.org.uk/

I have not updated the manual yet (might need some help there), so here's a 
short explanation:

syntax: -af ladspa=file:label:controls

'file' is the name of the plugin library. It can be a fully specified 
pathname (/usr/lib/ladspa/cmt.so) or, if LADSPA_PATH is set, just a plain 
name (cmt).

'label' is the name of the filter inside the library. The CMT happens to 
include all filters in one library. Steve Harris chose to have a separate 
library for each filter. For example, label can be amp_stereo. If 'label' 
is "help", it lists all available filters for the library specified by 
'file'.

'controls' are zero or more float values that control the filter, for 
example the level of amplification.

That's about it. Just aply the patch, copy af_ladspa.c and ladspa.h to 
libaf/., recompile, install some plugins and test :-) On default verbosity, 
the plugin is fairly silent. If you want to see what it does (and I 
recommend that!), add -v to your commandline. For example, it displays the 
valid ranges for each control. That might be useful, in case you don't have 
the LADSPA SDK installed and can not run its 'analyseplugin'.

CMT Examples:

Amplify by 0.5:
-af ladspa=cmt:amp_stereo:0.5

Limit peaks to a quarter of their height:
-af ladspa=cmt:limit_peak:0.25:0.1:0.1

Put your laptop inside the Grand Canyon:
-af ladspa=cmt:canyon_delay:0.4:0.6:0.4:0.6:4000

I like Steve Harris' plugins better. They are more effective and sound 
better. More examples:

Compress the sound to -24dB and slightly amplify afterwards:
-af 
ladspa=dyson_compress_1403:dysonCompress:-24:0.25:0.5:0.5,ladspa=amp_1181:amp:8

HQ Limiter, limit to -16dB and amplify to original level again:
-af 
ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:0:-16:0.8,ladspa=amp_1181:amp:16

The last filters are very handy with badly mastered DVD's or movies in 
general that have very soft and very loud passages (you know, you have to 
grab the remote and turn down the volume rapidly to not disturb the 
neighbours at night).

Add ladspa=vynil_1905:vynil:1927:78:0.9:0.5:0.1 to make it sound like a 
78rpm record from 1927, havily scratched, on a medium stable recordplayer 
and almost not worn-out :-)

You can also create a whole line of filters (compressor, chorus, flanger, 
delay, reverb, amp), play line-in from your soundcard and have your 
real-time guitar effects.

Anyway, I think you get the point. Lots of plugins to choose from and play 
with. Attached is the patch. Any comments?

If nobody objects, I'll commit it after the weekend. After that, I'll work 
on the manpage.

--Ivo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cvsdiff-u.af_ladspa
Type: text/x-diff
Size: 3079 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20041211/427c3042/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: af_ladspa.c
Type: text/x-csrc
Size: 32942 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20041211/427c3042/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ladspa.h
Type: text/x-chdr
Size: 27593 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20041211/427c3042/attachment.h>


More information about the MPlayer-dev-eng mailing list