Circuit modeled filter, how to?

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

Post

aciddose wrote:www.gnu.org
Yeah octave is good, I would recommend it.
aciddose wrote: "Ok, so we will need to learn some basic circuit theory, and some probably something about laplace space you think? How about anything to do with unit delays and z-plane stuff?"

no, no, no, no.
So are you saying you don't need to know any laplace space stuff or z-plane stuff?

Andrew

Post

andy_FX wrote:So are you saying you don't need to know any laplace space stuff or z-plane stuff?
You may need this stuff, but I think that due to causality criterion you may always change capacitive elements into biasing (displacement) elements that displace current/voltage value by a constant that changes on every new incoming sample (frame). Since capacitor is the most 'problematic' element (considering you need to 'dig' the z-plane hardly because of its existence), you may overcome its problem easily that way. Beside that there are no "high-order" capacitors exist: any high-order filter is built from several capacitors (which are always 1st order plus some non-linearity like in ceramic capacitors).
Image

Post

Aleksey Vaneev wrote:
andy_FX wrote:So are you saying you don't need to know any laplace space stuff or z-plane stuff?
You may need this stuff...
So if, for instance, I wanted to get my digital version of four cascaded one poles with feedback to have proper frequency tracking and resonance control like the analog one? Would I need any s-plane or z-plane stuff for that you think?

Andrew

Post

non-linearity in the above mentioned case being a change of the capacitor's flux based upon charge stored across it of course, not the typical thing you think of when hearing "non-linearity". modeling that requires changing the rate of integration based upon the value stored in the integrator plus whatever bias exists.

those effects for the most part however are so small that you do not need to model them in the majority of circuits. certain people like to blow the fact that ceramics are non-linear way out of proportion, usually saying that very expensive metal film capacitors must be used in absolutely every place.

in reality, tantalum is the most common capacitor type for quality audio processing circuits, with aluminum cans the most common in general. metal film deposited polys are only used in sensitive filters or oscillators.

ah, a good thing to note too: when circuit modeling you'll never know just by the schematic that different capacitors are used here and there. they can in some cases make a significant difference to circuit behaviour though! even if for the most part they do not. so to really accurately model anything you must have several years of experience, perhaps some courses in electrical engineering under your belt. you must have design and production experience to understand issues of component costs, and when different types of components should be used; and are in many devices without these facts being shown on the schematics.

an amature can grab any old schematic off the internet and build something with all the same component values, yet get performance which is completely unlike the real device due to all the extra considerations that only an experienced engineer knows to take into account.

unless you are an experienced engineer and already know all this business, you're going to be facing all sorts of problems and dealing with unknowns constantly. this is why again i would advise that a beginner start out with macro-modeling and black-box/node-probing analysis without worrying to much about all these other factors. when you want to become that much more accurate you can look into spending a decade to gain all the skills and experience you need. it becomes an issue of diminishing returns, however, and not everyone has a decade to do such things.

Post

aciddose wrote:non-linearity in the above mentioned case being a change of the capacitor's flux based upon charge stored across it of course, not the typical thing you think of when hearing "non-linearity".
That IS non-linearity, but it's no different from diode or transistor. But at least you'll probably won't need to go into s- and z-plane stuff deeply. Highly non-linear elements still require a lot of oversampling because no non-linear systems solver will do it in one step.
Image

Post

aciddose wrote:the most important things when getting your dsp code to sound "analogue" will be sample rate and quality of control inputs.

no matter how much time you spend fiddling with useless electronic simulation stuff, you'll still have the three most important issues hitting you hard:

1) aliasing!
2) phase error due to group delay
3) choppy control inputs, stepped responses and so on

increasing sampling rate will solve all three of these without any additional effort. as for choppy control inputs, a majority of coders do not seem to realize how important the inputs are. for example, a tb-303 doesnt have a unique sounding filter, it's generic shit. what makes it sound unique is the way it's inputs are connected and the interactions with all other systems in the unit. if you do a '303 filter' and yet never bother to do '303 envelope', '303 amplifier', '303 mixer', '303 oscillator', and most importantly '303 power supply', '303 signal routing / cmos switches' and '303 sequencer', your synthesizer will sound nothing like a tb-303.

it is possible to solve the control input issues without increasing the sampling rate, so long as you put enough effort (aka cpu time) toward the problem. xhip's control inputs for example are perfect - you could output the xhip signals to 'analogue' vco/filter/vca and the results would actually sound better than the original control signals.

the main issue with a lot of 'emulations' is in the fact they're not really emulating anything at all. they figure all they need to do is flop some electronic nonsense over some integrators and call it done. they have absolutely no idea that there are 100s of factors involved in tweaking feedback path, gain into and out of various stages, offsets and all sorts of other stuff.

all the software synthesizers which claim to be 'modeled' suffer from the problems i've listed above. many of them suffer so much as to make them unusable.
I find this post especially interesting and true. I don't know a single digital synthesizer that doesn't suffer from very noticeable aliasing. Nord Lead 2X for example, even though it has much higher than avarage quality antialiasing, it is very often noticeable, especially when you start making things a little complicated, or play very high notes. Same for any digital synth, I simply know nothing that doesn't suffer from aliasing or some kind of character ruining artifacts.

This for example, it's just a saw with a bit of low pass filter, but there is not a single digital synth I know that sounds anything remotely similar, on low frequency/notes, or high. No matter how "modeled" it is. And on notes as high as those in this sample, instead of noise, you get horrible aliasing and plainly bad tone with any digital synth.

Post

Can someone please answer my question above? I don't want it to get missed in the general mish mash: http://www.kvraudio.com/forum/viewtopic ... 57#2952757

