Analogue Modeling Tutorial

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Hi all,

Some have seen it already, I spent some time of my current vacation starting a blog about the things that move me, which currently is Analogue Modeling. While it's far from complete, I've used nice graphics, easy layout and my own (non-academic) language to describe what Analogue Modeling means to me, most predominantly on the example of one pole lowpass filters. If it was a book, today I would have closed the first act by posting hands on source code:

Read in chronological order:

https://urs.silvrback.com/zero-delay-feedback
https://urs.silvrback.com/numerical-integration
https://urs.silvrback.com/analogue-modeling
https://urs.silvrback.com/one-pole-unlimited
https://urs.silvrback.com/one-pole-monster

The future outlook for this will contain use cases for Jacobians, complex component models, part tolerances, prototyping with Qucs, "making it sound good" and what not, but that'll take some time, maybe until my next vacation. In-between I'll probably post my quarterly rant or something, but can't say yet.

Also, I'm hoping for feedback in case I missed something or in case someone would like to share his method of doing things.

Enjoy,

- Urs

Post

this looks great Urs, thankyou!

Post

Thanks for sharing. I glanced over, it'd be interesting to read about your way of treating nonlinearities (later :wink: )
One thing I noticed, you claim that both transistor ladder and OTA result in the tanh difference. From my own investigation and IIRC from Antti's work, OTA results in tanh of the difference, rather than difference of tanh. Do you have any pointers to the derivation of that result? (Or did I miss them in your blog text?)

Thanks,
{Z}

Post

Z1202 wrote:
Thanks for sharing. I glanced over, it'd be interesting to read about your way of treating nonlinearities (later :wink: )
One thing I noticed, you claim that both transistor ladder and OTA result in the tanh difference. From my own investigation and IIRC from Antti's work, OTA results in tanh of the difference, rather than difference of tanh. Do you have any pointers to the derivation of that result? (Or did I miss them in your blog text?)

Thanks,
{Z}
OTA cascades typically result in tanh of difference because they feed into the inverting lowpass and thus get mixed into the negative feedback, while the positive port of the OTA is set to ground.

However, if we assume that iOTA = g * ( tanh(V+) - tanh(V-) ) which I think I liftend somewhere form the internet (Tim Stichcombe maybe?), you do get exactly the same equation as for the differential transistor ladder - if you connect stages through the positive port.

All with grain of salt because reality always diverges from perfect tanh()s, of course.

Post

Analytical is suppsoed to be when you solving the equation analytically, which is not possible in our case, isn't it?
I would call all your "analytical" "numerical".

Still, like your code, quite close to how I implemented my scalar NR as well (still a few C/C++ discrepancies).

Post

Miles1981 wrote:Analytical is suppsoed to be when you solving the equation analytically, which is not possible in our case, isn't it?
I would call all your "analytical" "numerical".
Well I guess the idea is to change the system into something that's possible to solve analytically. I think Mystran's method is a great example because while it's not exactly the same set of equations as those harvested from the nodal analysis, it still retains many of the important properties. Yet it is a system which is solved analytically.

(I might need to add that aspect)

Post

Urs wrote: However, if we assume that iOTA = g * ( tanh(V+) - tanh(V-) ) which I think I liftend somewhere form the internet (Tim Stichcombe maybe?), you do get exactly the same equation as for the differential transistor ladder - if you connect stages through the positive port.
Well, this is total garbage. In a CA3080 style circuit the two inputs are connected to a differential transistor pair so you get a single "tanh" on the differential voltage, which leads to something like iOTA = g*tanh(V+ - V-). The result is effectively slew-rate limiting rather than saturation in the conventional sense.

How significant this is for any particular filter varies, but most of them divide down the input voltages pretty low, so it's not really something that makes such a filter scream (you get some subtle detuning typically and if you push it harder, you just tend to get something resembling a triangle); if they "scream" they practically always do so for some other reason. In fact, the OTA output non-linearity can be much more important if there is significant saturation in the negative feedback path and in some (screaming!) filters it's actually necessary to model this (in one way or another) simply to keep the thing from blowing up!

But hey, let's just slap some random tanh() on the inputs and call it an "OTA model", it's not like most of the people reading are going to know any better anyway.

