Wednesday, June 16, 2010

Vuvuzela Filter

Here we'll create a filter that removes the vuvuzela sound. We'll use GStreamer (free software) and some of its plugins (also free :)).

Requirements:
  • GStreamer 0.10
  • GStreamer Base Plugins
  • GStreamer Good Plugins
Ubuntu users: install gstreamer0.10-plugins-base and gstreamer0.10-plugins-good through Synaptic or apt-get.

Used files:

As you might have heard about over the web, Vuvuzela main harmonics are at frequencies 233 Hz, 466 Hz, 932 Hz and 1864 Hz. This filter is basically an array of band-reject filters for attenuating (or completely removing) the signal level on those frequencies. For this, we'll be using the audiochebband plugin, part of GStreamer Good Plugins. It's a Chebyshev band pass and band reject filter but here we'll use it in band reject mode.

Vuvuzela complete filter (run in command-line):
gst-launch-0.10 uridecodebin uri="file:///home/dieb/Desktop/vuvuzela_antes.mp3" ! audioconvert ! audiochebband mode=band-reject lower-frequency=223 upper-frequency=243 type=2 ripple=50 ! audiochebband mode=band-reject lower-frequency=456 upper-frequency=476 type=2 ripple=50 ! audiochebband mode=band-reject lower-frequency=922 upper-frequency=942 type=2 ripple=50 ! audiochebband mode=band-reject lower-frequency=1854 upper-frequency=1874 type=2 ripple=50 ! audioconvert ! autoaudiosink
Note that:
  • This filter is attenuating a bandwidth of 20 Hz around the target frequencies. You can tune that bandwidth down (e.g. to 10 Hz, 5 Hz) for a better output sound by setting lower-frequency and upper-frequency properties to -bandwidth/2 and +bandwidth/2, respectively (e.g. 10 Hz bandwidth at 233 Hz, lower=228, upper=238)
  • You can also tune the ripple for a better sound. 50dB is a bit too much, perhaps you can find a smaller value for your setup
Note that this pipeline can be used for filtering live your TV sound through your computer:
gst-launch-0.10 autoaudiosrc ! audioconvert ! audiochebband mode=band-reject lower-frequency=223 upper-frequency=243 type=2 ripple=50 ! audiochebband mode=band-reject lower-frequency=456 upper-frequency=476 type=2 ripple=50 ! audiochebband mode=band-reject lower-frequency=922 upper-frequency=942 type=2 ripple=50 ! audiochebband mode=band-reject lower-frequency=1854 upper-frequency=1874 type=2 ripple=50 ! audioconvert ! autoaudiosink
Connect your TV sound output to your computer microphone/audio input (usually pink or blue connectors) and then your PC output (green connector) back to the TV (most modern TV's have blue-colored audio input jacks on the back panel). That's it. You have vuvuzela-free world cup games :-), for free.

4 comentários:

MBezerra said...

Existe uma forma de usar este filtro numa transmissão livestreaming pela Intenert?

André Dieb said...

@MBezerra

Existe sim. Se a transmissão utilizar algum protocolo implementado no gstreamer. Sugiro testar a pipeline com o uridecodebin e no campo uri colocar o endereço da stream. Bem capaz de funcionar direto.

federico said...
This comment has been removed by the author.
federico said...

hello. i downloaded the files (gsmaster etc.) but i can't open them in windows. How can i do? i'm starting to hate vuvuzelas!!