I'm getting into DSP lately, and as an exercise I decided to write my own LP filter (or more likely copy it from musicdsp).
It's an 6db/oct filter. It is somehow working but it adds weird bitcrushed noise on top of it. Here is how it works:
Soundcloud
You can hear the drum loop getting actually lowpassed but why the noise? For me it sounds like the previous buffer ends and the current buffer starts on different values, and therefore the clicky noise. But how to fix it?
Code: Select all
double x,a0,b1;
x = exp(-2.0*PI*500.0/GetSampleRate());
a0 = 1.0 - x;
b1 = -x;
for(int i = 0; i < nFrames; i++, input++, output++)
{
*output = a0 * (*input) - b1*tmp;
tmp = *output;
}
Ok I fixed it a bit the problem was that you need to make the tmp variable global and leave it as it is for the next buffer.