Analogue Modeling Tutorial

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

mystran wrote:Here's what I want to say about math: it's not hard.

...
yes... :tu:

articulated nicely. :tu:

I would add/emphasize/reiterate that visualizing things geometrically using graphing apps, helps the process tremendously!

and Wolfram Alpha (aka Mathmatica) is F-ing awesome! Also, OSX Gapher is an incredibly useful/powerful little tool I use personally daily too. For free!

Try to visualize and think geometrically whenever possible... (you even see this trend in the uber stratosphere of math geekery where the super geniuses get into the geometry of number theory and algebraic geometry and other such seemingly quite bizarre ideas.) It makes thing much easier than reading a bunch of symbols in a white paper and trying to figure out what it all means. Visualization is the key IMHO.. Once you can visualize it, the symbols and their interactions will make sense...


And nice tutorial/paper Urs! Cool stuff! :tu:

Post

Great advice, indeed!

I think I might also do a quick tutorial on Computer Algebra Systems. I use Maple, which I chose because it seems to enforce more "readable" worksheets than Mathematica, and it gives me a more comfortable interface than wxMaxima. Comfort is important to me, because I don't know much about this stuff. I need things to be so that a context menu shows me most of the actions I can perform.

Lately however I've seen many little CAS apps pop up. I've tried one for iPad (forgot the name) and it essentially does all I'd ever need (just on iPad, which doesn't let me drag and drop code/equations into Xcode).

Oh, the thing that Andy uses to create his papers is Mathematica. The key to understanding them I think is to work out the /. operator aka "slash-dot". It's used to replace an expression in one term with another expression. It's like inverse C++ templates, where you first write your template as if it was typed out, then change the types in retrospect. I hate it for lack of readability, but admittedly it does keep things very compact. Other systems have other means to do this, but they usually show the steps in-between.

Post

Urs wrote:I think I might also do a quick tutorial on Computer Algebra Systems.
You probably should, although I don't think it really matters which one you use. Most of them can do a whole lot more than you usually need anyway. I'm actually a terrible CAS user because I never really bothered learning how to do any scripting in any of them, I just use them for all the tiny things like simplifying expressions, working out integrals, solving sets of equations .. and obviously plotting stuff. :)

Most of the time I personally use Maxima, but that's mostly because I'm used to it. I definitely agree that the interface could be better (and the OSX version of wxMaxima seems pretty much just broken), but it works well enough for me (on Windows anyway). Sometimes I also use Mathematica a bit, simply because it can do some things better than Maxima (although when Maxima gives up, the result you get from Mathematica is usually useless for any practical purpose anyway), but I find the syntax a little confusing.

Post

I use Mathematica primarily as well (although I still have a love for OSX grapher for simple visualization), and yes, the syntax is a PITA sometimes...

Sometimes I cut/paste the same problem into Wolfram Alpha (which does its computation using the Mathematica engine anyway), b/c Alpha is MUCH more forgiving about incorrect syntax etc than the app itself. Strange, but true. I mention Alpha above for that reason, and for the reason that you can use it for free for simple problems. As a simple example alpha will understand "sin(x)", while Mathematica will not. It must be "Sin[x]". Mathematica is not real forgiving in this regard.

Alpha is much better at figuring out what you intended to ask. It will also give answers with simplifications for "reasonable assumptions". Mathematica seems to assume you are a math phD and when you ask it a question it tries to give the answer to EXACTLY what you asked over all domains (complex, real ...) and handle all the odd special cases that usually we are not interested in.

Basically Mathematica specializes in Truth, capital T. Alpha specializes in verisimilitude, and that is usually more practically useful for our purposes. :D

And, ya, I probably use 2% of what Mathematica is really capable of. Insanely great program (if you learn to work with its syntax. :wink: ).

It still tends to choke when trying to make it solve complex integrals, but it gets MUCH farther than I could get without it... :tu:

Post

Thanks for the effort so far, really good reading in an easily digestible format! If I might ask, could you dwell more upon the EE->Equation parts, once the equations are down, we have a lot of options but before we get there it is merely an abstraction, especially for us with non-EE background types. The thing that bugs me a lot is the whole buffered vs unbuffered thing, is it a function of material used? A function of topology? Or both?

Post

A buffer can be implemented in different ways. The simplest and the least colored is just an opamp in following mode. Minimal non linearities (IMHO).
A more complex to code is by using just a transistor. It would also not have the same nice qualities of the previous one, but it is the one most usually found in pedals.

Post

