Book: The Art of VA Filter Design 2.1.2

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

Post

Z1202 wrote:What is easy to forget here is that the mixing coefficients are not the polynomial coefficients in terms of s. You need a polynomial in terms of (s+1), which gives (q-1)^4+2(q-1)^2+1=q^4-4q^3+8q^2-8q+4, where s+1=q, s=q-1. Almost fell for the same trap myself ;)
After rereading our conversation for several times and recalculating lots of stuff I finally got my enlightenment and now I understand what you mean :) There's been a misunderstanding initially, maybe I didn't write it in a clear way yesterday, idk.
Yes, of course on the left I have q-1 raised to some power, and only after that I open the brackets and rearrange :) That's what I did from the very beginning. However initially those 1 0 2 0 1 coeffs were indeed a result of a mistake. I mentioned them for the second time only because it's a funny mode.

Edit: But naturally the correct peak received from 1 + s^2/(1 + s)^4 sounds way better.

Post

Vadim, I believe there's a small typo on p74 in the 3rd equation,
y`3 = w((y2 + y4)/2 - y3);

Also, while going through diode ladder algebra I stuck at the third equation on page 76, namely
y1 = 2F * (x + y2)
I can't seem to derive this expression for y1. But from the Fig. 4.18 it looks like
y1 = G * (x + y2) = F / 2 * (x + y2)
so resulting H would be scaled by 0.25. Or am I mistaken?

Edit: ah, no, y1 does equal 2F * (x + y2), but then F = G / 2. There's a typo on p 75 in the beginning of the section, which isn't a big problem :)

Post

1eqinfinity wrote:Vadim, I believe there's a small typo on p74 in the 3rd equation,
y`3 = w((y2 + y4)/2 - y3);

Also, while going through diode ladder algebra I stuck at the third equation on page 76, namely
y1 = 2F * (x + y2)
I can't seem to derive this expression for y1. But from the Fig. 4.18 it looks like
y1 = G * (x + y2) = F / 2 * (x + y2)
so resulting H would be scaled by 0.25. Or am I mistaken?

Edit: ah, no, y1 does equal 2F * (x + y2), but then F = G / 2. There's a typo on p 75 in the beginning of the section, which isn't a big problem :)
Thanks! I don't get much feedback regarding the typos (although I do get some :wink: )

Post

Sorry if I'm being annoying, I but I can't find a mistake in my diode ladder. Transistor one is fine, but with diode I keep getting wrong cut-off (the error is not linear, i.e. wrongCutoff != x * correctCutoff) and quiet output. I'll try to describe what I do precisely.

Code: Select all

gf = analogFreq * pi / sampleRate;
Glp = gf / (1 + gf); // LP instant response gain
Let Zn be the value of n-th trapezoidal integrator memory. Then

Code: Select all

sn = zn / (1 + gf); // n-th LP instant response offset
I must confess I'm not 100% sure about how to treat IR gains from the figure 4.20. Supposedly because of the 1/2 gains on fig. 4.18 all IR gains on fig. 4.20 should be scaled by 1/2 except for the very first one. All IR offsets stay the same.

Now calculate stuff for ZDF, just implement formulae from page 78.

Code: Select all

G4 = 0.5 * Glp; 
G3 = G4 / (1 - G4 * G4);
G2 = G4 / (1 - G4 * G3);
G1 = Glp / (1 - Glp * G2);

g_den = 1 / (1 + gf); 
g_inv = 1 / G4;

// G4 == 0.5 * Glp == g from fig. 4.20
S4 = s4 = z4 * g_den;
S3 = (G4 * S4 + z3 * g_den) * G3 * gInv;
S2 = (G4 * S3 + z2 * g_den) * G2 * gInv;
S1 = (2 * G4 * S2 + z1 * g_den) * G1 * gInv * 0.5;

G = G4;
S = S4 + G * S3;
G *= G3;
S += G * S2;
G *= G2;
S += G * S1;
G *= G1;
The diode ladder input then has the same form as that of the transistor ladder,

Code: Select all

u = (in - fb * S) / (1 + fb * G);
Next, process the LPs.
For now yn are stored as previous stage outputs. In my delusional opinion this is not the reason for the problem. After fixing it I'd like to make them zero delay too.

Code: Select all

v = (u + y2 - z1) * Glp;
y1 = v + z1;
z1 = y1 + v;

v = ((y1 + y3) * 0.5 - z2) * Glp;
y2 = v + z2;
z2 = y2 + v;

v = ((y2 + y4) * 0.5 - z3) * Glp;
y3 = v + z3;
z3 = y3 + v;

v = (0.5 * y3 - z4) * Glp;
y4 = v + z4;
z4 = y4 + v;
Here's a comparisson of a filtered sawtooth. In both cases cutoff = 1 kHz, fb set to max (4.0 and 17.0 correspondingly):
Transistor:
Image
Diode:
Image

