Circuit modeled filter, how to?

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

Post

aciddose wrote:took me an hour? wait, uh, have you been sitting in your mother's basement this whole time, plotting how to troll and flame on kvr.

i salute you my hairy, trollish little buddy. such unending devotion to one's goals.

ah but i was wrong again; the troll always wins in creating a flame-war. as even when we band together for our common defense we still must engage the troll himself.
http://en.wikipedia.org/wiki/Psychological_projection
An idiot on Set Theory:
"In some cases there is an object called red that contains everything that is red. In much the same way a pot is a plate."

Post


Post

Hmmm, how interesting.
The term troll is highly subjective. Some readers may characterize a post as trolling, while others may regard the same post as a legitimate contribution to the discussion, even if controversial. The term is often erroneously used to discredit an opposing position, or its proponent, by argument fallacy ad hominem.
Ooooh, who'd do that?
An idiot on Set Theory:
"In some cases there is an object called red that contains everything that is red. In much the same way a pot is a plate."

Post

look back at the posts you've made so far in this thread, and point out which one of them covers any part of the subject matter which was being discussed here. i'm not remembering entirely, but your first post may have, i'm not certain. i'm talking about contributing to the discussion though, not merely agreeing with one point or another.

even if we give you credit for that post, i'd think that all your other posts still yield negative karma.

also note that we've now gone completely off topic because of you and your attempts to discuss irrelevant issues in order to incite emotional responses from others.

Post

also, let's go back to what started our disagreement:
aciddose said:
"...as for non-linearities, active circuit elements are going to have fixed curves and you can model in most places with lumped functions..."

andrew said:

Not quite. Most semi-conductor components will have a fixed voltage to current non-linear curve which depends on several variables, which is quite different from a fixed voltage to voltage shape in practice. Non-solid state eg: Tubes are even worse. The easiest case as an example to illustrate this is the simple circuit in most distortion stomp boxes, a diode, resistor and cap. You cannot model this with a voltage to voltage lookup table for the diode and then have a one pole low pass filter, it just doesn't give the right results, but you can make simplifications like this to save cpu if you so choose.
by "lumped function", i'm talking about a shaper or multiples of that shaper combined with filters. this is the definition of "lumped function". you can make approximations if you do not need interactions between linear and non-linear elements by "lumping" components together. for example, doing two integrators does not require that you model every little bit when they're in series. you can model both in the same way as the currents will match for both of them. likewise, modeling series non-linear elements with no frequency modification involved can be done by lumping these elements together into a single table.

andrew stated that it wasnt possible to accurately model his integrator/clamp circuit with this method. i've proven that it is, in fact. i would also say to all of you that it is possible to accurately model, and even more accurately model any circuit using these macro-modeling methods. which is the best method? there are trade-offs based upon the different steps required to implement both methods.

edit:

for the curious i'll outline the most important trade-offs.

electronic component simulation:

pros:
- easy to implement. copy and paste functions or tables of component values as andrew has explained in his post on page #2.
- very accurate in a lot of cases without too much effort in optimization and writing code.
- with the right tools anybody can do this.
- you can claim you're doing 'circuit simulation' and a lot of people will believe you.

cons:
- requires a full and absolutely bug-free implementation. one incorrect change or mistake in any function may ruin all the complex interactions providing stability and throw your simulation into chaos.
- requires that you have a super-computer to model with the same quality in real-time, or you're forced to make a lot of approximations which you might say defeats the purpose.
- many approximations introduce significant error resulting in unstable functions which require either iterative or high-order solutions.
- does not allow you to gain any insight into the fundamental signal-processing functions the circuit is attempting to apply.
- extremely hard to grasp what is going on, making any changes or optimizations requires that you understand the hundreds of functions involved and all the extremely complex mathematics involved in those approximations. imagine hundreds of blackboards filled with strange equations you've never seen before.
- may create a false sense of accuracy. many effects are either not modeled or impossible to model accurately in spice or any other circuit simulation methods.

macro-modeling:

pros:
- very easy to implement for a beginner. you can start at the beginning and implement as much or as little as desired.
- very accurate, if you are.
- very fast, if you spend a lot of time in optimization.
- allows use of methods which apply directly to the medium.
- bypasses the 'circuit' completely and gets to the fundamental functions.
- allows you to understand exactly what is going on in your functions, including all effects.

