Here's an allpass implementation that I posted in another thread:
Code: Select all
//initialize states
s1=s2=0.0;
//set coefficients
q = 1.0/q;
g1 = tan(PI*frequency/sampleRate);
g2 = 1.0/(1+g1*(q+g1));
g3 = q+g1;
//process loop
y0 = (input-s1*g3-s2)*g2;
y1 = y0*g1+s1;
s1 = y0*g1+y1;
y2 = y1*g1+s2;
s2 = y1*g1+y2;
output = y0-y1*q+y2;