Thanks,

Andrew

Post

andy_FX wrote:So if, for instance, I wanted to get my digital version of four cascaded one poles with feedback to have proper frequency tracking and resonance control like the analog one? Would I need any s-plane or z-plane stuff for that you think?
You'll probably just need to oversample and have a pretty simple 'capacitance' into '1st order coeff' converter. Capacitance of capacitor is a given thing (its 'rise' and 'fall' times are predefined), it can't be changed. What can be changed is the amount of energy going into capacitor - that's where resistances work, they do not change capacitor's time characteristics.

If you do not want to oversample, you'll just face the phase warping phenomenon. Of course if you do not want to oversample and have precise frequency/Q control, you'll need to do a lot of other work which basically translates into dynamic capacitance changes.
Image

Post

for the case of a ceramic capacitor though, again we can just macro-model the non-linear effect like this:

d = a - b
b += d * ceramic(c, b)

we have a delay there, but for all practical uses this isnt going to be 'highly non-linear', it'll be a very minor effect more like a subtle fm / self modulation. the majority of ceramics are rated at 200v or so and the real non-linearity only occurs through the full rated voltage range. when these elements are used in a range of 1v (typical) for example they can be considered linear.

you mentioned that this is the same effect as diodes or transistors.. well no. non-linearity in those elements refers to the fact that changes in input voltages correspond to non-linearly mapped changes in response from the device. this is what makes amplification possible at all. you can not use a ceramic capacitor for amplification.

diodes do happen to have the same effect though. the small capacitance of the p/n region in a diode will change it's value based upon the current through the diode. this effect is used in r/f and vhf (to hundreds of mhz) vc oscillators.

Post

aciddose wrote:you mentioned that this is the same effect as diodes or transistors.. well no. non-linearity in those elements refers to the fact that changes in input voltages correspond to non-linearly mapped changes in response from the device. this is what makes amplification possible at all. you can not use a ceramic capacitor for amplification.
You probably didn't get my idea. I'm not looking at diodes/triodes/capacitances as electric elements. I'm looking at them as functions. In that sense, a capacitor modeled as a bias element is no different from diode. Actually, it is much easier to add to system of equations: it's the same as changing DC current voltage on every frame, so capacitor can be modelled as a DC current source connected with resistance in parallel. DC current changes every frame based on previous DC current and current passing through the resistor. Resistor's resistance value and rate of DC current change depends on the original capacitance.
Last edited by Aleksey Vaneev on Wed Feb 20, 2008 3:01 pm, edited 1 time in total.
Image

Post

ugh i should really simplify my explaination here:

in ceramic capacitors a ceramic material is used as an insulating dielectric between the two poles of the device. the ceramic material has the property that it's r/f insulation factor "farads" changes with respect to the charge held across it.

so, only the 'value', or 'flux' of the capacitor is related non-linearly to the charge in voltage held across it. this has to do with rates of change ("flux"), and not with any voltage/current mapping as in semiconductors. the meaning of the term 'non-linear' here is different.

i understand what you're saying about modeling capacitors, i'm just not talking about that. i'm talking about the fact that this is non-linearity in terms of frequency and not in terms of voltage/current.

Post

Aleksey Vaneev wrote:
...If you do not want to oversample, you'll just face the phase warping phenomenon. Of course if you do not want to oversample and have precise frequency/Q control, you'll need to do a lot of other work which basically translates into dynamic capacitance changes.
In this case, where the oversampling amount will not allow for correct tuning then how do I generate a function that I can fit to correct for this tuning? Will I need to use a transfer function at all like H(s) or H(z)? ie: will I have to know any s-plane or z-plane stuff? Anyone else feel free to answer as well.

Andrew

Post

these methods are only that: methods. you can achieve the same results via other methods, so the answer is: no.

do you need to own tennis shoes to play tennis? what about a racket? what about a ball?

when does this become ping-pong?

all very deep philosophical issues for you to consider while everybody else is busy actually playing. you're just upset that i've proven you wrong on your original statement. stop trying to split hairs on issues to make a big fuss, facts are you were wrong. there are other, simpler ways for people to do things. just because you do things in your particular way doesnt make them the only way anybody else can do them.

Post

andy_FX wrote: In this case, where the oversampling amount will not allow for correct tuning then how do I generate a function that I can fit to correct for this tuning? Will I need to use a transfer function at all like H(s) or H(z)?
Yep, in that case you'll probably need to know s- and z-plane math deeply. However, it's not the best way around. You may, after all, just transform the 'basic' 1st order low-pass filter into a higher order low-pass filter with the same slope and pass band group delay. You can minimize the phase warping by means of this filter. If you have this section ready you'll probably won't need s- and z-plane stuff any longer: just use this section if some capacitance is tuned to a higher frequency than you expect (you'll probably need it above 500 Hz already). The phase warping is not a so bad thing considering capacitor also changes phase response. However, at higher frequencies the z's phase warping may go too deep in comparison to the analog phase response at the same cutoff frequency: it is where some adjustment to the original digital 1st order low-pass filter is required (you may probably use all-pass filters for this). But this adjustment can be decoupled from the schematic: e.g. you may use it to adjust the DC current for the next step, without affecting the overall schematic (I'm talking about method mentioned by me before).

Just for your information, I'm taking this from theoretical point of view. I'm sure what I'm talking about should work, but can't guarantee it: as I've said earlier, I'm not into analog schematic modeling that much: I've only spent a lot of time with it just to understand it's not my piece of cake.
Image

Post

(you may after all just sample the impulse response of the capacitor off the circuit - in that case you won't need any z-domain tweaking, at all)
Image

Post Reply

Return to “DSP and Plugin Development”