Circuit modeled filter, how to?

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

Post

Very true. I have some designs if anybody want to negotiate.

Beans Accepted.

Post

Urs wrote:I did the only practical thing: I employed a math-savvy dsp maniac. After three months he came up with a model that sounds insane - and doesn't smoke the cpu too much... good thing is, he also drinks beer and then he sometimes stops talking about Matlab and C++ templates.

;) Urs
Oh I.C. so it isn't your work?

Urs I remember a snipit of a digital filter you had made that sounded like a real analouge pop type reaction at high resonances, almost self resonating, at the time you said, there was no practical use for it, because the computational power it took was too much for it to be practical....

With the new computers we have, does it become anymore practical or not?

Post

@noiselurker: I've improved the design with a few tricks and now it's used in Zebra. It works only on cpus with SSE or AltiVec though... but that's 99.9% I guess

Post

Very interesting topic :D
Modelling of non-linear elements
About this point, somebody knows a good way to start ? I have absolutely no idea about how to model some non linearities from a circuit with resistances and capacitances (they have some non linear models I don't know ???). Or maybe the interesting circuits have other components as transistors and op amps...

Post

Wolfen666 wrote:About this point, somebody knows a good way to start ? I have absolutely no idea about how to model some non linearities from a circuit with resistances and capacitances (they have some non linear models I don't know ???). Or maybe the interesting circuits have other components as transistors and op amps...
It depends upon what you mean my non linearities from a circuit. Whether they are the inherent ones or those caused by the circuit not being perfect.

Resistors, for example, are linear in a perfect world. However, their performance and characteristics (resistance, tolerance ...) changes as they change temperature. They will heat up as a current is passed through them and this imparts non-linear characteristics.

In simplest term, you would treat the circuit as perfect. The next step is to include a simple heat model on the performance. You then hit the complexities of figuring out how heat dissipates and how this will change the characteristics of the circuit.

I would also include a general noise or error factor which you can shape. This is commonly called a 'fiddle factor' and is the key to good science.

It basically layers of maths and how much of it you and your computer can take.

Post

It depends upon what you mean my non linearities from a circuit. Whether they are the inherent ones or those caused by the circuit not being perfect.

Resistors, for example, are linear in a perfect world. However, their performance and characteristics (resistance, tolerance ...) changes as they change temperature. They will heat up as a current is passed through them and this imparts non-linear characteristics.

In simplest term, you would treat the circuit as perfect. The next step is to include a simple heat model on the performance. You then hit the complexities of figuring out how heat dissipates and how this will change the characteristics of the circuit.

I would also include a general noise or error factor which you can shape. This is commonly called a 'fiddle factor' and is the key to good science.

It basically layers of maths and how much of it you and your computer can take.
I see. I had never considered the things like that. Thanks for the tip :wink:

Post

Wolfen666 wrote:Very interesting topic :D
Modelling of non-linear elements
About this point, somebody knows a good way to start ? I have absolutely no idea about how to model some non linearities from a circuit with resistances and capacitances (they have some non linear models I don't know ???). Or maybe the interesting circuits have other components as transistors and op amps...
You need to understand the circuit in order to model it of course.
Isolate the signal path from the control path and analyze the elements.
From a quick look I'd say that the major source of non-linearities in this filter is caused by the OTAs (IC1 and IC2).
Resistance and capacitance variations will have a quite low impact, although noise contributions from resistances may affect self oscillation and similar.

Post

tlr wrote:Resistance and capacitance variations will have a quite low impact, although noise contributions from resistances may affect self oscillation and similar.
Good point. It it important to set yourself a noise/variation level, under which you will ignore. In the maths you can then either remove these terms or set them to a constant value.

The natural cut-off point is the dynamic range you can represent digitally. You could then start at 24 bit (even 16) and move to 32 and 64 bit floats. The more bits requiring more accuracy in the maths.

Personally, I would get all the complexity, and be as accurate, as I could from the start. I hate going back and redoing things.

Post

1) You will need to know basic maths, implicit equation solving methods, numerical integration methods, and z space and laplace space maths. In the end all models linear or not will have a unit sample delay in feedback loops (which are always in analog circuits) that you will need to compensate for. Many numerical integration methods already solve these for you but being able to graph things and check they are all right is very useful and can lead to greater insight into what is going on so you can make better simplifications later on.

2) Not all analog circuits sound good. There are loads of designs which are poor, sound thin, are unstable when modulated etc etc. So first thing is pick a design you know sounds good. Some circuits sound great and are linear, some are highly non-linear to get their sound. Whichever it is, once you analyse the circuit and preserve it's structure you have a fantastic and flexible representation of it that should behave much the same under modulation and steady state.

3) Use qucs to work out what the hell is going on. It is a fantastic circuit modeling program that is free and cross platform. This will also help you to understand some circuit maths.

3) Try to isolate the important components and remove the rest, replacing them with easy linear bits while still maintaining the sound of the circuit. For example in the circuit you originally posted the whole top section is for exponential frequency control from a voltage. You can replace all that with a 2^x call to get your cutoff voltage.

3) Check through the qucs documentation for the equations behind the components you are using and implement the equations in a maths package like Mathematica or Matlab. Qucs (and most other modeling software) uses MNA (Modified Nodal Anaysis) with either trapazoid or implicit euler solvers. This bascially linearises the components via their IV curves at a single point and uses newton raphson to solve the equations numerically for your unknown voltages and currents. You then step in time and do it all again.

4) Transfer the simplified MNA equations into c++ code and simplify and optimise further using intrinsics.

