Fast Modulation of Filter Parameters

DSP, Plug-in and Host development discussion.
User avatar
S0lo
KVRian
692 posts since 31 Dec, 2008

Post Mon Apr 22, 2019 3:20 pm

matt42 wrote:
Mon Apr 22, 2019 6:05 am
Once you arrive at H(s) that's it. I'm not sure why you are trying to equalise with the SVF transfer function?
So let me get back:
matt42 wrote:
Mon Apr 22, 2019 6:05 am
Anyway the method I use for this kind of thing is to do inverse BLT of the digital filter to obtain the "analog" coefficients which can then just be plugged into a TPT structure
hmmm, But how is it possible to plug those S-domain coefficients into a TPT structure, without using that TPT structure transfer function?

In otherwords, Which TPT structure are using that directly maps an ARBITRARY second order S-domain transfer function coefficients to the structure?

Or, I don't suppose you mean directly using those s-domain coefficients in the z^-1 structure, or something like direct forms? How could that ever work? Thats basically an s=z transform.

Or did you mean, build the analog structure from the S-domain transfer function. Thats possible, but then we'd have to express everything interms of 1/s integrator to be able to use the trapezoidal integrator when you digitize again. Not trivial.

I'm definitely missing your point.

matt42
KVRian
1104 posts since 9 Jan, 2006

Re: Fast Modulation of Filter Parameters

Post Mon Apr 22, 2019 3:35 pm

Hi Solo,

I'm refering to a generalised, or canonical, TPT structure (Or rather continuous time system canonical form). I'm sorry - I shouldn't assume it's a well known structure as I can't find any reference to it by googling. I stumbled on it in the book Systems and Signals Made Ridiculously Simple. Anyway here it is:

Image

So coefficients, a0 to a(n), are found by descending powers of S. Feedforward coefficients from the numerator and feedback from the denominator.

IIRC using a T of 2 in the IBLT gives an integrator gain coefficient of 1.
Last edited by matt42 on Mon Apr 22, 2019 4:13 pm, edited 1 time in total.

User avatar
S0lo
KVRian
692 posts since 31 Dec, 2008

Re: Fast Modulation of Filter Parameters

Post Mon Apr 22, 2019 4:05 pm

mystran wrote:
Sun Apr 21, 2019 10:17 pm
You see.. first there was ZDF, which was about solving the implicit feedback loops that you get when you try to implement analog topologies using trapezoidal integration. Then some people objected to the term being too general and started using the TPT term when the goal is to implement analog topologies using trapezoidal integration.

