a-EQ: DSP bugfix
authorDamien Zammit <damien@zamaudio.com>
Wed, 7 Jun 2017 16:04:12 +0000 (02:04 +1000)
committerDamien Zammit <damien@zamaudio.com>
Wed, 7 Jun 2017 16:04:12 +0000 (02:04 +1000)
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

index 7a15c8a14f3938f1c5e4e094422740ac71e6a6ab..99138fc21c56d496770508afd7e7befd727aaae0 100644 (file)
@@ -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];