Ps. I do understand that your intention is to present a method for solving systems, not demonstrate a perfect OTA model, but I don't think it helps anyone to spread information that for all practical purposes is simply wrong.

Post

Well, I wouldn't take anything for granted in electronics :lol: I'll happily fix the OTA formula - it just makes the filter less flexible, but d'oh. In the end, the bleed through of the control voltage might be even more defining for the sound than the positioning of the wvaeshaper.

Post

Urs wrote:
Miles1981 wrote:Analytical is suppsoed to be when you solving the equation analytically, which is not possible in our case, isn't it?
I would call all your "analytical" "numerical".
Well I guess the idea is to change the system into something that's possible to solve analytically. I think Mystran's method is a great example because while it's not exactly the same set of equations as those harvested from the nodal analysis, it still retains many of the important properties. Yet it is a system which is solved analytically.

(I might need to add that aspect)
As Ivan said, it's still a numerical method, as you have to do a numerical approximation before using the analytical solution ;)

Post

Miles1981 wrote:As Ivan said, it's still a numerical method, as you have to do a numerical approximation before using the analytical solution ;)
Hmmm... so the s[n] value that's already there doesn't count?

Interesting. Looks like I'm learning so much from the feedback, I might just have to rewrite the whole thing :hihi:

Post

I mean, analytical is when you are analytically solving the original equation (which is what you said can't work). Numerical solutions is anything that approximates the soltuion through numrical methods, from the one steps methods to the NR methods to more complex schemes. They are all numerical methods.

See for instance http://math.stackexchange.com/questions ... o-problems

Post

Miles1981 wrote:I mean, analytical is when you are analytically solving the original equation (which is what you said can't work). Numerical solutions is anything that approximates the soltuion through numrical methods, from the one steps methods to the NR methods to more complex schemes. They are all numerical methods.

See for instance http://math.stackexchange.com/questions ... o-problems
Hmmm, yeah, I see what you mean.

But wouldn't you say that if the one step methods were looked at isolated from any relation to circuit modeling, they could be seen as analytical?

Post

Well, we are still trying to solve an equation, whether it comes from a circuit or not.
If I was given an equation to solve with tanh(x) + x = 0 for instance, there are no analytical way of solving this. I could go for one of the one step methods, of course, but that would be a numerical method.
I agree that you are analytically solving an equation, but that's an equation derived fromt he original problem where you are assuming different things to ensure/hope that the solution is numerically close to the original one. Hence the term numerical, and not analytical IMHO.

Post

Miles1981 wrote:Well, we are still trying to solve an equation, whether it comes from a circuit or not.
If I was given an equation to solve with tanh(x) + x = 0 for instance, there are no analytical way of solving this. I could go for one of the one step methods, of course, but that would be a numerical method.
I agree that you are analytically solving an equation, but that's an equation derived fromt he original problem where you are assuming different things to ensure/hope that the solution is numerically close to the original one. Hence the term numerical, and not analytical IMHO.
There is an interesting terminological detail in regards to what can be considered an analytical solution.

Think that tanh cannot be directly computed using machine code instructions either. It is using a numerical method implemented in the library.

Thus, when we say "solve analytically", we actually mean "express the solution as a finite combination of the standard functions and operations".

An equation of the form ax+tanh(x)=0, if solved against x with parameter a, implicitly defines a function x=f(a). If we implement a routine for computing this function, then we can formally add f(a) to our set of standard functions and say that we have an analytical solution of the equation. It's really just about which functions you have in the library and which you don't :D

Unfortunately, in practical nonlinear ZDF equations these functions have more than one argument. Therefore they cannot be easily tabulated. Still, a numerical solution method, encapsulated into a library function, could be viewed as an "analytical solution". The problem is how reliable is this function implementation in the sense of
- does it give correct answers for all possible parameters?
- how does its computation time (convergence speed) depend on the parameters?

The library functions typically are expected to give correct answers for any parameter values in the function's domain and have "reasonable", close to constant, convergence time. Now, does the same hold for our ZDF solution algorithms?

:D :D :D

Post

This is a great idea and awesome gesture, will be reading tonight. Thanks Urs!

Return to “DSP and Plugin Development”