Post

1eqinfinity wrote:For now yn are stored as previous stage outputs. In my delusional opinion this is not the reason for the problem.
From a very brief look I'd say this is the most likely reason for the problem you have. If something has to be zero-delay, it has to be zero delay, no way around it without destroying the filter's response.

Post

Z1202 wrote:From a very brief look I'd say this is the most likely reason for the problem you have. If something has to be zero-delay, it has to be zero delay, no way around it without destroying the filter's response.
Ok. So I removed stored Ys and instead added this after calculating G, S and u and before processing the LPs:

Code: Select all

y1 = G1 * u + S1;
y2 = G2 * y1 + S2;
y3 = G3 * y2 + S3;
y4 = G4 * y3 + S4;
Strangely, I'm getting the same problem. However now the cutoff error is linear, i.e. to get a peak at x I need to set sutoff to ~1.4 * x. I've also found Will Pirkle's article where he bases his ladder on your theory, but proceeds a bit differently with calculations. If I plug his Gn and Sn in, I get precisely the same behavior again.

As far as my noob intuition I gained from grappling with ZDF goes, linear cutoff error sort of could point to the incorrect Gn. I mean I'm not from the fainthearted, but I've covered several A4s with recalculations, went trough the theory many times over and I feel like banging my head against the wall and slightly drooling :)

Post

1eqinfinity wrote:However now the cutoff error is linear, i.e. to get a peak at x I need to set sutoff to ~1.4 * x.
Top of p.78 says:
That is, given the unit cutoff of the underlying one-pole lowpass filters, the
selfoscillation starts at k = 17, where the resonance peak is located at ω = 1/√2 :wink:

Post

It's worth keeping in mind that the error won't be completely linear if you're doing BLT prewarping at unity cutoff, since the frequency warping will also distort the offset somewhat at higher frequencies. To fix that you can either adjust the analog prototype (so resonant frequency is unity again) or adjust the frequency warping to prewarp the actual resonant frequency instead.

Post

Z1202 wrote:Top of p.78 says:
That is, given the unit cutoff of the underlying one-pole lowpass filters, the
selfoscillation starts at k = 17, where the resonance peak is located at ω = 1/√2 :wink:
:o :cry:

Thank you, Vadim.

And I can not say that I didn't read it. Now I remember thinking "hmm, I'll need additional mapping". Later I skipped that part because I remembered it like it's mainly about the selfoscillation.

But then comparing to the transistor version, I don't quite get why diode's output is 4 times more quiet. Should it be so? I mean, with nearly max feedback values they yield almost equal peaks, but the rest of the diode's spectrum is about -12 dB.

Edit: no, wait, sorry. It just reacts to the feedback in a more dramatic way.
Last edited by 1eqinfinity on Wed Mar 14, 2018 6:54 pm, edited 1 time in total.

Post

mystran wrote:It's worth keeping in mind that the error won't be completely linear if you're doing BLT prewarping at unity cutoff, since the frequency warping will also distort the offset somewhat at higher frequencies. To fix that you can either adjust the analog prototype (so resonant frequency is unity again) or adjust the frequency warping to prewarp the actual resonant frequency instead.
Sure, thank you, mystran!
I'm doing g = tan(g) * sqrt(2.0); Works fine as long as g is clamped.

Post

I think I get why VA multimode diode ladders that I googled mostly had only LP, HP and BP :)
I've derived transfer functions of Y1 ... Y4 in terms of G. They all have the same denominator d = G^4 / 8 - G^2 + 1, their numerators have positive mixed powers of G too.
Then, say, I want to derive coefficients for HP mode. Hhp = s^4 / (s + 1)^4. It's convenient to make a substitution q = s - 1 right away.
Then, multiplying Yn by unknown coefficients I have something like

Code: Select all

(q - 1)^4        A / (8 q^4)  +  B / (4 q^3) - C / (8 q^4) + C / (2 q^2) - D / (2 q^3) + D / q + E
-----------  =  -------------------------------------------------------------------------------------
   q^4                                                                d
I guess it's legit to cross-multiply by the denominators so that on the left there's d (q - 1)^4, on the right are A, B, C, D, E with positive powers of q, and solve the mess.
But naturally since d contains negative powers of q I get them in resulting polynomial. Idk what to do with them. Could they come up in a correct solution at all? Needless to say the mode sounds more like Hcrap = FYI / 0

Post

1eqinfinity wrote:I think I get why VA multimode diode ladders that I googled mostly had only LP, HP and BP :)
I've derived transfer functions of Y1 ... Y4 in terms of G. They all have the same denominator d = G^4 / 8 - G^2 + 1, their numerators have positive mixed powers of G too.
Then, say, I want to derive coefficients for HP mode. Hhp = s^4 / (s + 1)^4. It's convenient to make a substitution q = s - 1 right away.
Then, multiplying Yn by unknown coefficients I have something like

