- KVRAF
- 4979 posts since 11 Feb, 2006, from Helsinki, Finland

Z1202 wrote:Please note that this function is not transparent at small x but large drive.1eqinfinity wrote:Usually I'm using asinh(x*drive)/asinh(drive)

I want to comment on this some more: in general with any waveshaping function f(x), usually you want to use:

(f(x*drive)-f(0))/(f'(0)*drive) where f' is the derivative of f.

For many common waveshapers f(0)=0 and/or f'(0)=1 and these terms can be dropped, but the point is that for small signals f(x) is approximately equivalent to f(0)+x*f'(0) and by subtracting the DC offset and dividing out the slope, the whole thing then approximates identity around zero, so it doesn't affect the filter operation for small values of x.

<- plugins | forum

- KVRAF
- 4979 posts since 11 Feb, 2006, from Helsinki, Finland

I don't want to start a new thread for this, so I'll just share something hilarious here:

When given a search for "ZDF SVF response" (don't ask; I'm sometimes lazy) Google came up with this paper.

ps. in fact it find a bunch of papers from the same field, but I guess that one was highest on my results page

pps. and then when I actually find what I was trying to find, it turns out to be one my own posts in the KVR archives... thanks

When given a search for "ZDF SVF response" (don't ask; I'm sometimes lazy) Google came up with this paper.

ps. in fact it find a bunch of papers from the same field, but I guess that one was highest on my results page

pps. and then when I actually find what I was trying to find, it turns out to be one my own posts in the KVR archives... thanks

<- plugins | forum

- KVRist
- 196 posts since 29 Apr, 2012

mystran wrote:When given a search for "ZDF SVF response" (don't ask; I'm sometimes lazy) Google came up with this paper.

Lol. "obese type 2 diabetic ZDF rat" could be a nice name of an experimental nonlinear structure.

Transposed obese type 1 diabetic ZDF rat with feedback shaping.

mystran wrote: in general with any waveshaping function f(x), usually you want to use:

(f(x*drive)-f(0))/(f'(0)*drive) where f' is the derivative of f.

Doesn't that limit the output range of the waveshaper? https://www.desmos.com/calculator/bscp85uecy

- KVRian
- 954 posts since 11 Apr, 2002

The range can be controlled as described on p.178 (whereas the normalization is covered on pages 175-176)1eqinfinity wrote:mystran wrote: in general with any waveshaping function f(x), usually you want to use:

(f(x*drive)-f(0))/(f'(0)*drive) where f' is the derivative of f.

Doesn't that limit the output range of the waveshaper? https://www.desmos.com/calculator/bscp85uecy

- KVRAF
- 4979 posts since 11 Feb, 2006, from Helsinki, Finland

1eqinfinity wrote:mystran wrote: in general with any waveshaping function f(x), usually you want to use:

(f(x*drive)-f(0))/(f'(0)*drive) where f' is the derivative of f.

Doesn't that limit the output range of the waveshaper? https://www.desmos.com/calculator/bscp85uecy

Yes, but if you want to modify drive without modifying the cutoff (or some other stuff depending on where you place the non-linearity) you just don't really get a choice. If you want to drive the filter harder and keep the same output bounds, then increase the input gain like you would with an analog filter.

<- plugins | forum

- KVRist
- 196 posts since 29 Apr, 2012

Ok, I see. I'm going to add the nonlinearities to the transistor ladder, the driven input will be the first thing I'm going to try then.

I really like the detailed chapter on nonlinearities. Haven't read it thoroughly yet though.

Btw, (I know it's trivial to both of you, but still) I was surprized how nearly in every filter model (including the simple biquad) nonsymmetric waveshapers make sound more interesting, especially on low freq inputs and high overdrives. The dynamics of all those creaks and whistlings becomes different, somewhat depending on the sign of the derivative of the input signal. The two adjacent ramps of perfectly symmetrical triangle input wave get distorted differently.

Upd: I've tried overdriving the input and using transparent waveshapers and I must say that at least for diode ladder model the results are amazing. Filter behaves extremely well! Putting waveshapers in the right places of LPs creates the desired overdrive effect, does not introduce even closely as much aliasing as with nontransparent waveshapers, and last but not least it seems like there are no complex parameter mappings required. Cutoff, drive and resonance control behave almost completely independent even with x32 overdrive, and overall feel of controls is very linear and predictable. Thanks again, guys! Now I have to review some of my previous designs.

Upd2: For transistor ladder this approach doesn't yield such interesting results. Also, asymmetry of the waveshaper doesn't seem to make that much difference with input overdrive. But anyway, the diode model sounds really nice with it.

I really like the detailed chapter on nonlinearities. Haven't read it thoroughly yet though.

Btw, (I know it's trivial to both of you, but still) I was surprized how nearly in every filter model (including the simple biquad) nonsymmetric waveshapers make sound more interesting, especially on low freq inputs and high overdrives. The dynamics of all those creaks and whistlings becomes different, somewhat depending on the sign of the derivative of the input signal. The two adjacent ramps of perfectly symmetrical triangle input wave get distorted differently.

Upd: I've tried overdriving the input and using transparent waveshapers and I must say that at least for diode ladder model the results are amazing. Filter behaves extremely well! Putting waveshapers in the right places of LPs creates the desired overdrive effect, does not introduce even closely as much aliasing as with nontransparent waveshapers, and last but not least it seems like there are no complex parameter mappings required. Cutoff, drive and resonance control behave almost completely independent even with x32 overdrive, and overall feel of controls is very linear and predictable. Thanks again, guys! Now I have to review some of my previous designs.

Upd2: For transistor ladder this approach doesn't yield such interesting results. Also, asymmetry of the waveshaper doesn't seem to make that much difference with input overdrive. But anyway, the diode model sounds really nice with it.

- KVRAF
- 11941 posts since 7 Dec, 2004

Almost every analog filter circuit includes significant non-linearity in the feedback path which is completely independent from any signal path saturation.

I'm not aware of a single filter circuit which does not have independent signal path and feedback path non-linearities.

You have:

All of these are typically different functions with different voltages and currents. Attempting to "model" a circuit with only one (stage feedback or stage buffer) will produce crap results for obvious reasons.

It is especially important to note that the feedback within a stage (integrator) is non-linear itself. Normally in a four-integrator-cascade circuit you have at least four variables. That becomes six if you include input/output high-pass capacitors. The number of non-linear signal and feedback paths within such a circuit is between 12 and 16 in the general case.

The most basic "accurate" implementation requires at minimum that each integrator includes feedback non-linearity and output buffer non-linearity. Typically the input and feedback are based upon a long-tailed-pair saturating and are nearly symmetric. (Can be modeled very roughly using tanh(x + y).) Typically the output buffer is something like a common emitter FET so this effect is entirely asymmetric but often combined with the capacitor which requires an iterative solution. The feedback path is typically a RC high-pass fed into a diode clamp which is again mostly symmetric but not entirely. Modeling a capacitor + diode pair "clamp" circuit is non-trivial and typically requires an iterative solution. Then you need to take into account the different amplitudes and currents of the input signal path and feedback path at the input to the first integrator.

I'm not aware of a single filter circuit which does not have independent signal path and feedback path non-linearities.

You have:

- Stage input
- Stage feedback
- Stage buffer
- Output buffer
- Output clamp
- Output to input

All of these are typically different functions with different voltages and currents. Attempting to "model" a circuit with only one (stage feedback or stage buffer) will produce crap results for obvious reasons.

It is especially important to note that the feedback within a stage (integrator) is non-linear itself. Normally in a four-integrator-cascade circuit you have at least four variables. That becomes six if you include input/output high-pass capacitors. The number of non-linear signal and feedback paths within such a circuit is between 12 and 16 in the general case.

The most basic "accurate" implementation requires at minimum that each integrator includes feedback non-linearity and output buffer non-linearity. Typically the input and feedback are based upon a long-tailed-pair saturating and are nearly symmetric. (Can be modeled very roughly using tanh(x + y).) Typically the output buffer is something like a common emitter FET so this effect is entirely asymmetric but often combined with the capacitor which requires an iterative solution. The feedback path is typically a RC high-pass fed into a diode clamp which is again mostly symmetric but not entirely. Modeling a capacitor + diode pair "clamp" circuit is non-trivial and typically requires an iterative solution. Then you need to take into account the different amplitudes and currents of the input signal path and feedback path at the input to the first integrator.

Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.

- KVRAF
- 4979 posts since 11 Feb, 2006, from Helsinki, Finland

aciddose wrote:The most basic "accurate" implementation requires at minimum that each integrator includes feedback non-linearity and output buffer non-linearity. Typically the input and feedback are based upon a long-tailed-pair saturating and are nearly symmetric. (Can be modeled very roughly using tanh(x + y).) Typically the output buffer is something like a common emitter FET so this effect is entirely asymmetric but often combined with the capacitor which requires an iterative solution.

If you have something that can be considered an OTA (whether that's an IC or some discrete pile of transistors) feeding a capacitor with stabilising feedback (local or global) through a non-linear buffer, then this system is generally not stable unless you also make sure to limit the capacitor voltage. The problem is, once the feedback saturates at a level below input, the OTA will see a "constant" differential DC input. Unless the output voltage is limited to some supply rails, the (unphysical!) OTA will continue to push more and more current into the capacitor and the capacitor voltage will keep climbing, pushing the buffer deeper into saturation and probably eventually running out of floating point range. Adding a tanh (or whatever) at the OTA input will only limit slope and won't be enough to stabilise the thing.

So the minimum you really need for this kind of thing is 3 non-linearities: one for input (if you want the slope limiting), one for the buffer (if you want buffer saturation, which is probably the biggest contributor to the "sound") and then one for the OTA output voltage (the actual output signal, namely current needs to drop to zero once we get too close to the rails). You can obviously hack in the last one by clipping the cap state, but it is critically important to realise that this is what keeps most filters of this type stable in the real-world.

edit: this is really what I was after with the previous OTA remark as well.. the input tanh() just limits slope and isn't necessarily all that interesting in comparison to the crazy stuff that can happen if your feedback paths saturate

Last edited by mystran on Mon Jun 11, 2018 9:18 pm, edited 1 time in total.

<- plugins | forum

- KVRAF
- 11941 posts since 7 Dec, 2004

Exactly, yes.

When I said "very roughly with tanh(x + y)" I didn't make it clear I meant both for input current and saturating the output of the OTA (the capacitor). The buffer for the output however is a bit more complex: sometimes (rarely) an ideal FET input opamp is used so we can just treat this as an ideal buffer by copying the voltage off the capacitor and supplying infinite output current.

In most real circuits however they use a single transistor in common-collector (edit: reversed this, emitter-follower is the common term) configuration. Although most (edit: +J) JFETs have high input impedance and relatively low output impedance, it's not a good idea to over-look the complexity of the contribution of this buffer element alone.

Typically the positive (+voltage) current will be supplied by the transistor but the negative (-voltage) current will be supplied through a resistor. This alone makes the buffer asymmetric without even touching on the fact that input current depends upon voltage, even for a (edit: +J) JFET.

When we get into BJT based buffers which are far more common (see the on-chip LM13700 or BA662 buffer circuits) this becomes even more important and we even see some interference between all three elements: OTA output current, capacitor saturation and buffer input current.

So for anyone who isn't familiar who is aiming to try to set up a "four pole low-pass model": this is not simple at all! Don't expect to get good results without a rather intimate understanding of every component involved. All the individual effects are small, but most of them are equal in magnitude. It isn't really possible to discount any of them if you want an accurate "sound".

When I said "very roughly with tanh(x + y)" I didn't make it clear I meant both for input current and saturating the output of the OTA (the capacitor). The buffer for the output however is a bit more complex: sometimes (rarely) an ideal FET input opamp is used so we can just treat this as an ideal buffer by copying the voltage off the capacitor and supplying infinite output current.

In most real circuits however they use a single transistor in common-collector (edit: reversed this, emitter-follower is the common term) configuration. Although most (edit: +J) JFETs have high input impedance and relatively low output impedance, it's not a good idea to over-look the complexity of the contribution of this buffer element alone.

Typically the positive (+voltage) current will be supplied by the transistor but the negative (-voltage) current will be supplied through a resistor. This alone makes the buffer asymmetric without even touching on the fact that input current depends upon voltage, even for a (edit: +J) JFET.

addendum wrote:This effect is minimal for most JFETs. A 2007 fairchild MPF102 I've quickly tested with LQ equipment showed a linearity within 2mv over a 10v range. Assuming that is equal or better in the negative half of the range (a ridiculous assumption, but still) it gives -74 dB error at full scale of +/-10v.

This is a lot more linear than I remember... I should set up an ideal circuit and test with HQ equipment to be certain but it seems possible the FET buffered circuits likely only receive very little harmonic addition from the buffers alone.

When we get into BJT based buffers which are far more common (see the on-chip LM13700 or BA662 buffer circuits) this becomes even more important and we even see some interference between all three elements: OTA output current, capacitor saturation and buffer input current.

So for anyone who isn't familiar who is aiming to try to set up a "four pole low-pass model": this is not simple at all! Don't expect to get good results without a rather intimate understanding of every component involved. All the individual effects are small, but most of them are equal in magnitude. It isn't really possible to discount any of them if you want an accurate "sound".

Last edited by aciddose on Wed Jun 13, 2018 11:12 pm, edited 2 times in total.

Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.

- KVRian
- 954 posts since 11 Apr, 2002

@mystran @aciddose

It would have been nice if you specified the context for your statements. I totally agree that if you want to make a high precision model of a particular hardware piece, you need (in principle) to analyse all possible nonlinearities. But not just shaping, this can also result in signal crosstalk which might be equally important to get things right. Also, in this context of course tanh might be a too rough approximation (or simply a wrong one, depending on the circuit).

However, if we are on the subject of simply learning how one can use nonlinearities in filter construction your statements can be totally misleading and demotivating to the beginners, leading them to believe that this is a so complicated subject that they shouldn't even attempt it without a vast amount of knowledge. Especially, since both of you have an expert reputation on this forum and people do listen to what you say. In that regard I'd like to make a few comments.

- If you use different nonlinearties in your filter, of course, as a rule, your filter will sound richer. But you can make a good sounding filter even with just a single nonlinearity (and I don't even mean a single-type, but literally a single waveshaper). Maybe it won't sound totally amazing, but it will sound good.

- One can learn a lot from the analog hardware, but your filter doesn't need to model a particular hardware piece. It equally makes sense to construct nonlinear filters in a digital form without a hardware prototype.

- You can use only OTA cutoff nonlinearities and the filter won't necessarily blow up (at least I didn't manage to make it blow up). Even though the nonlinearities won't clip the signal in the main feedback loop, they will de-facto reduce the total feedback gain. Of course adding a feedback path saturation will make sure that the filter won't blow up and make the sound richer, but the filter also works without it.

- Selfoscillation is not the only reason to use nonlinearities, in that sense the question of preventing the filter blowup is not _that_ important. Besides there are nicely sounding nonlinearities which even do not fully saturate and one has to clip the feedback amount to a certain value to prevent the blowup.

- OTA cutoff nonlinearties used alone is probably one of the most boring possibilities, but even that can make the filter sound more interesting. The following example compares a linear 4-pole lowpass ladder filter sound (first) to the one with introduced OTA nonlinearities:

Edit: as the google drive seems to display the full name and the email address of the owner and it also seems one can't hide it (ridiculous!), I'm deleting the link and the file. I hope the ones interested could download it already.

Edit2: it seems I can attach a zipped mp3 to the post

It would have been nice if you specified the context for your statements. I totally agree that if you want to make a high precision model of a particular hardware piece, you need (in principle) to analyse all possible nonlinearities. But not just shaping, this can also result in signal crosstalk which might be equally important to get things right. Also, in this context of course tanh might be a too rough approximation (or simply a wrong one, depending on the circuit).

However, if we are on the subject of simply learning how one can use nonlinearities in filter construction your statements can be totally misleading and demotivating to the beginners, leading them to believe that this is a so complicated subject that they shouldn't even attempt it without a vast amount of knowledge. Especially, since both of you have an expert reputation on this forum and people do listen to what you say. In that regard I'd like to make a few comments.

- If you use different nonlinearties in your filter, of course, as a rule, your filter will sound richer. But you can make a good sounding filter even with just a single nonlinearity (and I don't even mean a single-type, but literally a single waveshaper). Maybe it won't sound totally amazing, but it will sound good.

- One can learn a lot from the analog hardware, but your filter doesn't need to model a particular hardware piece. It equally makes sense to construct nonlinear filters in a digital form without a hardware prototype.

- You can use only OTA cutoff nonlinearities and the filter won't necessarily blow up (at least I didn't manage to make it blow up). Even though the nonlinearities won't clip the signal in the main feedback loop, they will de-facto reduce the total feedback gain. Of course adding a feedback path saturation will make sure that the filter won't blow up and make the sound richer, but the filter also works without it.

- Selfoscillation is not the only reason to use nonlinearities, in that sense the question of preventing the filter blowup is not _that_ important. Besides there are nicely sounding nonlinearities which even do not fully saturate and one has to clip the feedback amount to a certain value to prevent the blowup.

- OTA cutoff nonlinearties used alone is probably one of the most boring possibilities, but even that can make the filter sound more interesting. The following example compares a linear 4-pole lowpass ladder filter sound (first) to the one with introduced OTA nonlinearities:

Edit: as the google drive seems to display the full name and the email address of the owner and it also seems one can't hide it (ridiculous!), I'm deleting the link and the file. I hope the ones interested could download it already.

Edit2: it seems I can attach a zipped mp3 to the post

You do not have the required permissions to view the files attached to this post.

Last edited by Z1202 on Tue Jun 12, 2018 1:54 am, edited 2 times in total.

- KVRist
- 196 posts since 29 Apr, 2012

You know, this kind of discussions could make a nice chapter of really valuable information. Vadim's book have a ton of practical stuff and some explanations of why some things are done in a certain way, but for those who don't have enough theoretical and practical electronics baggage and who'd like to get a deeper understanding (without spending months with a soldering iron), this would be helpful. Not to sound disrespectful, lazy or anything. When I read these explanations I feel like I gain more understanding, but when I evaluate how much time it'd take me to be able to understand it by myself I just don't know if it is practically possible in a foreseeable future

Upd: nice intersection with Vadim's upper comment

Upd: nice intersection with Vadim's upper comment

- KVRAF
- 11941 posts since 7 Dec, 2004

1eqinfinity wrote:Upd2: For transistor ladder this approach doesn't yield such interesting results. Also, asymmetry of the waveshaper doesn't seem to make that much difference with input overdrive. But anyway, the diode model sounds really nice with it.

My comments were in response to this.

You're looking at three or four different signal paths which all have unique effects. So obviously if you apply a non-linearity to one of these it may not seem significant while for the other three it may be very significant.

It doesn't make sense to draw general conclusions with such a narrow focus.

Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.

- KVRian
- 954 posts since 11 Apr, 2002

It's a bit strange to me that the diode ladder model sounds much better than transistor in your experiments. In my experience it's rather the other way around, although this might be subjective.1eqinfinity wrote:Sure it's different. It may have seemed as if I was drawing a general conclusion, but I was referring to the transistor model actually

**Moderator:** KVR Moderators (Main)