Ichad.c wrote:Thanks for the effort so far, really good reading in an easily digestible format! If I might ask, could you dwell more upon the EE->Equation parts, once the equations are down, we have a lot of options but before we get there it is merely an abstraction, especially for us with non-EE background types. The thing that bugs me a lot is the whole buffered vs unbuffered thing, is it a function of material used? A function of topology? Or both?
A "buffer amplifier" for our purposes is any amplifier that has "high" input impedance and "low" output impedance. The "high" input impedance means that it has negligible effect on the circuit from which the input is taken and the "low" output impedance means that it can be treated more or less like a constant source on the output side. What exactly qualifies as "high" or "low" is another thing, but generally when one says "buffered" it is implied that "high" is "high enough" and "low" is "low enough" that we don't need to worry about it.

An easy to understand example would be the one-pole OTA filter where the OTA supplies some current into the capacitor, which the capacitor integrates into a voltage. But if we simply connected the capacitor to something else, then the capacitor would also integrate whatever current was drawn by the rest of the circuit and we don't want that. So instead we use a buffer amplifier to "read" the capacitor voltage and provide it as a "voltage source" to the rest of the circuit. This way whatever current the rest of the circuit needs will be provided by the amplifier rather than the capacitor.

So "buffered" essentially just means "there's something that acts like a buffer amplifier" which implies that whatever happens on the "output" side has little to no effect on the "input" side, where as without a buffer you don't really have a meaningful "input" and "output" because it's all just one interconnected circuit.

Post

Ichad.c wrote:Thanks for the effort so far, really good reading in an easily digestible format! If I might ask, could you dwell more upon the EE->Equation parts, once the equations are down, we have a lot of options but before we get there it is merely an abstraction, especially for us with non-EE background types. The thing that bugs me a lot is the whole buffered vs unbuffered thing, is it a function of material used? A function of topology? Or both?
Hehe, I've linked the Cytomic paper deliberately because the individual items are explained there, I quote:

"Voltage follower

Denoted by a triangle with a 1 in the middle an idealised voltage follower, which is a voltage source that draws no current from its input and reproduces the input voltage at its output. This means that it won’t appear in any nodal analysis equations on the input side, and the output side is a voltage source." [http://www.cytomic.com/files/dsp/OnePol ... owPass.pdf]

This is the "real buffer" I've drawn into the schematic. It simply says, no current is going to flow into it, and thus it doesn't matter for equations derived by Kirchhoff's Current Law. It's also often called a "High-Z buffer" or "High Impedance Voltage Follower". In other words, it's got an extremly high resistance on the input, but the output voltage is the same as the input.

Essentially, the buffer prevents that any current from anything connected at the Vout node can flow into the capacitor. If the buffer wasn't there, we might have to write KCL of the main node as 0 = Ivccs - Icap + Iconnected, with Iconnected being the current available from whatever we wire our filter into.

#---

The "virtual buffer" is something I made up. It's based on 3 resistors that you'll find in the actual OTA based circuits (see CEM3320 datasheet) and which serve two purposes: Firstly to let the OTA work in its "comfort zone" of low input and high output and secondly to make current flowing from the inverting Lowpass input to the node at Vout neglegible.

Thing is, there's a 100k (!) resistor

- in the feedback path, where the virtual buffer is depcited
- between inverting input and feedback path, if connected
- before the non-inverting input, if connected

Simply spoken, the 100k resistor in the negative feedback path makes the OTA amplify the differential input by g * 100000 (woah!). Such that a 100k resistor on the input signals gets this down to original levels. Check out OpAmp tutorials on the net, how the resistors in the feedback determine the amplification factor.

However this also means there are two 100k resitors between Vin- and Vout. Thus, current from Vin- flowing to Vout is *inaudible*, which is the same as adding another buffer, hence a "virtual buffer".

The point being, those resistors do nothing for the equations other than complicating them. Hence they can be left out for sake of simplicity.

Would you mind if I made this into a blog post, including your question? - Maybe I could add some drawings.

- Urs

Post

mystran wrote:
Ichad.c wrote:Thanks for the effort so far, really good reading in an easily digestible format! If I might ask, could you dwell more upon the EE->Equation parts, once the equations are down, we have a lot of options but before we get there it is merely an abstraction, especially for us with non-EE background types. The thing that bugs me a lot is the whole buffered vs unbuffered thing, is it a function of material used? A function of topology? Or both?
A "buffer amplifier" for our purposes is any amplifier that has "high" input impedance and "low" output impedance. The "high" input impedance means that it has negligible effect on the circuit from which the input is taken and the "low" output impedance means that it can be treated more or less like a constant source on the output side. What exactly qualifies as "high" or "low" is another thing, but generally when one says "buffered" it is implied that "high" is "high enough" and "low" is "low enough" that we don't need to worry about it.