5) Smile when you listen to an amazing analog model that you have created and can re-use in all your future work, and have many instances of.

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.

You can check out the sem svf model in the free synth "Orca" from FXpansion, and you can check out the compressor models in BFD2 from FXpansion. The sh-101 vfc model is not released yet, but you can check out some audio examples here:

--http://vellocet.com/dsp/strobe/

Andrew Simper

Post

"Here's an example of a very complex filter I found"

that's an ota series lossy integrator with negative feedback.. the standard lowpass filter in every synth out there. all the roland synths contain that same filter. the 'moog ladder' is the same circuit, only with a differential diode ladder used for integration rather than the otas. it's all very simple stuff.

actually - that filter is the most simple you can do. proper emulation involves this:

inpt = input - saturate(intd * feedback, fb_sat);
inta += saturate(inpt - inta, int_sat) * scale;
intb += saturate(inta - intb, int_sat) * scale;
intc += saturate(intb - intc, int_sat) * scale;
intd += saturate(intc - intd, int_sat) * scale;

now, you just need to solve the issue of the four sample group delay... :hihi:

one solution is to tweak 'scale' for each integrator. another is to oversample like mad. the most common solution (i consider this a non-solution as it doesnt solve phase) is to adjust 'feedback' based upon 'scale'.

the first two solutions combined will give you the best results.

not to mention the issue of designing a good saturation function - there is aliasing here remember! even with very low saturation values aliasing can have an effect here as it's going to cascade through the stages + feedback.

the multimode filter as used in xhip is slightly more difficult to understand, but there is only a single sample group delay making it far easier to deal with. two-times oversampling will give you "good enough" quality and stability can be maintained despite the group-delay by ensuring a minimum feedback value is used based upon frequency. the coefficients are linear or can be accurately approximated first-order (including compensation) and that makes them much easier (FASTER!) to calculate.

you can place two of these in series while tweaking integration rates 'scale' and 'feedback' to get 24/db. although the phase isnt going to be the same as with the four integrator function it sounds just as good in most cases. main gripe with phase however is that saturation just isnt going to sound the same, nor is it's implementation the same at all.

Post

regarding modeling of non-linearities and temperature dependencies in circuit elements:

currents used in small signal audio processing like subtractive synthesizers are so small that the temperature of the components inside your synth will change more if you fart than if you're running power through them or not. it is a waste of time to bother with these things.

as for non-linearities, active circuit elements are going to have fixed curves and you can model in most places with lumped functions. see my "saturate()" as used above. this shouldnt just be "tanh()", but a combination of functions to approximate all the elements you're trying to emulate in each stage. a lm13700 will saturate differently than the input transistors and diff amp in a moog ladder for example, as will the various combo-ota chips used by roland. the clipping diodes in the feedback circuits will also saturate differently, and it will be wise to use a different function for these. the entire "emulation" of the circuit is going to occur here and in small tweaks to the way bias current through the differential influences transconductance in these various active elements. the non-linear transconductance behaviour will influence only the value of 'scale' for each integrator.

Post

aciddose wrote:...as for non-linearities, active circuit elements are going to have fixed curves and you can model in most places with lumped functions...
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.

Andrew
Last edited by andy_FX on Tue Feb 12, 2008 12:33 pm, edited 1 time in total.

Post

Actually, that's a very good starting point for any circuit modelling. With the diode you could develop your transfer function for the p/n boundary and introduce a noise function to simulate electron movement over the semi-conductive layer. The RC circuit it a staple and so it is good to model it with both linear and logarithmic charging functions for the capacitor.

You could then add a simplified valve for the diode to start you on the vacuum model.

I'll give it a go with my old code.

I'm not sure about all the approximations that are being made. Are they based on CPU usage, development time or knowledge/skill levels?

Also the >=1 sample delay required for feedback. How often can you assume that is the first sample is non-zero, that the zeroth (0th) sample is zero and work from there?

I'm new to this range of applications of electrical components as I've normally dealt with RF frequency circuits but am keen to try it.

Cheers,
Nigel

Post

do you guys actually believe the stuff you're saying?

you can actually model what you're talking about - which would be a diode clamp (two diodes) and r/c filter with simply a lookup table and integrator. it's just that if they're both on the same circuit node you're not going to get that behaviour, you'll get a clamped integrator. there are various ways to connect these elements electronically just as there are various matching ways to connect them in code. if you're meddling with ideas about electrons you're in serious trouble as you'll be attempting to do a physics simulation while forgetting the purpose: signal processing.

the electronic circuit attempts to approximate a function, just as your code will. it requires that you use slightly different methods with the two mediums, however the end goal is the same: that imaginary function that both systems approximate.

Post

aciddose wrote:do you guys actually believe the stuff you're saying? you can actually model what you're talking about - which would be a diode clamp (two diodes) and r/c filter with simply a lookup table and integrator. ...
I can't convince you otherwise if you really think you're right, I'll simply post some graphs shall I to illustrate a very simple circuit in action (for those not up with the circuit stuff v1 is the input signal which is the same for both, v2 is the output voltage of the top circuit and v4 is the output voltage of the bottom circuit which is _very_ different from v2. Note that on the v2 plot there is an asymmetric leading to trailing edge which is key to the interesting sound of this circuit):

Image

You can download and play with the schematic file here:

RCDD-RCBDD.sch

I applogise if I confused you in my previous post by textually getting the circuit not quite right, hopefully the graphical circuit will remove any ambiguities in what I was trying to say.

Andrew
Last edited by andy_FX on Tue Feb 12, 2008 3:33 pm, edited 5 times in total.

Post Reply

Return to “DSP and Plugin Development”