Accelerate/vDSP Biquad filter

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

Post

niarn wrote: Can you provide 'the correct' definition of what a SVF is?
Hi Niarn

Maybe my reply is somehow bass ackwards-- Maybe some extremely esoteric abstract mathematical definition (which has always been beyond my pay grade)-- Or merely study common practical analog state variable filters?

For some purposes SVF might be the ideal analog filter. Unless you are too cheap to pay a couple of extra bucks for extra opamps. For instance there are three- and four-opamp common analog SVF variants. The extra opamp in the four opamp variant just adds buffered mixing for the feedback, which makes very easy independent control of frequency and Q. The three opamp version is easy, but the four opamp version is TRIVIALLY easy to adjust. The three opamp model will tend to have interaction between gain and Q as best I recall.

Just sayin, so far as I know, the svf started in analog and generally offers very few problems in analog. Digital is just trying to achieve that same goodness without having to sniff solder fumes. Perhaps you would examine the analog svf for the standard by which a digital svf should be judged?

I can't quickly tonight find an excellent description of the four opamp version, though most features of both variants are the same . So far as I know the extra opamp just makes practical çircuits more flexible and better-performing.

You can build one-opamp second order filters, but I don't think it is very easy to make one-opamp circuits that can perform as good as svf. On the other hand, for applications where modest one-opamp filter performance is good enough, one may be loathe to invest extra parts and circuit board space to solve trivial problems.

This first article seems not shabby in describing analog svf. The second article has a brief discussion on the four opamp variant.

http://www.electronics-tutorials.ws/fil ... ilter.html
https://www.maximintegrated.com/en/app- ... vp/id/1762
Last edited by JCJR on Fri Jan 08, 2016 11:19 am, edited 1 time in total.

Post

niarn wrote: One thing that puzzles me now is in what sense the super duper SVF algorithm is better than the naive SVF algorithm.
From a practical standpoint-- Naive chamberlin digital svf goes unstable at a relatively low frequency. So if the native samplerate is 44.1 or 48 k and you wish to tune the entire audio band, the audio must be upsampled before feeding the svf.

Also, perhaps people have devised workarounds, but from my experience, the frequency cutoff and the phase of the three naive outputs are often not "ideal" enough-- For instance mixing the hp and lp outputs to get crazy-deep notch filters. Or other common tricks made easy by the analog svf multiple outputs.

IOW, the naive digital svf outputs are close, but not quite close enough for some of the tricks you might want to use. At least that was my experience long ago playing with the naive digital svf. Sure you can get a notch by mixing lp and hp, but not a high performance notch.

Post

niarn wrote:One thing that puzzles me now is in what sense the super duper SVF algorithm is better than the naive SVF algorithm. Is the naive SVF just as bad as the DF1 from your point of view?
They are bad in two different ways. Naive SVF responds nicely to fast parameter variations but has poor frequency response closer to Nyquist. DF1/2 has nice frequency response curve everywhere but responds poorly to fast parameter variations and has precision issues. ZDF SVF addresses both issues at the same time.

Post

Since there are plenty of biquad classes ready to use, would be nice if someone could post an example class for the SVF.
This was my reference for the biquads: http://www.earlevel.com/main/2012/11/26 ... urce-code/ very easy to understand, use, and improve. Anyone willing to do something similar for SVFs?

Post

niarn wrote:I think it is confusing when you say "no z^-1" because I have no idea what that means. All I know is that you can't draw a discrete time block diagram of any realization of a biquad without having at least two z^-1 's in there.
Yeah, one can't do that for a DF biquad, I guess.

But one can do it for a SVF. For the SVF there exist electronic circuit diagrams. In electronic circuit diagrams there are no z^-1. The relation of currents and voltages in such electronic circuits can be expressed in simple linear equations. I suppose EE students do it in their first few weeks using nodal analysis. Those equations can be computed, so they can be written down as code. But because the equations are implicit some people some years ago added z^-1 in there that weren't there to make them explicit - which resulted in really not-so-good SVF implementations. However, there was never a need to do so because the maths involved to solve implicit linear equations is not really that difficult.

