Everybody who has listened to any of the great analogue synths from the past should know what I mean.
The 'standard' filter architectures (biquads, SVF, ...) all lack 'real resonance'. Other filters need freaking parameters to correct for resonance issues (and still don't give me what I want).
So I started again using a simple ladder filter build from leaky integrators ( out += f * (in - out) ) using 4 poles. In the analogue world the feedback path is just: connect output with input and use some gain control ... and of course this works, because there's practically no delay for current traveling from 'output' to filter 'input'.
In the digital world, this does not work (as we all know) because of the nasty thing called 'unit delay'. But we can remove that unit delay. The trick is to know the output before it gets calculated.
In pseudo code it would look like this (r is resonance factor):
Code: Select all
out = lastout;
DO
copyRealFilterBuffersToTemp();
newout = tempFilter(input - out * r);
IF ABS(newout - out) < epsilon THEN
copyTempBuffersToFilter();
out = newout;
BREAK // we're done, exit the loop
ENDIF
// epsilon was not reached, continue iteration
out = newout;
LOOP
lastout = out;
Here's an audio example using the above filter with following specifications:
- 4 integrators
- first integrator gets hard clipped to [-1, 1]
- fs = 512kHz
- f = tan(PI * fc / fs)
- r = q * (10 * fc / fs + 1)
- q is in [0.0, 5.0] and filter self oscillates at q == 4.0
You can also use: r = q * (1.0 + f * PI);
It uses less CPU resources than I expected, and the only optimization I can think of at the moment is a nice prediction function for calculation of the initial iteration value.
Nevertheless I love this one ... this is what I call resonance.
Anyways, here is the audio sample (mp3/320).
Feedback appreciated, questions also^^