Closed timothee-haudebourg closed 6 years ago
Ok so I've been able to recreate your filter on my own.
These are the filter parameters:
a = cutoff/samplerate
f = 1.5 * sin(PI * a)
q = 1.0 - resonance
And if a name x[i]
the input samples, and y[i]
the outputs, we have:
low[i] = f * band[i-1]
high[i] = q * (x[i] - band[i-1]) - low[i]
band[i] = f * high[i]
y[i] = low[i]
So it looks like an IIR filter, but in a weird way. Could you explain the purpose of each variable? What is the resonance
parameter?
Why is there this 1.5
factor on f
?
I've plotted the filter's gain for different cutoff values, and it seems that it's a little bit off:
However if you remove this 1.5
and set f = sin(2.0 * PI * a)
which makes a bit more sense to me (even tho I don't fully understand whats going on), then you hit the cutoff perfectly:
I've tried for several values. Is it intended? The concerned line is the line 255 of jammer.js
:
f = 1.5 * Math.sin(f);
I'm trying to understand why this filter works so well. Is that a well known filter, or did you make it up?
Thanks again!
Found it. It's a digital state variable filter.
Hi,
I dived into the source code, and I'm struggling to understand how the low/high pass filter works. I suppose it has something to do with the
low
,high
andband
variables injammer.js
, but there are no comments here. Could you explain to me what kind of filter you used, and how it is implemented?Thanks a lot.