cons:
- you must be very accurate and tweak your code to produce accurate results.
- often does not lend itself to much optimization, and although it is fast to begin with often requires a great deal of effort to improve beyond this point.
- tends to require intimate knowledge of the systems involved.
- requires that you study and understand the fundamental functions involved.
- requires that you understand exactly what is going on in your functions, including all effects as you must manually implement and tweak everything.
- greatest accuracy requires knowledge of electronic effects which even many engineers have never heard of.

Post

i may be incorrect in my impression under the "pros" section of "electronic component modeling".

andrew states this in his original post, page #2:

"This has been my approach for modeling the ssl g-series bus compressor, and the urei 1176 ln compressor, the sem svf, the sh-101 vfc, the oberheim x-pander vcf etc. I'm pleased with the results, but it is lots of work."

Post

Haha, this thread ftw! \o/
WK, see what you did!!! ;)

Post

aciddose wrote:ultimately his success is decided by sales, not by my opinion.
You said it. I did the circuit modeled (and non modeled) effects in BFD2:

(edit: below is the link to sweetwaters most popular new products, which includes hardware and software)

http://www.sweetwater.com/nowshipping/

Andrew
Last edited by andy_FX on Fri Feb 22, 2008 1:55 pm, edited 1 time in total.

Post

I wonder if we could assume that all methods advocated by various people in this thread have their merits, and maybe have one people with lots of experience actually try to explain how they go about "modeling" or analyzing circuits. I mean, it's one thing to show the end result that you think is a sufficient model of what is being modeled, and another thing to explain how did you exactly arrive at that function.

What I mean, posting an example code can be useful, but it's far more useful to have an explanation of how we move from the analog to the digital, either directly or through an idealized function. Even if the method used involves experimentation in a circuit-simulator, it'd be interesting to see the work-flow of different people, not to mention hear about all the different things that they considered and then either incorporated into their model, or discarded as minor or irrelevant.

I mean there might be people reading this that actually are capable of working simple (or not so simple) examples with currents, voltages, resistances, capacitances, diodes, transistors, whatever... but would still like to hear about the different ways to go around analyzing circuits.

I guess aciddose gave use some sort of explanation several pages back about his method, which was subsequently attacked as requiring advanced knowledge, which IMHO wasn't necessarily entirely fair or useful claim to make, considering that I fully support the idea that SOME knowledge IS going to be necessary. But I also think there might be several methods to go about such a thing, some of which require different types of knowledge from other types, and since I also think some methods might be more suitable for certain circuits where-as other methods might be more suitable for other circuits, it'd be kinda fun to hear about the different methods people use in detail (kinda like if they were tutorials).

Post

andy_FX wrote:
mystran wrote:... though I dislike the part where they say it requires guessing, haha.
When you sort it out for yourself you will see you don't have to guess, what they are really doing is just giving everything a + and - polarity from memory.

Andrew
Yeah I noticed it just uses Newton. Cool for analysis, not so great for low CPU real-time simulation as such (though I guess one could use it where reasonably accurate results can be obtained with low iteration count), though it's an useful technique for figuring out how the circuit works and/or for comparing another model with the expected circuit behavior.

But they still claim it requires guessing (in the first chapter IIRC), and for some reason sentences like that raise a big warning sign in my head, because I absolutely hate mathematics where you have to guess how to proceed (which is actually part of the reason I tend to use symbolic mathematics software a lot).

Post

I'm all for macro modeling, I'm all for circuit modeling, I'm all for having better sounding dsp than some of the current load of tripe that gets peddled as high quality.

When there is a circuit I'm coming to grips with I simulate bits of it in qucs and see what they are up to, then simplify the circuit as much as possible so that it still produces the same effect. This includes lumping components together, replacing chunks with simple equations, or completely removing things altogether. This gives me a deeper understanding of the circuit and the task it is getting done. I further simplify and optimise when I go down to c++ code. I use anything and everything to get the job done. I always compare the models I do to the real deal, the analog hardware version, to make sure I've captured the sound properly.

The hardest bit about doing circuit modeling is not the equations, you can pick them up pretty easily, but it's working out which bits of the circuit matter and make the circuit sound the way it does. But without the math and circuit understanding you cannot make these types of informed decisions.

Andrew

Post

