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

From: Phil Frost <indigo@email-addr-hidden>
Date: Thu Dec 15 2005 - 20:06:58 EET

On Thu, Dec 15, 2005 at 04:43:31PM +0000, Dan Mills wrote:
> On Thursday 15 December 2005 04:26, 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?
>
>
> I assume that this happens with fast edges on the output of the LFO (like say
> square waves), if so it is aliasing due to the fact that the LFO contains
> components which when mixed with the audio fall outside the nyquest limit of
> bandwidth <0.5 * sample rate.
>
> You should use a band limited LFO or otherwise filter the control signal to
> keep the mixing products from the multiplier within the nyquest limit.
>
> Filtering can work, but it needs to be quite high order to get the highest
> frequency component down far enough, and that introduces problems of its own,
> mainly phase shifts and overshoot.
>
> I would note that rolling the audio off at say 15K or so gives you much more
> available control bandwidth then going over at 22K does (in a 44.1Khz
> system), as in general the sum of the highest audio frequency and the highest
> frequency on the control line must obey the nyquest limit.
>
> [...]

There is truth in what you say, but given the problem described, this is
likely more confusing than helpful to someone new to signal processing.

If the problem is that the input is a low frequency square wave, from a
Low Frequency Oscilator, the popping has nothing to do with the
"nyquest" limit. If the square wave were coming from an ideal source
(which it isn't) then any higher frequency components likely would be so
small as to be smaller than the quantization error.

The problem is simply that it contains high frequency components (under
the limit), or more intuitively, a sudden drop or rise. Drop or rise
more slowly, and the pops go away.

There is no need here for a high order filter here, and no risk of phase
shifts or overshoot. A simple first order lowpass filter will be quite
effective, as will any other simple techniques such as averaging or
changing the LFO function to put more slope on the rising and falling
edges.
Received on Fri Dec 16 00:15:05 2005

This archive was generated by hypermail 2.1.8 : Fri Dec 16 2005 - 00:15:05 EET