Code: Select all
out = in - previousIn + 0.995 * previousOut;
previousIn = in;
previousOut = out;
For a pure square wave, going from -1.00 and half way through going abruptly to 1.00, at the point where is shifts abrupt from 1- to 1, the above DC formula variables contains the following;
Code: Select all
in = 1.00
previousIn = -1.00
previousOut = -.58
After a few iterations of the frequency, the signal settles into a range of -1.26 to 1.26. So the above DC Blocker code actually amplifies the signal.
I should mention my block of samples, buffer size is 512, meaning every 512 samples, I run those samples through the above DC Blocker algorithm.
Is there something I missed, doing wrong or is this just a quirk of the high pass filter / DC Blocker algorithm?
And if that is the way it works, does anyone know of a non-destructive DC Blocker algorithm. One that not only does not filter out low frequencies, and but one that also does neither introduce a bias, nor amplifies the signal?