Accelerate/vDSP Biquad filter

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

Post

In that sense it would also be really cool if this method is used to construct new filters, which do not have any analog prototype. I have been demonstrating some of this in the Native Sessions presentation of Reaktor 6 in Berlin, if you have seen the video
Is it this one ?



I'm going to check this out :D

Post

You made this statement in the beginning
Unless you work on an academic app to place/visualize/whatsoever poles and zeros, I'd strongly recommend to stay away from biquad filters. They're all over DSP literature but they have not much to offer in modern practical DSP.
This statement is just silly :D If you would moderate it to cases considering floating point implementations on GPUs then maybe its true. You seem to have a lot of experience with floating point operations/calculations on GPUs and then you extrapolate that experience to all platforms/processors/applications and I have no idea why you would do that. Because it is wrong, but I wont make that statement official before I know exactly what you mean when you talk about naive SVF and the other one-size-fits-all-universally-superior-super-duper SVF algorithm.
Please read the papers. I'm not talking about naive SVF implementations found in standard literature.
Can you provide a link. I tried to give you a link to my understanding of SVF. I don't know about Faust either but what is the confusing part in e.g. figure 4? What else should z^-1 mean but a unit delay?
What about figure 7 in this reference http://www.dafx.ca/proceedings/papers/p_053.pdf
Is that the naive SVF you're talking about?
I would be happy if you could clarify what naive SVF is.

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

It's very simple: At some frequencies and depending on filter type two DF biquad coefficients can become very small while the other two become very high. Truncation errors occur due to the magnitude of difference in coefficients within the recursion, i.e. they "add up" anymore.

I can't image fixed point implementations to have any advantage.

I will try to explain to you the best I can why DF1 is better suited for implementation on DSPs over SVFs in terms of better SNR and less MHz. On a DSP you can multiply two N bit signed integers and the 2*N bit result is added to an accumulator. This is called a MAC operation. The DF1 is just 5 MAC operations with no loss of precision. The loss of precision happens when the results must be moved out of the accumulator. So the magnitude of the error is in the order 2^-(N+1).
The SVF needs to move intermediate results out of the accumulator when computing the states thereby decreasing SNR. And the very low gain in the recursive part (when f and q becomes very small) of the SVF can also contribute to decreasing the SNR.

What do you mean by "the feedback path" in respect of the SVF based on nodal analysis?

Thing is, in the SVF one feedback coefficient is 1, the other one is something like 0.5. They're pretty much in the same domain, exponent wise. Unlike a DF biquad where one goes like 0.999996 and another like 0.000000001
Are you able to provide block diagram, pseudo code, source code, difference equations or anything else that specifies the super duper SVF algorithm? I can't really comment on it before I know what the algorithm/structure looks like.
niarn

Post

Urs is talking about SVF realized WITHOUT the unit delay (hence, naive SVF means those which DO utilize unit delays)... He provided a link back on page 1: http://www.cytomic.com/technical-papers

Post

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.

As for the introduction to the SVF, besides the links given, may I also suggest my online book "The Art of VA Filter Design". It's not a cookbook and requires reading a large part of the book before an implementation becomes possible, but you could just read the SVF chapter to get an abstract (not bound to any hardware implementations) idea of what an SVF is. In academic terms this is more or less a version of canonically controllable state-space form of a continuous-time linear differential system.

niarn wrote:I will try to explain to you the best I can why DF1 is better suited for implementation on DSPs over SVFs in terms of better SNR and less MHz. On a DSP you can multiply two N bit signed integers and the 2*N bit result is added to an accumulator. This is called a MAC operation. The DF1 is just 5 MAC operations with no loss of precision. The loss of precision happens when the results must be moved out of the accumulator. So the magnitude of the error is in the order 2^-(N+1).
The SVF needs to move intermediate results out of the accumulator when computing the states thereby decreasing SNR. And the very low gain in the recursive part (when f and q becomes very small) of the SVF can also contribute to decreasing the SNR.
Even though I have no experience with fixed-point DSP, this MAC sounds to me exactly like a hardware design specifically needed to amend the deficiencies of DF implementations by locally doubling the representation precision. My guess would be that SVF, being way less sensitive to precision losses, doesn't really need that trick. But I might be wrong.

