Re: [linux-audio-dev] "declicking" algorithm?

From: Phil Frost <indigo@email-addr-hidden>
Date: Thu Dec 15 2005 - 17:21:51 EET

On Wed, Dec 14, 2005 at 11:26:34PM -0500, Paul Coccoli wrote:
> Here's a poorly written description of my problem (the code in
> question is written from scratch in C++, BTW):
>
> I have a simple gain function that takes a number between 0 and 1 and
> multiplies each input sample by that number. If I use the output of
> an LFO to get that gain number, I gets clicks in my output (presumably
> on when the LFO output changes by and number close to 1, as it would
> with a pulse/square wave). How can I get rid of these clicks? Do I
> need to "smooth" the output of the LFO, or my processed output? If
> so, what is a good way to do that?
>
> On a semi-related note, can someone recommend any Free libraries in C
> or C++ that implement things like oscillators, filters, etc.?

You could smooth either; it depends on what sound you want. If you want
to change only the amplitude, but not the timbre of your output, your
only option is to smooth the gain input. However, filters on the output
could have a desirable musical effect, too.

One way to "smooth" your gain input is to write an LFO that does not
this:
   ___ __
  | | |
__| |___|

but rather this:

    ___ __
   / \ /
__/ \___/

Another solution is to put either your gain input, or the final output
through something like a lowpass filter. An easy and efficient way to
implement one of these is called an "IIR" (Infinite Impulse Response)
filter, which involves calculating the next output by multiplying some
number of the previous inputs and outputs by some (usually constant)
coeficients and summing them. A google search for various combinations
of "IIR", "filter", and "DSP" should help you find some useful
documentation.

Remember, for any problem, there are many solutions. When dealing with
music, (i'm assuming you are making music here) often trying your own
solutions and algorithms will lead to interesting sounds you did not
expect. Read about DSP and established algorithms, but never be afraid
to try your own.
Received on Thu Dec 15 20:15:07 2005

This archive was generated by hypermail 2.1.8 : Thu Dec 15 2005 - 20:15:08 EET