Login / Register  0 items | $0.00 NewWhat is KVR? Submit News Advertise

Analogue Modeling Tutorial

User avatar
Urs
u-he
 
20995 posts since 7 Aug, 2002, from Berlin

Postby Urs; Fri Feb 26, 2016 12:02 am Analogue Modeling Tutorial

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
hibrasil
KVRian
 
705 posts since 23 Jun, 2002, from York, UK

Postby hibrasil; Fri Feb 26, 2016 12:15 am Re: Analogue Modeling Tutorial

this looks great Urs, thankyou!
VirtualCZ | pMix | Endless Series | WDL-OL |Linkedin

Available for Audio Dev tuition via Skype (IPlug/JUCE/C++)
Z1202
KVRian
 
774 posts since 11 Apr, 2002

Postby Z1202; Fri Feb 26, 2016 12:39 am Re: Analogue Modeling Tutorial

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}
User avatar
Urs
u-he
 
20995 posts since 7 Aug, 2002, from Berlin

Postby Urs; Fri Feb 26, 2016 12:54 am Re: Analogue Modeling Tutorial

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.
Miles1981
KVRian
 
1251 posts since 26 Apr, 2004, from UK

Postby Miles1981; Fri Feb 26, 2016 3:00 am Re: Analogue Modeling Tutorial

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).
User avatar
Urs
u-he
 
20995 posts since 7 Aug, 2002, from Berlin

Postby Urs; Fri Feb 26, 2016 3:13 am Re: Analogue Modeling Tutorial

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)
mystran
KVRAF
 
4530 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Fri Feb 26, 2016 3:39 am Re: Analogue Modeling Tutorial

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.
Image <- plugins | forum
User avatar
Urs
u-he
 
20995 posts since 7 Aug, 2002, from Berlin

Postby Urs; Fri Feb 26, 2016 3:56 am Re: Analogue Modeling Tutorial

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.
Miles1981
KVRian
 
1251 posts since 26 Apr, 2004, from UK

Postby Miles1981; Fri Feb 26, 2016 3:56 am Re: Analogue Modeling Tutorial

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 ;)
User avatar
Urs
u-he
 
20995 posts since 7 Aug, 2002, from Berlin

Postby Urs; Fri Feb 26, 2016 3:59 am Re: Analogue Modeling Tutorial

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:
Miles1981
KVRian
 
1251 posts since 26 Apr, 2004, from UK

Postby Miles1981; Fri Feb 26, 2016 5:48 am Re: Analogue Modeling Tutorial

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
User avatar
Urs
u-he
 
20995 posts since 7 Aug, 2002, from Berlin

Postby Urs; Fri Feb 26, 2016 5:59 am Re: Analogue Modeling Tutorial

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?
Miles1981
KVRian
 
1251 posts since 26 Apr, 2004, from UK

Postby Miles1981; Fri Feb 26, 2016 6:05 am Re: Analogue Modeling Tutorial

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.
Z1202
KVRian
 
774 posts since 11 Apr, 2002

Postby Z1202; Fri Feb 26, 2016 6:18 am Re: Analogue Modeling Tutorial

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
userb420
KVRer
 
25 posts since 14 Nov, 2012

Postby userb420; Fri Feb 26, 2016 6:21 am Re: Analogue Modeling Tutorial

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

Moderator: Moderators (Main)

Return to DSP and Plug-in Development