Firstly, the MIDI data is listed after the orderlist and the pointerlists. I don't yet know how these are listed; apparently this region can also contain timestamps. I'll just use the defaults right now.
Z00-Z7F sets the channel's cutoff, while Z80-Z8F set the channel's resonance to (that - 0x80) * 8. Yes, these are just the defaults.
You might have noticed the IFC/IFR fields in the instrument header. If the top bit of one is set, the lower 7 bits indicate the cutoff/resonance to be applied to that channel.
The cutoff frequency is 110*(2^3/12)*(2^(cutoff/24)).
The resonance affects the "damping factor", which is 10^(-resonance/(24*128*20)).
EDIT: Looking at the source code snippets Jeff has released, the base note is C3, not A2! Fixed in the formula.
The formulae you've probably seen before if you've looked for this are:
a = 1.0/(1.0+d+e);Except they usually do /(1.0+d+e) instead of *a, as that's how Jeffrey Lim documents it.
b = (d+2*e)*a;
c = -e*a;
d and e are calculated like so (as documented in the MikIT source comment):
d = 2*(damping factor)*(sampling rate)/(natural frequency) + 2*(damping factor)-1"damping frequency" was explained before.
e = (sampling rate/natural frequency)^2
"natural frequency" is the cutoff frequency*2*pi.
We can factorise this down into:
f = samprate/(2*pi*resfrq);You can also premultiply a dmpfac table by 2, and premultiply a resfrq table by 2*pi.
d = 2.0*dmpfac*(f + 1.0) - 1.0;
e = f*f;
Just be warned: I don't entirely know how to clamp the filter frequencies so they don't "run away".
You will most likely want to use floating-point mixing here. Fixed-point mixing requires at least 14 fraction bits from my experience with this (11 is too small -- a can get pretty small here).
When mixing, use the formula:
output[n] = input[m]*a + output[n-1]*b + output[n-2]*c;You can write this in your own way. I personally use a couple of variables and feed the calculated values along the two.
Hopefully some time later I might do something on IT214/IT215 decompression and later maybe even compression.