Meanwhile, the rest of the world just calls it trapezoidal integration. Since in audio use, we usually have some frequency we want to tune accurately, we usually throw in BLT pre-warping too (which sort of warrants using an acronym, just so you don't need to type "trapezoidal integration with BLT pre-warp" every time), but really other than that it's just plain old trapezoidal integration.
The thing is that the book that started all this clearly refers to the trapezoidal integrator methodology as TPT. Check page 59. Well at least thats how I understand it. ZDF was mentioned in the book and clearly indicated as a "problem" (page 73) . The result of which leads to the outputs being expressed implicitly. Thats all there is to ZDF.

The Developer, researcher community know this, but for the rest of the crowd, musicians and sound designers, the ZDF name is misleading. And I don't blame them, the word "Zero-delay" gives an impression that this type of filter is "better" because it has no delay in it's feedback, therefore it more like analog. That kind of thing.

User avatar
S0lo
KVRian
692 posts since 31 Dec, 2008

Re: Fast Modulation of Filter Parameters

Post Tue Apr 23, 2019 3:17 am

matt42 wrote:
Mon Apr 22, 2019 3:35 pm
Hi Solo,

I'm refering to a generalised, or canonical, TPT structure (Or rather continuous time system canonical form). I'm sorry - I shouldn't assume it's a well known structure as I can't find any reference to it by googling. I stumbled on it in the book Systems and Signals Made Ridiculously Simple. Anyway here it is:

Image

So coefficients, a0 to a(n), are found by descending powers of S. Feedforward coefficients from the numerator and feedback from the denominator.

IIRC using a T of 2 in the IBLT gives an integrator gain coefficient of 1.
Ah, I've remember seeing this before but never got the chance to check it.

So to be more specific. a0 is the coefficient of S^2 in the numerator, a1 is for S^1 and a2 is for s^0. Then the b0 is the coefficient of S^2 in the denominator, b1 is for S^1 and a2 is for s^0. . Is that it?
Sorry, I can't find the link either so had to make sure before I try it.

matt42
KVRian
1104 posts since 9 Jan, 2006

Re: Fast Modulation of Filter Parameters

Post Tue Apr 23, 2019 5:36 am

Yes, that's right. Not a mathematical proof, but just from visual inspection - if you take a 2nd order transfer function like a LPF - 1/(s^2+1/q*s+1) the structure yields a standard SVF. First order structures like 1/s, 1/(s+1) etc come out as the standard form.

mystran
KVRAF
5270 posts since 12 Feb, 2006 from Helsinki, Finland

Re: Fast Modulation of Filter Parameters

Post Tue Apr 23, 2019 8:28 am

S0lo wrote:
Mon Apr 22, 2019 4:05 pm
The thing is that the book that started all this clearly refers to the trapezoidal integrator methodology as TPT. Check page 59. Well at least thats how I understand it. ZDF was mentioned in the book and clearly indicated as a "problem" (page 73) . The result of which leads to the outputs being expressed implicitly. Thats all there is to ZDF.
Assuming you are referring to "The Art of VA Filter Design" I'm not sure if Vadim coined the TPT term for the book or if it was already used by some people before that (can't remember), but the method itself got plenty of discussion here for at least a couple years before the book was written. It's just that Vadim's book was the first "easy reference" if you didn't feel like trying to scour the information from various random forum threads.

In fact, according to KVR forum time-stamps, Vadim announced his book May 22, 2012. My thread about how to "cheat" and do cheap one-step non-linearities for such filters is a couple of days earlier May 17, 2012. Now, by the time I actually started looking at these filters at all, the method was already a known here for a year or two... and I certainly didn't write the thread the moment I figure that stuff out either. ;)

Either way, for all practical purposes it's really just trapezoidal integration, with the TDF2 integrator being a nice optimisation if you're running fixed time-steps (like we usually do).
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

Z1202
KVRian
1046 posts since 12 Apr, 2002

Re: Fast Modulation of Filter Parameters

Post Tue Apr 23, 2019 11:51 pm