An easy to understand example would be the one-pole OTA filter where the OTA supplies some current into the capacitor, which the capacitor integrates into a voltage. But if we simply connected the capacitor to something else, then the capacitor would also integrate whatever current was drawn by the rest of the circuit and we don't want that. So instead we use a buffer amplifier to "read" the capacitor voltage and provide it as a "voltage source" to the rest of the circuit. This way whatever current the rest of the circuit needs will be provided by the amplifier rather than the capacitor.

So "buffered" essentially just means "there's something that acts like a buffer amplifier" which implies that whatever happens on the "output" side has little to no effect on the "input" side, where as without a buffer you don't really have a meaningful "input" and "output" because it's all just one interconnected circuit.
Thanks, that makes more sense now. Kinda reminds me of some crappy guitar pedals.

Urs wrote: Would you mind if I made this into a blog post, including your question? - Maybe I could add some drawings.
- Urs
Yeah sure, sounds fun.

Post

On the CAS front, still prefer wxMaxima, can do everything that I need, the package is small and accessible, free, the newest version can even spit out some c-code, though I haven't tried that yet. Here's a nice plotting example, that I've been meaning to work through that uses some of the concepts we are discussing atm - an analog oscillator:

http://andrejv.github.io/wxmaxima/Example.html


Cheers
Andrew

Post

I quick note about that tanh(x) thing about the input of an OTA.
Assuming that the purpose of the blog is to educate people, I'd prefer that it was explicitly stated it is not meant to be a model of any particular analog circuit. I find incomplete circuits to be confusing. While it is probably obvious to you that these circuits are not actually simulated but just modeled to a level of practically useful accuracy or behavior, it is not so obvious to beginners. Nevertheless I consider this blog to be a practically useful resource, so please continue to write it.
~stratum~

Post

stratum wrote:I quick note about that tanh(x) thing about the input of an OTA.
Assuming that the purpose of the blog is to educate people, I'd prefer that it was explicitly stated it is not meant to be a model of any particular analog circuit. I find incomplete circuits to be confusing. While it is probably obvious to you that these circuits are not actually simulated but just modeled to a level of practically useful accuracy or behavior, it is not so obvious to beginners. Nevertheless I consider this blog to be a practically useful resource, so please continue to write it.
What exactly do you mean? I've thus far fixed any inaccuracies that were spotted.

As for level of detail... many EE textbooks that deal with circuits analysis don't even mention any form on non-linearity, and neither does a plethora of dsp literature. I think we're "good enough" if we start with tanh() wherever picture perfect parts would distort that way.

We have to start somewhere, and that somewhere from the perspective of a developer is by explaining circuits analysis in the most simple form, placement and shape of non-linearities in the most convenient way and whatever it takes to make them overcome the paradigm of Direct Form filters and z^-1 blocks.

This is why I've started with simple one pole filters. More complex designs will follow :)

Post

In my opinion your level of detail is fine. As for fixing inaccuracies, I haven't yet read the latest version, so that comment is about the earliest version which was confusing. There are good accessible books without heavy math about the subject, and there are classical dsp books full of proofs. Both have their places and purpose, so has your blog. Please continue :-)
~stratum~

Post

stratum wrote:In my opinion your level of detail is fine. As for fixing inaccuracies, I haven't yet read the latest version, so that comment is about the earliest version which was confusing.
Ah, okay... no it's fixed, really. I swapped OTA for a conceptual device that does the trick, and I added why.
There are good accessible books without heavy math about the subject, and there are classical dsp books full of proofs. Both have their places and purpose, so has your blog. Please continue :-)
Sure, we're neither trying to design circuit boards nor are we trying to earn PhDs (well, most of us). For music DSP applications we actually really need to get familiar with a very small slice of physics paired with a very small slice of maths. Many times the books and papers contain either too large slices, or even the wrong slices.

In this blog I've started drawing a skeleton of the slices that matter in my line of work, and I hope to learn a lot on the way.

Post

For music DSP applications we actually really need to get familiar with a very small slice of physics paired with a very small slice of maths.
I agree that's what it takes to give someone a level of understanding suitable for doing practically interesting things. Steven W. Smith's book 'The Scientist and Engineer's Guide to
Digital Signal Processing' was the first book of this kind I guess. No it didn't teach me how to make solid rock stable filters, but nevertheless was a beginning that otherwise wouldn't happen.
~stratum~

Post Reply

Return to “DSP and Plugin Development”