mystran wrote:...I mean, it's one thing to show the end result that you think is a sufficient model of what is being modeled, and another thing to explain how did you exactly arrive at that function.
Very well put. I couldn't agree more.
mystran wrote:What I mean, posting an example code can be useful, but it's far more useful to have an explanation of how we move from the analog to the digital, either directly or through an idealized function. Even if the method used involves experimentation in a circuit-simulator, it'd be interesting to see the work-flow of different people, not to mention hear about all the different things that they considered and then either incorporated into their model, or discarded as minor or irrelevant.
I should have read your post before my last post! I think the best way is to have a couple of simple circuits and run through the steps to getting them first anaysed, then turning into simple c code.
mystran wrote:I guess aciddose gave use some sort of explanation several pages back about his method, which was subsequently attacked as requiring advanced knowledge, which IMHO wasn't necessarily entirely fair or useful claim to make...
I was making the point that aciddose was being contradictory, initially he said you don't need to know any circuit stuff, just use my equations, and when I asked him how he came up with his equations he pointed out a bunch of circuit stuff. So clearly you do need to know circuit stuff to do models which was my point all along.

Andrew

Post

aciddose wrote:andrew stated that it wasnt possible to accurately model his integrator/clamp circuit with this method. i've proven that it is, in fact. i would also say to all of you that it is possible to accurately model, and even more accurately model any circuit using these macro-modeling methods. which is the best method? there are trade-offs based upon the different steps required to implement both methods.
I never said that. Again, you have miss quoted me in paraphrasing what I actually said. Can you please just copy and paste what I have said in future instead of misleading people?

Andrew

Post

i did quote what you said in my post, which you've just quoted.. conveniently taking it out of context by leaving out my quote of your statement. erm?

look, you know what you said. you were not merely trying to say that a specific function wouldn't match that circuit, because you knew damn well that function wasn't the one the circuit provided. you tried to explain that "it isnt so simple, not quite". the code i provided shows that you only need to apply a slightly different, easier to calculate function, in a slightly different way.

just because you have never tried that method doesnt mean nobody else has. that was the first method i attempted after seeing your schematic. i think the problem is that people have no resource where the systems like integrators are explained correctly to them. my function works because (linear - exp) = log. this is what happens in a lossy integrator, you "difference" the input over time.

an integrator is where you sum up the input over time, scaled by some factor. the lossy integrator i've used is an integrator with negative feedback where we instead sum up the "difference", or "change" of the input signal over time.

this is basic high-school maths.. again: (linear - exp) = log.

we can see this is the same function as a r/c circuit because:

V0 0 0v
V1 1 1v
R1 1 2
C1 2 0

i've started to write this stuff by hand, but i haven't got the time so if you'd like to see the functions themselves (useless in dsp once you know the fundamental equivalents) you can check here: http://en.wikipedia.org/wiki/RC_circuit

reduced, this is the same as:
b = in * s + b * (1-s),
b += in * s - b * s,
b += (in - b) * s.

so you only need to realize that the math we're using here is a reduced version of the full calculations to understand that these are the same functions. we could go through and do the full calculations for the circuit with the diode as well, however it just so happens that our reduced function looks like this:

b += (in - diode_equation(b)) * s.

so these are the exact functions to model these components, they're just simplified versions which apply in very specific (yet also very common) circumstance. the argument here is that you'll need to learn all the stuff on that wikipedia page and more in order to derive these facts, however that is not true. we're using a completely different medium here where those components and associated functions are no longer needed. here, we only need to visualize the function and apply as i've called it "basic high-school math" to get the behaviours we want.

when you want to double-check your results, sure, write out the whole functions. i'm just saying that isnt practical to ask a beginner to do, nor is it the logical way for anybody to write dsp code in my opinion as this is a completely different medium. however, as i've said, it may be best for certain individuals to do so, i'm not dictating what anybody should or should not do.

Post

aciddose wrote:andrew said:
...You cannot model this with a voltage to voltage lookup table for the diode and then have a one pole low pass filter, it just doesn't give the right results...
Here, let me quote myself properly and not paraphrase things and give them an incorrect interpretation.

What I have said is true, apart from the fact I got the order wrong and already corrected this by posting the example circuit. You cannot model the circuit properly by having a one pole filter followed by the voltage to voltage transfer function of the diode shaper.

Andrew

Post Reply

Return to “DSP and Plugin Development”