mystran wrote:
Tue Apr 23, 2019 8:28 am
In fact, according to KVR forum time-stamps, Vadim announced his book May 22, 2012. My thread about how to "cheat" and do cheap one-step non-linearities for such filters is a couple of days earlier May 17, 2012. Now, by the time I actually started looking at these filters at all, the method was already a known here for a year or two... and I certainly didn't write the thread the moment I figure that stuff out either. ;)
FWIW
viewtopic.php?f=33&t=215692
The link in that thread is by now dead, here is the updated one:
https://www.native-instruments.com/en/p ... -articles/
(by the time of the post there were just the first two articles). However, as you can see from the thread, it went pretty much unnoticed until Urs Heckmann started digging into this and posting his thoughts on KVR (IIRC, some 3 years later). This is the first description of the TPT method (visual transformation of the graph as opposed to the symbolic application of trapezoidal integration, back then I even didn't realize that both are pretty much equivalent). I don't remember when I coined the name specifically (the article already did it half-way in the title, though), but it was to stress the fact that we are supposed to apply zero-delay feedback resolution to all feedback loops in the structure, as opposed to applying it only to the "most offending loops", as some other papers were suggesting, and which can be also understood as ZDF method.

@matt42 You were probably googling for this https://en.wikipedia.org/wiki/State-spa ... alizations (no block diagrams there, but it's the same). Some explanation of how this is related to SVF is done in Chapter 8.1

User avatar
S0lo
KVRian
692 posts since 31 Dec, 2008

Re: Fast Modulation of Filter Parameters

Post Wed Apr 24, 2019 3:12 am

So I've managed to do the inverse BLT idea. The filter works, but it explodes in fast modulation!! (i.e causes an overflow). Any modulation speed of filter cut-off higher than 2.5Khz will make it explode.

I don't want to jump to quick conclusions before I make sure i'm doing it right. May be some one can spot something wrong in a quick look. So here is the original normalized LP transfer function. :

i1.jpg

Doing inverse BLT:
i2.jpg

Therefore, coefficients are:

Code: Select all

b0 = (1.0+2*R*x+R*R);
b1 = (4.0-4*R*R);
b2 = 4.0-8*R*x+4*R*R;
a0 = 0;
a1 = 0;
a2 = 4*(R*R-2*R*x+1);
I avoided any resonance enhancements for simplicity. Doing TPT using the general purpose topology posted by matt42 above. The final code is:

Code: Select all

// Input is in0. and output is out0
// R is resonance from 0 to 1
// cut is cutoff from 0 to 0.5
// m1 and m2 are state/memory variables of the two integrators.
// All other variables are just temporary storage.

double x, a0,a1,a2,b0,b1,b2,p0,p1,p2;

x = cos(2.0*PI*cut); 

// S domain coefficients
b0 = (1.0+2*R*x+R*R);
b1 = (4.0-4*R*R);
b2 = 4.0-8*R*x+4*R*R;
a0 = 0;
a1 = 0;
a2 = 4*(R*R-2*R*x+1);

// TPT filter
p0 = -2.0*((2*b1 + b2)*m1 + 2*b2*m2 - 2*in0)/(4*b0 + 2*b1 + b2);
p1 = 0.5*p0 + m1;
p2 = 0.5*p1 + m2;
m1 = 0.5*p0 + p1;
m2 = 0.5*p1 + p2;
out0 = a0*p0 + a1*p1 + a2*p2;
One could possibly plug any other transfer function by simply replacing a0,a1,a2,b0,b1,b2 with his own coefficients.

EDIT: just fixed a problem in the code
You do not have the required permissions to view the files attached to this post.

mystran
KVRAF
5270 posts since 12 Feb, 2006 from Helsinki, Finland

Re: Fast Modulation of Filter Parameters

Post Wed Apr 24, 2019 6:42 am

Z1202 wrote:
Tue Apr 23, 2019 11:51 pm
However, as you can see from the thread, it went pretty much unnoticed until Urs Heckmann started digging into this and posting his thoughts on KVR (IIRC, some 3 years later).
Right.. just my point was that these were already a hot topic by the time you'd managed to put the book together and whether you call them ZDF or TPT or trapezoidal integration doesn't really make a whole lot of difference. :)

As a side-note, wave-digital filters (another old thing) are basically another formalism that pretty much ends up solving the same thing as well, for the restricted case of "circuits" that you can put together using the port adaptors or whatever they call them. Unrolling the math, you basically get something that's very similar to just solving the state-space matrix (well, either state-space or the slightly optimized version that puts TDF2 integration into the matrix too) by LU. :)
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

User avatar
S0lo
KVRian
692 posts since 31 Dec, 2008

Re: Fast Modulation of Filter Parameters

Post Wed Apr 24, 2019 11:07 am

mystran wrote:
Tue Apr 23, 2019 8:28 am
In fact, according to KVR forum time-stamps, Vadim announced his book May 22, 2012. My thread about how to "cheat" and do cheap one-step non-linearities for such filters is a couple of days earlier May 17, 2012. Now, by the time I actually started looking at these filters at all, the method was already a known here for a year or two... and I certainly didn't write the thread the moment I figure that stuff out either. ;)
I guess I'm the new comer here :hihi:. I haven't read your thread but browsed through quickly. Will probably do when I get the time. But, In a nut shell, you were trying to achieve reasonable accuracy in fixing the frequency warp without heavy computation, is that it?