Code: Select all

(q - 1)^4        A / (8 q^4)  +  B / (4 q^3) - C / (8 q^4) + C / (2 q^2) - D / (2 q^3) + D / q + E
-----------  =  -------------------------------------------------------------------------------------
   q^4                                                                d
I guess it's legit to cross-multiply by the denominators so that on the left there's d (q - 1)^4, on the right are A, B, C, D, E with positive powers of q, and solve the mess.
But naturally since d contains negative powers of q I get them in resulting polynomial. Idk what to do with them. Could they come up in a correct solution at all? Needless to say the mode sounds more like Hcrap = FYI / 0
I'd say, the denominator needs to be expressed in terms of s, not in terms of G (so that you'll cancel some factors with the numerator). Also I would define diode HP mode not as s^4/(s+1)^4, but s^4 divided by whatever 4th order polynomial is occurring in the denominator (if your denominator's leading coefficient is not 1, you also want to have the same coefficient in the numerator, to make the amplitude response at infinity equal to 1, but that's detail). You also need to find out the numerators corresponding to the modal outputs (with the same polynomial denominator) and then express s^4 as a linear combination of these numerators. This should be doable as long as numerators are linearly independent (and intuitively I don't see a single reason for them not to be). The same can be done for any other numerator (in particular you can take the ones of the transistor ladder).

You probably could do the same in terms of G, but I woudn't immediately know what a highpass numerator would be.

Post

Z1202 wrote:I'd say, the denominator needs to be expressed in terms of s, not in terms of G (so that you'll cancel some factors with the numerator).
Indeed, right-hand side gets much cleaner then. (I was solving with d expressed in terms of q = s - 1 from the beginning though, just didn't write it here.) After simplifying the right-hand side and normalizing relative to denominator I have d = q^4 - q^2 + 1/8.
Z1202 wrote:Also I would define diode HP mode not as s^4/(s+1)^4, but s^4 divided by whatever 4th order polynomial is occurring in the denominator (if your denominator's leading coefficient is not 1, you also want to have the same coefficient in the numerator, to make the amplitude response at infinity equal to 1, but that's detail).
Well, tut ya poplyl :)) Could you please explain it a bit, because I lack understanding and intuition here. How should I approach the design of desired a transfer function o the left having a set of Yns' transfer functions on the right?

Post

1eqinfinity wrote:
Z1202 wrote:I'd say, the denominator needs to be expressed in terms of s, not in terms of G (so that you'll cancel some factors with the numerator).
Indeed, right-hand side gets much cleaner then. (I was solving with d expressed in terms of q = s - 1 from the beginning though, just didn't write it here.) After simplifying the right-hand side and normalizing relative to denominator I have d = q^4 - q^2 + 1/8.
Z1202 wrote:Also I would define diode HP mode not as s^4/(s+1)^4, but s^4 divided by whatever 4th order polynomial is occurring in the denominator (if your denominator's leading coefficient is not 1, you also want to have the same coefficient in the numerator, to make the amplitude response at infinity equal to 1, but that's detail).
Well, tut ya poplyl :)) Could you please explain it a bit, because I lack understanding and intuition here. How should I approach the design of desired a transfer function o the left having a set of Yns' transfer functions on the right?
You can't have an absolutely desired transfer function, because you don't have a choice in terms of the denominator (aside from being able to cancel some of its factors). But you can choose the numerator freely.

For a 4-pole highpass you want an s^4 in the numerator, so that it can give you a 24dB/oct decay towards w=0 (whereas the denominator is approximately constant at w->0, so you asymptotically have a s^4 function). Now look at the numerators which you have (those are the ones of your modal outputs if you express them with a shared denominator, this should be always possible). You need to express s^4 as a linear combination of your numerators, each of them being a polynomial of s. This gives you 4 linear equations (one equation for each power of s).

The trick with s-1 substitution in the book was just a cheap way to avoid solving these equations, employing a particular regularity in the numerators, which is not always there.

Post

Z1202 wrote:You can't have an absolutely desired transfer function, because you don't have a choice in terms of the denominator (aside from being able to cancel some of its factors). But you can choose the numerator freely.
Hmm...
As far as I understand the desired transfer function absolutely must be expressable by the powers of s available in stages' transfer functions on the right. If the desired H has some power that is not present on the right, it is impossible to derive it from the current topology, right?

But then the thing that is completely opaque to me is:
Does it mean that we practicaly completely ignore the fact that denominators on the opposite sides are different? Because by "beautifying" the linear combination on the right, i. e. by canceling out some stuff I change the rhs numerator completely.

Thank you for the explanations you've provided so far, it's just that the lack of deep understanding together with new arising questions make my thinking process glitch.

Upd: interesting, are there any cases when it's impossible to have a precise linear combination, but it's possible to build some acceptable approximation from the available stages.

Post Reply

Return to “DSP and Plugin Development”