Cheap non-linear zero-delay filters

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Just for the lulz...here's a first simple model I cooked up using mystrans method. It's a 2-pole lowpass filter with nonlinear feedback, inspired by the Korg MS stuff.

This filter has some sweet spots (I really dig the sound of its self-oscillation), but it needs work. The differential equations I used as a starting point are:

dy1/dt = f*(in - y1 - g(r*y2))
dy2/dt = f*(y1 - y2 + g(r*y2))

where 'r' is resonance, 'g()' is the nonlinear function. Certainly additional equations are needed to improve the sound, I keep it as simple as possible. Any suggestions welcome!

The code:
// evaluate the non-linear gain
double t = tanhXdX(r * yl2);

// solve the linearized system
double denom = f* f * r* t + f *(f + 1) + f + 1;
double y1 =(-f* r *t *yl2 + (f + 1)* yl1 + f* (f + 1)* in) / denom;
double y2 = (f* yl2 + yl2 + f * yl1 + f* f* in) / denom;

// update state
yl1 += f*2 * (in - y1 - r*t*y2);
yl2 += f*2 * (y1 + r*t*y2 - y2);
Last edited by Richard_Synapse on Thu May 24, 2012 3:13 pm, edited 1 time in total.
Synapse Audio Software - www.synapse-audio.com

Post

Damn you Richard - that was exacly the structure that I was desperately trying to solve, you shouldn't make it look so easy :cry: :cry: :cry:

I got stuck on the notion that there is dual feedback from the output - thus 2 diffent denominators! :x

Now my head really hurts.

Post

Richard_Synapse wrote:This filter has some sweet spots (I really dig the sound of its self-oscillation), but it needs work. The differential equations I used as a starting point are:

dy1/dt = f*(in - y1 - r*g(y2))
dy2/dt = f*(y1 - y2 + r*g(y2))
That's exactly the 2-pole filter I use in my synth!
Richard_Synapse wrote:

Code: Select all

// evaluate the non-linear gain
double t = tanhXdX(r * yl2);
This is not strictly in accordance with your equations. Your code realizes a filter with the resonance gain r pre-saturator, while your equations have r at the output of g().
Richard_Synapse wrote:

Code: Select all

// solve the linearized system
double denom = f* f * r* t + f *(f + 1) + f + 1;
double y1 =(-f* r *t *yl2 + (f + 1)* yl1 + f* (f + 1)* in) / denom;
double y2 = (f* yl2 + yl2 + f * yl1 + f* f*  in) / denom;
You don't need solve the whole feedback loop for both integrator outputs. Instead, just solve for y2, then all inputs for the first lowpass stage are available and you can compute y1 in the traditional way (probably cheaper).

Post

karrikuh wrote:This is not strictly in accordance with your equations. Your code realizes a filter with the resonance gain r pre-saturator, while your equations have r at the output of g().
True- fixed :)
karrikuh wrote:You don't need solve the whole feedback loop for both integrator outputs. Instead, just solve for y2, then all inputs for the first lowpass stage are available and you can compute y1 in the traditional way (probably cheaper).
Yeah, I just copy+pasted straight from Maxima.

Richard
Synapse Audio Software - www.synapse-audio.com

Post

karrikuh wrote:
Richard_Synapse wrote:This filter has some sweet spots (I really dig the sound of its self-oscillation), but it needs work. The differential equations I used as a starting point are:

