I use a simple biquad IIR filter :
if (n >= 2)
y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2]
- (a1/a0)*y[n-1] - (a2/a0)*y[n-2]
else
y[n] = x[n] // here it probably needs to be modified
(thanks to http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt)
It works very well.
My problem is that the filtered signal sometimes explodes in the first milliseconds, and then returns to normal after a few milliseconds.
How should I initiallize the first values of y[n] ? I have done this
y[n] = x[n]
for n=0,1
, but probably the problem comes from here ?
The problem (it explodes in the first milliseconds) is important when I do 2, 3, or more passes of the same filter in cascade.
Thanks in advance.