Vuvuzela Filter with Ubuntu Lucid, PulseAudio & LADSPA – Help Needed

Everybody loves the World Cup 2010 in South Africa, especially we Germans since La Mannschaft showed the best football against Australia so far, with 616 passes and four brilliant goals in one football game! A few friends of mine and me enjoyed the game in my VDR/HDTV home cinema.

Ubuntu Lucid + ALSA + LADSPA + PulseAudio = Fail
However, it is very regrettable that the Vuvuzela destroys the typical stadium atmosphere. Because these trumpets have a very distinct noise frequency, they can be filtered out using LADSPA, and a few notch filters from the LADSPA VCF plugins at the resonance frequency and its harmonics. As soon as I succeed, I will publish the HOWTO.

Unfortunately, I was unable to use the LADSPA ALSA plugin together with PulseAudio under Ubuntu Lucid. That’s why I am asking you for help: I am unable to get even simple LADSPA filters to work with ALSA under Ubuntu Lucid. I tried to follow the ALSA wiki, and created a delay LADSPA filter in ~/.asoundrc:

pcm.ladspa {
type ladspa
slave.pcm "plughw";
path "/usr/lib/ladspa";
plugins [{
label delay_5s
input {
controls [ 0.8 0.3 ]

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

However, whenever I use

aplay -D pladspa /usr/share/sounds/alsa/Front_Center.wav

it yields

ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM ladspa
aplay: main:608: audio open error: File exists

while for nonexistant PCMs, I get

ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM randomtest
aplay: main:608: audio open error: No such file or directory

Maybe somebody involved into PulseAudio and / or Ubuntu Lucid could tell me what’s going on? A related Ubuntu bug report doesn’t give any details. I am happily awaiting your ideas!

The PulseAudio Equalizer that allows direct integration of PulseAudio and LADSPA creates playback glitches on my machine.


Thanks for all your comments. Despire the fact that broadcasters now filter out some of the Vuvuzela noise (IMO they their filters are not strong enough), the following conclusions remain:

a) The most convincing filter prototype for notch filtering is used by sox, as pointed out by Yusuf. It is a simple biquadratic filter based on Robert Bristow-Johnson’s great Audio Cookbook, and yields great results! However, sox is a stand-alone application and does not seem to be integrated in any real-time processing library chain. However, you can use it in a loop-through fashion (mic input -> sox -> speaker output) as described in Yusuf’s blog. It also seems to include pulseaudio read/write routines, but I am not sure whether it can be used as a pulseaudio module – that does not seem to be the case.
b) The narrow band-reject filter prototypes used by LADSPA (“Mag’s Notch Filter”: “notch_iir” from, “VCF Notch Filter”, “vcf_notch” from are worse, at least I could not trim them to yield comparable results. Many links can be found in the comments to solutions involving LADSPA filters, the PulseAudio equalizer or some other solutions that yield very suboptimum results. However, they work in real-time.
c) It is very unfortunate that to my knowledge there is no way to specify arbitrary IIR filter prototypes for audio filtering on Linux, neither with LADSPA nor with Jack, PulseAudio or anything else.
d) We really lack a port of sox’s filters to LADSPA, PulseAudio, or some way to directly invoke sox’ great routines from the audio chain.
e) If you need LADSPA on Ubuntu 10.04, you have to use the Jack audio server, qjackctl for controlling it and jack-rack for inserting the filters (related links in the comments). Also, the audacity audio file editor allows to apply LADSPA filters. There does not seem to be any way to use them directly with ALSA (i.e. using asoundrc), as pointed out in the comments. However, you can use them as PulseAudio module, as the PulseAudio Equalizer does.

I now came up with an ugly solution that happens to work in my scenario: Route the unfiltered sound to a second computer which runs sox, and processes the sound as described by Yusuf under a). This only works if you have a high-quality sound card on your second computer, and I happen to own an old SB Live! 1024.

Further comments on Linux audio are appreciated!

18 thoughts on “Vuvuzela Filter with Ubuntu Lucid, PulseAudio & LADSPA – Help Needed”

  1. For what it worth, this work on my macbook with fedora 13, using a intel-hda codec, so I suggest you to test on other hardwares to see if this is not a problem related to alsa.

  2. Nothing against local culture but that would be great.

    But to be entirely honest, after some time my brain just filters the noise.

  3. If your doing any sort of audio production work I’d figure you’d want to use Jack.

    Then you can run PA on top of Jack so you don’t break your desktop.

  4. I’ve wanted this since the first match, if the broadcasting companies implement it it’ll be a huge goal!

  5. Can you post an audio snippet before and after your proposed filtering, with the filter parameters?

  6. i’ve been playing around with gstreamer to catch a live videostream and apply a notch filter, but can’t get playbin to work with decodebin? anyhone has an idea?

    gst-launch-0.10 playbin uri=”mms://″ ! decodebin name=decode decode. ! ffmpegcolorspace ! ximagesink decode. ! audioconvert ! audiowsincband mode=band-pass lower-frequency=930 upper-frequency=1900 length=501 window=blackman ! audioconvert ! alsasink

Leave a Reply

Your email address will not be published. Required fields are marked *