From ca815acd6150669347e15114bd6276d5e133ac6c Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Thu, 8 Jun 2017 02:04:12 +1000 Subject: [PATCH] a-EQ: DSP bugfix Previously there were large spurious spikes in the signal when the bandwidth parameter was adjusted on a pure sine tone for the peaking circuits. This has been *greatly* reduced if not eliminated by fixing a typo in two of the equations. --- libs/plugins/a-eq.lv2/a-eq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/plugins/a-eq.lv2/a-eq.c b/libs/plugins/a-eq.lv2/a-eq.c index 7a15c8a14f..99138fc21c 100644 --- a/libs/plugins/a-eq.lv2/a-eq.c +++ b/libs/plugins/a-eq.lv2/a-eq.c @@ -270,12 +270,12 @@ activate(LV2_Handle instance) static void linear_svf_set_peq(struct linear_svf *self, float gdb, float sample_rate, float cutoff, float bandwidth) { double f0 = (double)cutoff; - double q = (double)pow(2.0, 1.0 / bandwidth) / (pow(2.0, bandwidth) - 1.0); + double q = (double)pow(2.0, 0.5 * bandwidth) / (pow(2.0, bandwidth) - 1.0); double sr = (double)sample_rate; double A = pow(10.0, gdb/40.0); self->g = tan(M_PI * (f0 / sr)); - self->k = 1.0 / (q * A); + self->k = 1.0 / q; self->a[0] = 1.0 / (1.0 + self->g * (self->g + self->k)); self->a[1] = self->g * self->a[0];