dy1/dt = f*(in - y1 - r*g(y2))
dy2/dt = f*(y1 - y2 + r*g(y2))
That's exactly the 2-pole filter I use in my synth!
so, where does this system come from? is this an RLC-circuit or mass-spring-damper system (which are, if i'm not mistaken, mathematically the same thing)?
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

Robin from www.rs-met.com wrote:
karrikuh wrote:
Richard_Synapse wrote:This filter has some sweet spots (I really dig the sound of its self-oscillation), but it needs work. The differential equations I used as a starting point are:

dy1/dt = f*(in - y1 - r*g(y2))
dy2/dt = f*(y1 - y2 + r*g(y2))
That's exactly the 2-pole filter I use in my synth!
so, where does this system come from? is this an RLC-circuit or mass-spring-damper system (which are, if i'm not mistaken, mathematically the same thing)?
I got it from Antti Houvilainen's thesis:
http://www.dsprelated.com/showabstract/139.php
(Figure 4.4, page 28 )

Post

cool. now that i'm finished with Vadim's book, i needed something new to read anyway. THX. :D
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

I got the rough concept from the Stinchombe paper about the MS10/20. It's not really a MS filter though, the resemblance is just that the output is clipped then fed back into the first capacitor. In the ladder filters the output gets fed back to the input, but this doesn't seem to work well for a two-stage 12dB filter (maybe there's a way but I haven't seen it yet).

Richard
Synapse Audio Software - www.synapse-audio.com

Post

Richard_Synapse wrote:
karrikuh wrote:You don't need solve the whole feedback loop for both integrator outputs. Instead, just solve for y2, then all inputs for the first lowpass stage are available and you can compute y1 in the traditional way (probably cheaper).
Yeah, I just copy+pasted straight from Maxima.

Richard
You can copy-paste the solution for one output, then remove that output from the set of equations/unknowns and resolve. This will give you rest of the unknowns in terms of what's already solved.

That typically results in less work. It's not really ideal, and I already have a method for generating better code, but it's still very much work-in-progress. :P

Post

Richard_Synapse wrote:I got the rough concept from the Stinchombe paper about the MS10/20.
ah - OK, thanks. yes, this must then be the same filter as in Antti's thesis.
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

Richard_Synapse wrote:I got the rough concept from the Stinchombe paper about the MS10/20. It's not really a MS filter though, the resemblance is just that the output is clipped then fed back into the first capacitor. In the ladder filters the output gets fed back to the input, but this doesn't seem to work well for a two-stage 12dB filter (maybe there's a way but I haven't seen it yet).
For two sided RC model:

Code: Select all

  V1 -> ---R---o----C--- <- V2
               |
               v Vout
We observe that voltage over the resistor Vres = V1-Vout and voltage over the capacitor is Vout-V2 (ie Vout = Vcap + V2, Vres = V1-Vcap-V2), so we have

footnote: I'm "measuring" voltages over the components "backwards" from right to left; this is safe as long as it's consistent and saves a bunch of negations.. it makes perfect sense if you think of Vres and Vcap as voltage drops over the components

Code: Select all

 dVcap/dt = (V1-Vcap-V2)/(R*C)
  Vout = Vcap + V2
Discretize (for example) as:

Code: Select all

 yOut = vCap + f*(v1-yOut-v2) + v2
 vCap += 2*f*(v1-yOut-v2)
Observe that in the special case of v2 = 0, this is just the usual low-pass. In the special case of v1 = 0, the output is v2+lp(-v2) which for one-pole is clearly valid high-pass and "vCap" here is just the voltage over capacitor (ie Q/C where Q is the charge stored) and no-longer a ground-referenced absolute voltage (yOut is still ground referenced).

Post

Richard_Synapse wrote:.. the resemblance is just that the output is clipped then fed back into the first capacitor.
Richard
That depends on on which Korg chip your talking about; for the people who haven't yet read Tim's excellent paper, the first version was a Sallen-Key design, the second was an OTA design. The Sallen key had diode limiting in the feedforward path, and the OTA version had the diodes in the feedback path.

In my honestly moronic opinion - your filter looks closer to a Sallen-Key than an OTA. So maybe - for variation - you could move the TanhXdX, and maybe even add the asymmetrical resonace that Tim refers to.

Andrew

Post

Ichad.c wrote:
Richard_Synapse wrote:.. the resemblance is just that the output is clipped then fed back into the first capacitor.
Richard
That depends on on which Korg chip your talking about; for the people who haven't yet read Tim's excellent paper, the first version was a Sallen-Key design, the second was an OTA design. The Sallen key had diode limiting in the feedforward path, and the OTA version had the diodes in the feedback path.

In my honestly moronic opinion - your filter looks closer to a Sallen-Key than an OTA. So maybe - for variation - you could move the TanhXdX, and maybe even add the asymmetrical resonace that Tim refers to.

Andrew
Yeah, I built the Sallen Key version in PSpice, the OTA version I haven't looked at yet. Soundwise the SK version is a matter of taste, however, I only like the self-resonance so I ended up with a mix of both structures. When a signal is driven through the Korg35 chip, it seems to affect both the cutoff and resonance, which is truely weird. Not really a fan of that...also an authentic model of that will be a lot harder to derive.

Richard
Synapse Audio Software - www.synapse-audio.com

Post

Richard_Synapse wrote:.. so I ended up with a mix of both structures.
Richard
Now that's the beauty of digital, we decide what's cool or not :)

Post

they're both the same sallen-key structure. the ota version just uses otas instead of transistors for the trans-conductive elements and does away with the a-symmetrical buffer. the result is that the revised version (in the ms-20 r2) is all odd-harmonic, while the ms-10, ms-10 r1, and ms-20 are balanced even-harmonic with the clipper in the signal path.

the best filter of all is the transistor based without clipping in the feedback path.

http://soundcloud.com/aciddose/resszor
http://soundcloud.com/aciddose/resszorb

(pad mixed in, only the ramp + res sound is of interest.)

the frequency modulation is due to direct modulation of the current through the transistors. the effect is identical to subtracting the signal from the base voltage - you're just changing the VBE.

the feedback is NOT modulated. there is a significant dc offset and the clippers are applied to the dc-biased signal. this results in the clipping having more effect on one side than the other. solution? apply an a-symmetrical clipping.

http://soundcloud.com/aciddose/ressy-pulse
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post Reply

Return to “DSP and Plugin Development”