mystran
KVRAF
5270 posts since 12 Feb, 2006 from Helsinki, Finland

Re: Fast Modulation of Filter Parameters

Post Wed Apr 24, 2019 11:44 am

S0lo wrote:
Wed Apr 24, 2019 11:07 am
But, In a nut shell, you were trying to achieve reasonable accuracy in fixing the frequency warp without heavy computation, is that it?
Nope. That thread is about cheating with non-linearities (eg. tanh saturation and similar), in case you don't care about feel like running Newton for those and would rather give up accuracy (but still get things like stable self-oscillation).

Basically my goal was to find an approach that would let you use these ZDF/TPT filters even with embedded non-linearities and get something "not totally horrible" while still allow simple one-step solution with predictable per-sample cost (although arguably predictor-corrector two-step approach is a lot better, even if you use the zero-pivoting linearisation).

There isn't really any easy way to fix the frequency warping (besides pre-warping one frequency, typically the cutoff), but when you have a non-linear filter, you're going to have to oversample to avoid (excessive) aliasing anyway, which makes the warping somewhat less of an issue.
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

User avatar
Skupje
KVRist
96 posts since 26 Oct, 2018

Re: Fast Modulation of Filter Parameters

Post Wed Apr 24, 2019 12:51 pm

Generally ZDF is not really that different. I think the end all be all solution would be oversampling. For an intermediate solution ZDF may not be that bad? Seems pretty similar along the passband.. Or am I missing something here?

That reminds me been slacking off for too long, going to get my 512x :hihi:

matt42
KVRian
1104 posts since 9 Jan, 2006

Re: Fast Modulation of Filter Parameters

Post Wed Apr 24, 2019 10:31 pm

Z1202 wrote:
Tue Apr 23, 2019 11:51 pm
@matt42 You were probably googling for this https://en.wikipedia.org/wiki/State-spa ... alizations (no block diagrams there, but it's the same). Some explanation of how this is related to SVF is done in Chapter 8.1
Thanks for the link. There's a hole in my knowledge where state space representations should be. When I get some down time I might read up on it.

User avatar
S0lo
KVRian
692 posts since 31 Dec, 2008

Re: Fast Modulation of Filter Parameters

Post Thu Apr 25, 2019 2:39 am

Skupje wrote:
Wed Apr 24, 2019 12:51 pm
Generally ZDF is not really that different. I think the end all be all solution would be oversampling. For an intermediate solution ZDF may not be that bad? Seems pretty similar along the passband.. Or am I missing something here?
One would intuitively think that oversampling (or increasing the sampling rate). Would stabilize an unstable fast modulated filter. Simply because "fast" here is relative. So as you increase the sampling rate, "fast", becomes relatively "slow", and should work well as if you were doing slow modulation.

Practically, that doesn't seam to happen!!, the same filter would still explode with the same modulation speed. And there doesn't seam to be allot of science around this. (Or may be I'm just too ignorant). Transfer functions simply don't work unless you have an LTI (Linear Time Invariant) system. Fast modulated filters are apparently not LTI.

mystran
KVRAF
5270 posts since 12 Feb, 2006 from Helsinki, Finland

Re: Fast Modulation of Filter Parameters

Post Thu Apr 25, 2019 2:59 am

S0lo wrote:
Thu Apr 25, 2019 2:39 am
Fast modulated filters are apparently not LTI.
LTI stands for "linear, time-invariant" and it's the "time-invariant" property that you are violating when you change the coefficients. Alternatively you can treat the modulation signal as another input which then makes the filter non-linear MISO system.. but like.. yeah.. it's not LTI when you change coefficients.
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

Return to “DSP and Plug-in Development”