Vuvuzela Filter with JACK and JACK Rack under Linux

14 June 2010, 10:53 AM | Comment (7 comments)

After having read this post on filtering the annoying Vuvuzela sound using Logic under Mac OS X, I tried to do something similar using Linux and came up with a solution employing JACK, JACK Rack, and some LADSPA plugins as filters.

The Vuvuzela base tone is at 233 Hz. Using bandreject filters to damp this frequency along with its first few harmonics at 466 Hz, 932 Hz, and 1864 Hz, filters the "beehive" humming pretty effectively.

I'm using MPlayer as my frontend player, but it should work the same way with any player that supports audio output to JACK. Likewise, it should be possible to connect the line-in port to JACK and so achieve the same as described in the original post.

I'm using Arch Linux. Except for JACK itself it had nothing of the needed software in its repositories, but it was straightforward to compile and install those myself (Update: As it turns out I just didn't look carefully enough, Arch has everything except JACK Rack). So first you'll need to install:

Install those from your distribution's repository or from source. Except for JACK, I had to install everything from source, but a simple "./configure; make; make install" did the job in all cases. No manual tweaking necessary. I could install everything except JACK Rack from the Arch repositories, apparently it is possible to install JACK Rack from AUR, I haven't tried that though.

Once you have it all, from the commandline, first start the JACK daemon:

$ jackd -d alsa

Now start your player and configure it to use JACK as audio output device. I have a USB DVB-T device connected to another machine and stream from there, to actually watch it I use MPlayer:

$ mplayer -ao jack http://192.168.2.3:8080

When a new client connects to JACK, it seems as if it automatically connects the client's output directly to the system's playback input, i.e., without any processing the mplayer output goes directly to the speakers. We can check that using QJackCtl:

$ qjackctl

Click "Connect" to see the current wirings:

Now start jack-rack, which will at first be an empty effects rack:

$ jack-rack

If you'll check the "Connect" window of QJackCtl again, you'll notive that jack_rack has registered its output and input ports. To put JACK Rack in the loop, first choose "Disconnect All" to remove the direct connection from MPlayer to system:playback. Then connect MPlayer out (on the left) with jack_rack in (on the right). This can be done via drag'n'drop. Next, connect jack_rack out (left) to system playback (right). The resulting wiring should look like this:

Now that we have JACK Rack in the loop, all that is left to do is configuring it.

Via Add / S / Single band Parametric add four filters to the rack, one for each harmonic we want to filter. Set the parameters according to the following, I experimented with the Bandwidth parameters a bit, the settings from the screenshot worked best for me:

And that's it! You should have a nice Vuvuzela-free audio signal now!

Here's the original snippet from surfpoeten.de and filtered through JACK Rack. I think the result is pretty much the same:



Before:

Your system seems to not support this version of the flash audioplayer.



After:

Your system seems to not support this version of the flash audioplayer.

Update: In the comments someone suggests letting mplayer itself do the filtering:

$ mplayer -af pan=1:0.5:0.5,sinesuppress=233:0.01,\
sinesuppress=466:0.01,sinesuppress=932:0.01,\
sinesuppress=1864:0.01,sinesuppress=232:0.01,\
sinesuppress=465:0.01,sinesuppress=931:0.01,\
sinesuppress=1863:0.01,sinesuppress=234:0.01,\
sinesuppress=467:0.01,sinesuppress=933:0.01,\
sinesuppress=1865:0.01 file.mpg

Additionally, a lot of other guides have surfaced. Here someone came up with pretty much the same solution as mine, except he uses line-in as source. Using VLC you can do the same as with mplayer (German). Here's a (multi-platform) solution using PureData. And finally in this thread (German) someone came up with something using sox.

Category: english, linux

Spam is a serious problem

04 October 2009, 12:25 PM | Comment (0 comments)

I was told so before but didn't really believe that once I put a website online that people can leave comments on spammers would come and add spam faster than I can delete it. Now it actually proved true, I don't feel like going to the database each day, so for now commenting is disabled. I will have to come up with a solution for that. Not yet sure captcha is what I want ...

Category: english, website

New site launched

13 September 2009, 05:28 PM | Comment (1 comment)

So finally my new website is online. Here's not much yet, and still lots of functionality needs to be added. However, I think that I just have to get it live to be somewhat pressed to continue working on it.

I'm in Cyprus right now, tomorrow ICANN 2009 will start. That's the main reason for having a need to get this online, in my paper there will be a link promising source code. ;-)

I think I will write here about all sorts of things, both in English and German, depending on who the audience will be. I'm also planning to "localize" more of the site, so far everything's English, I guess that'll work for now. Posts will have technical subjects, probably both, related and non-related to my work, and non-technical ones, whatever I want to get out.

Software-wise I decided to roll my own solution here because every blogging software I've seen so far had some limitation that I didn't like. It probably would have been easier to just patch some existing software to make it do what I want it to, but I see this also as a good chance to learn about new technology. It's always more fun with a real project, otherwise you don't really do it. So for this site that's Python and the Pylons framework in particular for me. So far I like it quite a lot!

Category: english, website