summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2017-06-08 02:04:12 +1000
committerDamien Zammit <damien@zamaudio.com>2017-06-08 02:04:12 +1000
commitca815acd6150669347e15114bd6276d5e133ac6c (patch)
tree51ffbb512aada4424eecd2c1d3caf9f7ba574bd2
parentc4a4857b8710654e8b91aa354f602331ed8fc859 (diff)
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.
-rw-r--r--libs/plugins/a-eq.lv2/a-eq.c4
1 files 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];