Circuit modeled filter, how to?

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

Post

Guys, I'm wondering on doing a simple low-pass filter that is based on a real analog circuit-modeled one. But I have no idea on where to start. So any advice would be great.

I found some designs over the internet, but to be honest, I don't know how to translate this into math. But not only that, how each component works in real-life.

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

http://www.musicfromouterspace.com/analogsynth/vcf.html

I saw, sometime ago, a program where I could enter such schematics, and could sample how each component reacts in real-life and real-time.

I was hoping I could create models for each component. And latter, translate this all into Assembly with SSE instructions. I did this already for Wusikstation Filters. But now I want to create real-analog filters.

Best Regards, WilliamK

Post

well you'll need a good background in math, especially in Laplace transforms and Z-transforms.
First of all, you must to translate an analog circuit to its equivalent in laplace equations, this give you the description of the circuit in continuum variable.
Then you dicretisize replacing Laplace transform by Z-transform regarding the sampling frequency and all keep in the unity circle (in z domine ).
With this equations you could write the equations for the code.
Per Ardua Ad Astra

Post

if you ever succeed in that I will be interested int the result ...
:)

I guess once you are having these smallest electrical atoms, you'll be able to build various different circuits from them quite quickly.

I'm afraid it would be very calculation heavy algos.
Image

Post

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

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
:lol:

Ohhh yeah...

Maybe I should have asked, how to "wing" it? :hihi:

Wk

Post

The math model is only half the battle, the real challenge is getting it to sound really good. Alot of the character of a filter is in how the resonance behaves during a sweep, the harmonics that it generates etc. This won't come out in your model and to get a realistic sound you will need to tune your algorithm in different ways.

Once you have your model up and running, I'd say the best place to start is to run a real analog filter in full resonance into something like spectrafoo and have a look at how it behaves and how that visual spectrum manifests in the sound. Learning how a spectrograph matches your hearing is very useful, but watch out for tinitus :)

Post

I think modeling the circuit is overkill for a filter, though I admittedly don't know much about them. But unless there is some specific non linear property you are after, I think simply mimicking the curves and parameter responses using a math tool or something like pylab is easier.

Post

WilliamK wrote:I saw, sometime ago, a program where I could enter such schematics, and could sample how each component reacts in real-life and real-time.
...are you looking for filter design software? Something like FilterLab?

Post

I would say: leave it alone, circuit modeling will take much of your time and you won't be able to tweak it later if something goes wrong (it's a great success if you can transform a good-sounding and confirmed complex schematic into digital form and still have it under control - unfortunately it will be either a simple schematic or you'll have to oversample it: frequency warping skews every bit of analog circuitry).

I myself decided to leave it alone since it hinders my creativity without offering anything in return beside a vague marketing benefit.
Image

Post

Good 'analog modeled filters' are hell to develop and implement.

You will come along these problems:
- Stability
- Sample rate independence
- Cutoff accuracy
- Modelling of non-linear elements
- Oversampling
- Performance
- Not everything analog-modeled circuit does sound good
- Floating point accuracy

There are already a lot of 'good' filter algos available in the net. You will need a lot of time and experience to beat them.

As a fellow dev i'd recommend to improve the design and layout of the wusik website. Wusikstation for example is hidden in a menu and there are some display errors on Firefox and IE6. I recommend to place WS with a screenshot on home.
I am using Netobjects Fusion for webdesign. It's certainly not the best editor, but it does a good job for my task. It's a WYSIWYG editor and editing is very comfortable.

But this is just my personal opinion.

Cheers!

Post

Thanks Markus. :cool:

As for the website, I'm waiting for Serif.com to release Webplus X2, so we can update our site with a total new layout. :hyper:

Wk

Post

Without wanting to sound stupid (but usually ending up doing so). Why can't you avoid the transforms by figuring out the simultaneous non-linear differential equations and then solving them in real-time using a numerical method such as Runge-Kutta. It would involve over-sampling to minimize errors propagating through the iterations.

This is the method I used in Uni to build computer versions of Analogical models. The frequency range I worked in was greater than that of sampling and hearing and the results were within the error tolerance associated with noise.

I was actually thinking of doing this myself as I just stumbled on my old pascal code (on 5 1/4 floppy and everything). I am very rusty in this area as I haven't looked at it in years.

Please blast away as it will save me lots of (re)reading.

Cheers,
Nigel

Post

nigel_khan wrote:WWhy can't you avoid the transforms by figuring out the simultaneous non-linear differential equations and then solving them in real-time using a numerical method such as Runge-Kutta.
It sounds like it can be done with Runge-Kutta, but I personally failed to do so (lack of experience in a hardcore math). AFAIK it can be hard to obtain a differential representation of some non-linear functions. Beside that turning a system of non-linear equations into differential form usable in successive approximation like Runge-Kutta 4th can be a bit hard thing to do. I tried with Newton's non-linear systems approximation method and an average schematic turns into a heap of 'step' equations each being pretty huge. I have not compared it to Runge-Kutta method, but they can't be very different.

Probably if there is some non-linear systems 'solver' exists that does not require differential representation, this can be done. I think it's not hard to build a system of equations from a given schematic: you just have to follow three or four electrical engineering rules when doing it; but what is problematic, is solving it in dynamic form (with some member being a random function).

If you know any methods that do not require differentials, please let me know.
Image

Post

Aleksey Vaneev wrote:AFAIK it can be hard to obtain a differential representation of some non-linear functions.
It is hard and you can never avoid that. The beauty is that you are shifting most of the difficulty to developing the differential equations and consequently, making the solution easier to process. In effect you are preloading the solution off-line.

I don't know how applicable this is because I'm used to having serious processing power behind me, but then, I've had to process more data, in more dimensions, at greater frequencies.
Aleksey Vaneev wrote:Probably if there is some non-linear systems 'solver' exists that does not require differential representation, this can be done. I think it's not hard to build a system of equations from a given schematic: you just have to follow three or four electrical engineering rules when doing it; but what is problematic, is solving it in dynamic form (with some member being a random function).

If you know any methods that do not require differentials, please let me know.
I know the rules from my degree but I don't think you can avoid differentials. The random factor could be introduced as a kind of positive feedback error.

I have some free time coming up in the next couple of months so I will look into it. It might be fun to find some use for my degree.

Post

Another important factor that put me off circuit modelling is that circuit modelling is basically design stealing (I assume that any schematic can be 'encoded' as a system of non-linear equations, and the fact you did that encoding does not give you rights to the schematic - you still need the license agreement from the original inventor: it's the same as with language translations).
Image

Post Reply

Return to “DSP and Plugin Development”