Post

niarn, I'd also recommend to read "The Art of VA Filter Design" (the mentioned chapters) before http://www.cytomic.com/technical-papers. Andy's papers, while having all required formulae/equations, are really missing "classical" digital topology diagrams (and in certain points they are too tied to analog component references), so for a digital-topology-diagram-minded guys (like me for example) it's not so easy to quickly catch the key differences between the TPT-SVF topology and vanilla "SVF" implementations (like Chamberlin's one or its derivatives) from there.
EvilDragon wrote:Urs is talking about SVF realized WITHOUT the unit delay...
:) That's why "ZDF" codename is ugly.

Post

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.
Okay, but do you understand that figure 7 in this reference http://www.dafx.ca/proceedings/papers/p_053.pdf (naive SVF?) as laid out does not implement the FIR part? The states must be linearly combined in order to realize a complete generic biquad. And of course in this case I can think of the an IIR part preceding a FIR part. And that is why the (naive) SVF suffers from some of the same issues as does DF2.
Can you provide 'the correct' definition of what a SVF is?
As for the introduction to the SVF, besides the links given, may I also suggest my online book "The Art of VA Filter Design". It's not a cookbook and requires reading a large part of the book before an implementation becomes possible, but you could just read the SVF chapter to get an abstract (not bound to any hardware implementations) idea of what an SVF is. In academic terms this is more or less a version of canonically controllable state-space form of a continuous-time linear differential system.
That looks like a very nice book :) Thanks. I think it will take some time to digest the message conveyed in there. I tried to skim through start of chapter 5 but I don't see a block diagram (for discrete time) or difference equations.
But on page 6 in http://www.cytomic.com/files/dsp/SvfLin ... mised2.pdf I see some difference equations. Is this the definition/specification of the super duper SVF?

Code: Select all

v3 = v0 - ic2eq;
v1 = a1*ic1eq + a2*v3;
v2 = ic2eq + a2*ic1eq + a3*v3;
ic1eq = 2*v1 - ic1eq;
ic2eq = 2*v2 - ic2eq;

does your chapter 5 lead to the same set of equations?


niarn

Post

EvilDragon wrote:Urs is talking about SVF realized WITHOUT the unit delay (hence, naive SVF means those which DO utilize unit delays)... He provided a link back on page 1: http://www.cytomic.com/technical-papers
Sorry, I have no idea what delay you are referring to.

With regards to the morphing filter you mentioned earlier is that used primarily for techno type of music or is it also used for rock/pop music? Can you link to a song that makes use of a morphing filter, I'm very interested in hearing what it sounds like.
niarn

Post

niarn wrote:You made this statement in the beginning
Unless you work on an academic app to place/visualize/whatsoever poles and zeros, I'd strongly recommend to stay away from biquad filters. They're all over DSP literature but they have not much to offer in modern practical DSP.
This statement is just silly :D If you would moderate it to cases considering floating point implementations on GPUs then maybe its true. You seem to have a lot of experience with floating point operations/calculations on GPUs and then you extrapolate that experience to all platforms/processors/applications and I have no idea why you would do that. Because it is wrong, but I wont make that statement official before I know exactly what you mean when you talk about naive SVF and the other one-size-fits-all-universally-superior-super-duper SVF algorithm.
Yes, we're in a forum that deals with audio plug-ins that typically run on general purpose CPUs. Floating point calculus is the general domain of interest. It's also the domain of the OP's question IIRC.

