Gen~ - BandPass Filter based on Second Order Allpass Filter Topology

PlasticDSP's icon

I can't get this to work, what's wrong with my implementation? It doesn´t sound right.

Resources used:

CalcFreq(hz, Q)
{
	bw = hz/Q;
	omega = tan(pi*bw/samplerate);
	c = (omega-1)/(omega+1);
	d = -cos(twopi*hz/samplerate);
	return c, d;
}

History hist_a(0);
History hist_b(0);


c, d = CalcFreq(100, 3);

input = in1;

feedback = (input+((hist_a*(-d*(1-c)))+(hist_b*c)));
feedforward = (feedback*(-c))+((hist_a*(d*(1-c)))+(hist_b));

final = (-feedforward+in1)*0.5;

out1 = final;

hist_a = fixdenorm(feedback);
hist_b = fixdenorm(hist_a);