So where did the z^-1 go? - They're still there, but they are not part of these equations. They are evaluated in a secondary step, usually called "state update". This can be done independently from the evaluation of the equations with any single-step integration method such as Euler or trapezoidal rule. This is based on the idea that a capacitor can be alternatively modeled as a resistor and a current source. The update of the current that got trapped in the capacitor happens in succession of the update of the voltages at the nodes. Spice and other circuit emulations tools do it that way.

An alternative way of expressing this, instead of talking about capacitors and current source equivalents, is to call them bilinear integrators. Those are essentially first order DF biquads with very simple (I'd say "harmless") coefficients. It's essentially the same.

And this way one can model recursive filters without adding unit delays into the equations of their outputs.

Post

potato6 wrote:Since there are plenty of biquad classes ready to use, would be nice if someone could post an example class for the SVF.
This was my reference for the biquads: http://www.earlevel.com/main/2012/11/26 ... urce-code/ very easy to understand, use, and improve. Anyone willing to do something similar for SVFs?
Hmmm, the pseudo code in here should be easy enough to implement?

http://www.cytomic.com/files/dsp/SvfLin ... dalSin.pdf

Post

Urs wrote:
niarn wrote:I think it is confusing when you say "no z^-1" because I have no idea what that means. All I know is that you can't draw a discrete time block diagram of any realization of a biquad without having at least two z^-1 's in there.
Yeah, one can't do that for a DF biquad, I guess.

But one can do it for a SVF. For the SVF there exist electronic circuit diagrams. In electronic circuit diagrams there are no z^-1. The relation of currents and voltages in such electronic circuits can be expressed in simple linear equations. I suppose EE students do it in their first few weeks using nodal analysis. Those equations can be computed, so they can be written down as code. But because the equations are implicit some people some years ago added z^-1 in there that weren't there to make them explicit - which resulted in really not-so-good SVF implementations. However, there was never a need to do so because the maths involved to solve implicit linear equations is not really that difficult.

So where did the z^-1 go? - They're still there, but they are not part of these equations. They are evaluated in a secondary step, usually called "state update". This can be done independently from the evaluation of the equations with any single-step integration method such as Euler or trapezoidal rule. This is based on the idea that a capacitor can be alternatively modeled as a resistor and a current source. The update of the current that got trapped in the capacitor happens in succession of the update of the voltages at the nodes. Spice and other circuit emulations tools do it that way.

An alternative way of expressing this, instead of talking about capacitors and current source equivalents, is to call them bilinear integrators. Those are essentially first order DF biquads with very simple (I'd say "harmless") coefficients. It's essentially the same.

And this way one can model recursive filters without adding unit delays into the equations of their outputs.
Actually, there still are z^-1's. Within the integrators. The points is, they aren't used outside of those.

You can also express ZDF filters as conventional discrete-time block diagrams with z^-1's (those from the integrators), as e.g. in Fig.3.18 of the VAFilterDesign_1.1.1 book. The point is, there is little point in doing so (pun intended).

PS. "First order DF biquads" is a nice term :D :D :D

Post

Z1202 wrote:Actually, there still are z^-1's. Within the integrators. The points is, they aren't used outside of those.
Yep, that's what I meant, but couldn't express it well enough! :clown:

Post

niarn wrote:There is for instance also ARM if that makes any difference.
There's Cortex A7, A8 which is an ARM CPU but does do floating point. Not only that, but they do SIMD as well (single input, multiple data), which is GREAT for vector calculations.

Post

EvilDragon wrote:
niarn wrote:There is for instance also ARM if that makes any difference.
There's Cortex A7, A8 which is an ARM CPU but does do floating point. Not only that, but they do SIMD as well (single input, multiple data), which is GREAT for vector calculations.
He was probably thinking of M0-M4 which more likely than not, don't have an FPU. For example, teensy is a very popular ARM processor which does not have FPU (unfortunately). NO SIMD at all for these lower end (what?) chips :)

Post

Who's using teensy for a fully fledged virtual analog synth? Haha.

Post

Z1202 wrote:
niarn wrote:Can you provide 'the correct' definition of what a SVF is?
I wonder if anyone has the "right to". I'm not sure what was the original usage of the term SVF. I guess it could have been the Chamberlin filter. But by now we just understand the SVF as the main idea of that filter, so there can be quite a number of variations thereof. The main "averaged" idea is captured in the continuous-time diagram in the book I mentioned.
Okay, For instance it is possible to give quite specific definition of a 2nd order Butterworth filter whether in analog or digital domain.
Z1202 wrote:
niarn wrote:My personal understanding of an SVF filter is a filter that realizes the IIR part of a biquad using two coefficients f and q such that the denominator is given by 1 + (2-f^2-q)z^-1 + (1-q)z^-2
Nope. SVF effectively implements the entire biquad, both IIR and FIR parts. But you can't really think of it this way, because the FIR and IIR parts are not separated like in DF. It's a different topology.
I don't really understand this rejection of the definition. Is it really necessary to involve such thing as topology in a definition of the SVF? Why is it not possible to provide a definition based on transfer function?

Post

JCJR wrote:
niarn wrote: One thing that puzzles me now is in what sense the super duper SVF algorithm is better than the naive SVF algorithm.
From a practical standpoint-- Naive chamberlin digital svf goes unstable at a relatively low frequency.
What do you mean by becoming unstable. Do you mean unstable like poles outside the unit circle and output going off to -+inf? But why is this a property of the naive SVF? Any biquad with poles outside the unit circle will at some point do the same thing....
Thanks for your explanation!

Post

Urs wrote:
Z1202 wrote:Actually, there still are z^-1's. Within the integrators. The points is, they aren't used outside of those.
Yep, that's what I meant, but couldn't express it well enough! :clown:
pheeeew, now I can go to sleep well knowing that unit delays are still needed for realization of a biquad, I almost started getting nervous :D

Post

niarn wrote:
Z1202 wrote:
niarn wrote:Can you provide 'the correct' definition of what a SVF is?
I wonder if anyone has the "right to". I'm not sure what was the original usage of the term SVF. I guess it could have been the Chamberlin filter. But by now we just understand the SVF as the main idea of that filter, so there can be quite a number of variations thereof. The main "averaged" idea is captured in the continuous-time diagram in the book I mentioned.
Okay, For instance it is possible to give quite specific definition of a 2nd order Butterworth filter whether in analog or digital domain.
Correct :wink: But that's because, among other things, the Butterworth filter's definition doesn't concern itself with the topology. There can be different topologies implementing the same transfer function.

Edit: actually it's possible to give a specific definition of SVF in the continous-time domain. That's the one given e.g. in the book I mentioned. And it's the topology which is the essential part of the definition. (Other topologies implementing the same transfer function, e.g. Sallen-Key will not be referred to as the SVF). However there can be different digital models approximating that specific definition, hence the imprecision of the discrete-time definition. All those approximations will be referred to as digital SVFs.

niarn wrote:
Z1202 wrote:
niarn wrote:My personal understanding of an SVF filter is a filter that realizes the IIR part of a biquad using two coefficients f and q such that the denominator is given by 1 + (2-f^2-q)z^-1 + (1-q)z^-2
Nope. SVF effectively implements the entire biquad, both IIR and FIR parts. But you can't really think of it this way, because the FIR and IIR parts are not separated like in DF. It's a different topology.
I don't really understand this rejection of the definition. Is it really necessary to involve such thing as topology in a definition of the SVF? Why is it not possible to provide a definition based on transfer function?
Because topology does matter. And in digital domain we bother ourselves with SVF specifically because of its topology. If it didn't matter, everyone probably would've been happy with DFs, wouldn't they?

Post Reply

Return to “DSP and Plugin Development”