If specialized DSP hardware using fixed point is still considered "modern" then yes, maybe you have a point. I don't know anything about that stuff. I should revise my statement to "they have not much to offer in modern practical music-DSP", because also this forum is (was?) specifcally the forum of the Music DSP Mailing List. My bad, I won't do it again, promised.

After another look at the papers you presented: Yes, those SVFs are what we - in this forum - typically call "naive". They solve explicite equations ("z-1"), but we talk about implicit ones ("no z-1"). They use Euler, we talk about trapezoidal integration. They use abstract "flow charts" that have no correspondence in physical domains we use voltages and currents or masses and springs or any other physical domain with interchangeable laws. The JOS paper is - as so often - a tad confusing, to me at least. I do not know why many people who write DSP books seem to make things look more complicated than they are, but that might just be me.

If you look at the papers I linked to (please do!), everything seems so embarrassingly simple, I can't begin to grasp why there's so much (stubborn?) resistance against a shift to better solutions which are easier to understand. This is maybe also why I'm thinking of a paradigm change. I feel like people go at lengths to hold the candle up to DF biquad filters when in fact they are, well, not really that good. Had I had these papers at a time where the famous audio eq cookbook was the shitz, I would have created better software and spent less time fixing issues. Big regrets for being too trustful and too impatient on my side. Because I always thought "there must be a way to get rid of these delays", back in 2001, I just never took the time to investigate until 9 years later.

Post

niarn wrote:Is this the definition/specification of the super duper SVF?
This is it :party:

Post

niarn wrote:
EvilDragon wrote:Urs is talking about SVF realized WITHOUT the unit delay (hence, naive SVF means those which DO utilize unit delays)... He provided a link back on page 1: http://www.cytomic.com/technical-papers
Sorry, I have no idea what delay you are referring to.
Unit delays. z^-1 blocks. Making implicite equations explicite with a spiffy cheat. Stuff from before the zero delay feedback discussion (which might have been exclusive to this board).
With regards to the morphing filter you mentioned earlier is that used primarily for techno type of music or is it also used for rock/pop music? Can you link to a song that makes use of a morphing filter, I'm very interested in hearing what it sounds like.
Those filters (E-MU "z-plane") were built into sampling instruments in the 1980ies. They were primarily used for cheesy rock/pop music. Techno music was primarily created using anylogue synthesizers whose filter sound can not be replicated by DF biquad filters in sufficent quality :wink:

Post

niarn wrote:Sorry, I have no idea what delay you are referring to.
You said it yourself:
niarn wrote:What else should z^-1 mean but a unit delay?

You're confusing as hell, dude. :D

Urs wrote:Techno music was primarily created using anylogue synthesizers whose filter sound can not be replicated by DF biquad filters in sufficent quality :wink:
Touché! :D

niarn, please be aware of the fact that fixed-point DSPs are pretty much not used anymore in virtual analog synthesizers. It's the age of SHARCs, floating-point DSPs. Therefore, it's time for those old biquads to be retired. There are much better filters possible now.
Urs wrote:If you look at the papers I linked to (please do!), everything seems so embarrassingly simple, I can't begin to grasp why there's so much (stubborn?) resistance against a shift to better solutions which are easier to understand. This is maybe also why I'm thinking of a paradigm change. I feel like people go at lengths to hold the candle up to DF biquad filters when in fact they are, well, not really that good. Had I had these papers at a time where the famous audio eq cookbook was the shitz, I would have created better software and spent less time fixing issues. Big regrets for being too trustful and too impatient on my side. Because I always thought "there must be a way to get rid of these delays", back in 2001, I just never took the time to investigate until 9 years later.
This is a very good point, Urs. There's no reason to keep on using ye olde DF biquads. Unless you're really stuck with a lousy fixed point DSP chip (and why would you do that, when there are much better and faster floating point DSP chips around - unless you want to cheap out?).
Last edited by EvilDragon on Fri Jan 08, 2016 8:37 am, edited 2 times in total.

Post

