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.
On a semi-related note, can someone recommend any Free
libraries in C
or C++ that implement things like oscillators, filters, etc.?
LibDSP?
Also some good stuff in gnuRadio.
Regards, Dan.