Circuit modeled filter, how to?

DSP, Plug-in and Host development discussion.
User avatar
WilliamK
KVRAF
4487 posts since 12 Jun, 2001 from Wusik Dot Com

Post Fri Feb 08, 2008 11:38 am

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

fledermaus
KVRer
6 posts since 7 Feb, 2008 from Somewhere in time domain

Post Fri Feb 08, 2008 3:41 pm

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

hifiboom
KVRian
1144 posts since 26 Sep, 2005 from Germany

Post Fri Feb 08, 2008 3:50 pm

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

User avatar
Urs
u-he
23357 posts since 8 Aug, 2002 from Berlin

Post Fri Feb 08, 2008 4:03 pm

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

User avatar
WilliamK
KVRAF
4487 posts since 12 Jun, 2001 from Wusik Dot Com

Post Fri Feb 08, 2008 4:05 pm

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

Gavin@FAW
KVRist
58 posts since 18 Nov, 2007

Post Fri Feb 08, 2008 4:41 pm

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

Rock Hardbuns
KVRAF
1718 posts since 3 Sep, 2003

Post Fri Feb 08, 2008 4:55 pm

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.

User avatar
CC4
KVRian
806 posts since 25 Apr, 2004 from Windsor, Ontario

Post Fri Feb 08, 2008 6:31 pm

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?

User avatar
Aleksey Vaneev
KVRAF
3547 posts since 7 Sep, 2002

Post Sat Feb 09, 2008 5:47 am

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

z_old_account
KVRist
441 posts since 13 Mar, 2002 from Munich / Bavaria / Germany

Post Sat Feb 09, 2008 6:59 am

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!

User avatar
WilliamK
KVRAF
4487 posts since 12 Jun, 2001 from Wusik Dot Com

Post Sat Feb 09, 2008 7:06 am

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

User avatar
khanyz
KVRAF
1554 posts since 16 Jul, 2004 from Deepest Yorkshire

Post Sat Feb 09, 2008 7:57 am

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

User avatar
Aleksey Vaneev
KVRAF
3547 posts since 7 Sep, 2002

Post Sat Feb 09, 2008 8:39 am

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

User avatar
khanyz
KVRAF
1554 posts since 16 Jul, 2004 from Deepest Yorkshire

Post Sat Feb 09, 2008 8:55 am

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.

User avatar
Aleksey Vaneev
KVRAF
3547 posts since 7 Sep, 2002

Post Sat Feb 09, 2008 9:04 am

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

Return to “DSP and Plug-in Development”