I'm going to check again but this filter simply mutes things too much. I don't know, maybe it's another bug somewhere else but some channels are keyed on with infinite (or close to) attack rate, so we can focus on single-value filtering. In this case filtering value looks like 0x1d78 for example, so you can calculate f for it. Q is 0x400 (0x04 scaled to produce 0x1fff from 0x1f range: << 8 in my case).

If the envelope value is 0x1ff8 it's seems to be working. No low-pass filtering (since x * f is gives back more or less x, q can be all but ignored). Now, the way I understand IIR filters it's supposed to be an integrator of sorts? So, for low cut-off frequency it should be adding very little of the current sample and keep adding the previous values. This way for a DC signal the output should reach the input eventually?

Now, let's say f is close to zero. That gets us small x * f, that's what we want. But even if Q is big, the previous values can only be previous x * f and for DC input it's all the same. So that leaves us with:

y = u0 + (1 + q) * v1 - q * v2 = u0 + v1 + q * (v1 - v2)(where u0 = f * x input (small), v is previous output, and 1 - f can be replaced with 1)

Let's say x is positive. That makes u and v > 0 always. This means v1 - v2 is also > 0, so the y value will only get bigger over time. And will not stop at input level, but go all the way to infinity. This is not a stable filter?

Theory says 2-nd order IIR looks like this:

y = 1/a0 (b0 * x0 + b1 * x1 - a1 * v1)a0 is usually 1, so we can do away with it. This filter uses previous input values as well... I kinda like it better than using only previous output values. Then again, I know nothing so don't hit me

What order filter are we trying to get here? I guess 2nd or 3rd at best, right? Isn't it strange that we only use previous output values (all bn coefficients are zero then)? I've tried some Java scripts out there to get coefficient values for low-pass filters and would always end up with non-zero b1 at least?

EDIT: One shouldn't be doing math so late at night...

I'm not so sure now 1 - f can be simplified with 1. If I don't do that:

u0 + (1 - f + q) * v1 - q * v2

u0 + v1 - f * v1 + q * (v1 - v2)

v1 + f * (x - v1) + q * (v1 - v2)

q * (v1 - v2) is very small, so we get a fight between x and v1. In the end it should come to an equilibrium when v1 = x... then why the hell I'm getting saturation?