Sound filtering... with the Gimp!

Make Gimp work as an ideal digital sound filter

Download the whole article as PDF

Short URL: http://fsmsh.com/2541

Write a full post in response to this!


Gimp is universally used for image manipulation. However, with a bit of creativity and a couple of tricks, it can also be used as an audio filter! Here is how…

Sound filters

If you are familiar with sound filters, you can skip this introduction. For those of you who don’t know about filters, here is a brief explanation.

A sound, like all signals, is measured in Hz (Hertz). That measure expresses the signal frequency. The lower the measure, the lower the frequency. A filter is a tool that enhances one or more signal frequencies, according to a criterion. In an ideal world, a filter completely suppresses undesired frequencies. Unfortunately, we don’t live in an ideal world.

A real low-pass filter is something that receives an input signal and outputs its low frequency components

I will concentrate on a single filter: low-pass. A real low-pass filter is something that receives an input signal and outputs its low frequency components. To be more precise, it attenuates those frequencies higher than a set one (the cut-off frenquency). As you see in figure 1, it just approximates theoretical behavior.

Figure 1: Frequency response of real and ideal low-pass filter
Figure 1: Frequency response of real and ideal low-pass filter

In this article I propose a three-step method to achieve an ideal low-pass filter for sound signals. Gimp is the key tool for this method. Of course, I’m cheating: I need to use a program that transforms a sound file into a suitable image. Then, I can “low-pass filter” that image and get back the filtered sound from it.

Note that I put “low-pass filter” in quotes: I won’t get Gimp to apply an image low-pass filter (i.e., a blur operator). But, be patient: in a few lines I’ll unveil the “trick”.

Pre- and post- sound processing with Arse

Before passing it to Gimp, the input sound needs to be processed. I chose Arse as the preprocessing tool. Arse, short for “Analysis and Reconstruction Sound Engine”, is a command line tool divided into two main parts: a spectrographer and a spectrogram synthesizer. I’ll use both its tools to pre- and post-process an audio file. In the pre-processing step I input a sound to Arse, which outputs a spectrogram (that is an image, good to input to the Gimp). In the post-processing step, I provide Arse with the filtered spectrogram, to have an audio file as output.

Unfortunately, generating a signal’s spectrogram and synthesizing it again with Arse won’t lead to the original signal

Unfortunately, generating a signal’s spectrogram and synthesizing it again with Arse won’t lead to the original signal. It means that the method I’m proposing is theorically perfect, but you can’t use it effectively without accepting some sound tranformations (i.e., a bass sound played as a piano sound, or a human voice played as a synthetic voice). Anyway, go ahead: a clever use of Arse will give you pretty good results. I don’t know whether a tool more efficient and reliable than Arse exists or not; if yes, use it and verify the results—and let me know!

Don't miss out on the other pages!
12next ›last »

Write a full post in response to this!

2

Do you like this post?
Vote for it!

Copyright information

This article is made available under the "Attribution-NonCommercial-Sharealike" Creative Commons License 3.0 available from http://creativecommons.org/licenses/by-nc-sa/3.0/.

Biography

Gianluca Pignalberi: Gianluca is Free Software Magazine's Compositor.



CariNet: Cloud computing is a reality.

Other sites

Odiogo

Free Software Magazine uses Apollo, project management and CRM for its everyday activities!