niarn wrote:Okay, but do you understand that figure 7 in this reference http://www.dafx.ca/proceedings/papers/p_053.pdf (naive SVF?) as laid out does not implement the FIR part? The states must be linearly combined in order to realize a complete generic biquad.
That's corrrect. OTOH, the signals directly available in the SVF structure are LP, BP and HP and don't require any combination. (I'm not sure about that specific digital SVF structure, because it seems to employ some topology reordering tricks, at least upon the first sight, but a plain ZDF SVF does have all three).
niarn wrote:And of course in this case I can think of the an IIR part preceding a FIR part. And that is why the (naive) SVF suffers from some of the same issues as does DF2.
That's similar to the IIR, but it's not exactly an IIR part, because it implicitly contains some FIR too. That's a continuous-time parallel to IIR. In fact the continuous-time SVF structure has the same topology as the discrete time IIR part of the biquad, but instead of unit delays you have integrators.
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.
niarn wrote:I tried to skim through start of chapter 5 but I don't see a block diagram (for discrete time) or difference equations.
That's why I said you'll need to read most of the book. The ZDF method introduces a routine way to convert continuous-time diagrams to discrete time. In this method, the continuous-time diagrams are preferred, because they capture the essentials better. So there is little need for discrete-time diagrams. Same goes for digital domain transfer and frequency response functions, which can be implicitly understood from continuous-time ones.
niarn wrote:But on page 6 in http://www.cytomic.com/files/dsp/SvfLin ... mised2.pdf I see some difference equations. Is this the definition/specification of the super duper SVF?

Code: Select all

v3 = v0 - ic2eq;
v1 = a1*ic1eq + a2*v3;
v2 = ic2eq + a2*ic1eq + a3*v3;
ic1eq = 2*v1 - ic1eq;
ic2eq = 2*v2 - ic2eq;

does your chapter 5 lead to the same set of equations?


niarn
There are some variations in how the BLT is applied within ZDF method. Particularly you can use DF1 or DF2 integrators or their transposed forms. For a surface look I can't immediately tell which version was used in these equations.

Post

niarn wrote:I would be happy if you could clarify what naive SVF is.
A classical approach to construct digital feedback is to introduce a unit delay into the feedback. That's what we typically refer here to as naive filters (vs. ZDF filters, which, by their name, do not). Mind, that some of digital feedback might be hidden. E.g. you might construct the main feedback of a moog ladder filter in a ZDF way, but still have naive feedbacks within the underlying 1-poles (or have these 1-poles implemented as direct forms), which would mean that your filter is not "fully ZDF".

Post

Urs wrote:Yes, we're in a forum that deals with audio plug-ins that typically run on general purpose CPUs. Floating point calculus is the general domain of interest. It's also the domain of the OP's question IIRC.
I'm sorry if I have been too persistent or acting rude in trying to challenge that initial 'nothing to offer' comment. To some extent I regret for having chimed in.
Urs wrote: If specialized DSP hardware using fixed point is still considered "modern" then yes, maybe you have a point.
There is for instance also ARM if that makes any difference.
Urs wrote:After another look at the papers you presented: Yes, those SVFs are what we - in this forum - typically call "naive". They solve explicite equations ("z-1"), but we talk about implicit ones ("no z-1"). They use Euler, we talk about trapezoidal integration. They use abstract "flow charts" that have no correspondence in physical domains we use voltages and currents or masses and springs or any other physical domain with interchangeable laws. The JOS paper is - as so often - a tad confusing, to me at least. I do not know why many people who write DSP books seem to make things look more complicated than they are, but that might just be me.
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. So to me it is confusing when you say "no z^-1". But I will do my best to find out what you mean :wink:

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?

Post

EvilDragon wrote: You're confusing as hell, dude. :D
If trying to understand you mean is being confusing then I will be confusing til I die :)
I will continue to be confusing by asking: are you able to explain what z^-1 you are referring to? :D

Post Reply

Return to “DSP and Plugin Development”