Here's some notes from Jeffrey Lim on how Impulse Tracker processes resonant filters.
Gosh it has been *SOO* long since I looked at any of this.
Digging up tables/code:
FILD [CS:FilterFreqValue] ; 0->127*256 ; I believe this is the cutoff frequency specified in IT, pre-multiplied by 256
FMul [CS:FreqParameterMultiplier] ; -i/(24*256)
FLd ST
FRndInt
FSub ST(1), ST
FXCh
F2XM1
FLd1
FAdd
FScale ; = 2^(i/24*256)
FMul [CS:FreqMultiplier] ; = r
FLd ST ; r, r
FMul ST(1), ST ; r, r^2
FLd [CS:QualityFactorTable+BX] ; 2d, r, r^2 ; BX is an index into the table dependent on the Quality factor
FMul ST(1), ST ; 2d, 2dr, r^2
FLd1 ; 1, 2d, 2dr, r^2
FSubP ST(1), ST ; 2d-1, 2dr, r^2
FAdd
FLd1 ; 1, d, e ; This looks like just a variable rename for my sanity of the above.
FAdd ST, ST(1)
FAdd ST, ST(2) ; 1+d+e, d, e
FLd1 ; 1, 1+d+e, d, e
FDivRP ST(1), ST ; 1/(1+d+e), d, e
FSt DWord Ptr [CS:BP+8]
FXCh ; d, 1/(1+d+e), e
FAdd ST, ST(2)
FAddP ST(2), ST ; 1/(1+d+e), d+2e
FMul
FStP DWord Ptr [CS:BP+0Ch]
FStP ST
So the final coefficients here are:
a = 1/(1+d+e)
b = (d+2e) / (1+d+e)
c = -e / (1+d+e)
where d,e here are the 2dr+2d-1, r^2 defined previously
Where:
FreqMultiplier DD 3A9F7867h ; = 1/(2*PI*110.0*2^0.25)
FreqParameterMultiplier DD 0B92AAAAAh ; = -1/(24*256)
QualityFactorTable Label DWord
DD 3F800000h, 3F7A8874h, 3F752ECBh, 3F6FF262h
DD 3F6AD298h, 3F65CED3h, 3F60E678h, 3F5C18F1h
DD 3F5765ACh, 3F52CC19h, 3F4E4BACh, 3F49E3DCh
DD 3F459421h, 3F415BF8h, 3F3D3AE1h, 3F39305Ch
DD 3F353BEFh, 3F315D21h, 3F2D937Ch, 3F29DE8Ch
DD 3F263DE0h, 3F22B109h, 3F1F379Ah, 3F1BD12Ah
DD 3F187D50h, 3F153BA8h, 3F120BCDh, 3F0EED5Fh
DD 3F0BDFFDh, 3F08E34Bh, 3F05F6EEh, 3F031A8Ch
DD 3F004DCEh, 3EFB20BEh, 3EF5C3D4h, 3EF0843Ch
DD 3EEB6156h, 3EE65A84h, 3EE16F2Dh, 3EDC9EBBh
DD 3ED7E89Bh, 3ED34C3Ch, 3ECEC913h, 3ECA5E95h
DD 3EC60C3Bh, 3EC1D181h, 3EBDADE7h, 3EB9A0EEh
DD 3EB5AA1Ah, 3EB1C8F2h, 3EADFCFFh, 3EAA45CEh
DD 3EA6A2EDh, 3EA313EEh, 3E9F9862h, 3E9C2FE1h
DD 3E98DA02h, 3E95965Fh, 3E926494h, 3E8F4440h
DD 3E8C3504h, 3E893681h, 3E86485Dh, 3E836A3Eh
DD 3E809BCCh, 3E7BB965h, 3E765939h, 3E711670h
DD 3E6BF06Ah, 3E66E68Ah, 3E61F836h, 3E5D24D6h
DD 3E586BD9h, 3E53CCADh, 3E4F46C5h, 3E4AD998h
DD 3E46849Eh, 3E424752h, 3E3E2134h, 3E3A11C4h
DD 3E361887h, 3E323503h, 3E2E66C2h, 3E2AAD4Fh
DD 3E270838h, 3E23770Fh, 3E1FF965h, 3E1C8ED2h
DD 3E1936ECh, 3E15F14Ch, 3E12BD91h, 3E0F9B56h
DD 3E0C8A3Eh, 3E0989E9h, 3E0699FDh, 3E03BA20h
DD 3E00E9F9h, 3DFC5268h, 3DF6EEF8h, 3DF1A8FCh
DD 3DEC7FD5h, 3DE772E5h, 3DE28191h, 3DDDAB43h
DD 3DD8EF67h, 3DD44D6Ch, 3DCFC4C4h, 3DCB54E6h
DD 3DC6FD4Ah, 3DC2BD6Ah, 3DBE94C7h, 3DBA82DFh
DD 3DB68738h, 3DB2A157h, 3DAED0C5h, 3DAB150Eh
DD 3DA76DC0h, 3DA3DA6Ch, 3DA05AA3h, 3D9CEDFCh
DD 3D99940Eh, 3D964C71h, 3D9316C3h, 3D8FF2A1h
DD 3D8CDFABh, 3D89DD84h, 3D86EBCFh, 3D840A32h
All of these are floating point coefficients written in integer form for the assembler to work...
Not sure if that helps, or makes you more confused! :)
Floating-point conversion of the above table:
1.000000000000000000000000000, 0.978644609451293945312500000, 0.957745254039764404296875000, 0.937292218208312988281250000,
0.917275905609130859375000000, 0.897687137126922607421875000, 0.878516674041748046875000000, 0.859755575656890869140625000,
0.841395139694213867187500000, 0.823426783084869384765625000, 0.805842161178588867187500000, 0.788633108139038085937500000,
0.771791517734527587890625000, 0.755309581756591796875000000, 0.739179670810699462890625000, 0.723394155502319335937500000,
0.707945764064788818359375000, 0.692827284336090087890625000, 0.678031682968139648437500000, 0.663552045822143554687500000,
0.649381637573242187500000000, 0.635513842105865478515625000, 0.621942162513732910156250000, 0.608660340309143066406250000,
0.595662117004394531250000000, 0.582941532135009765625000000, 0.570492565631866455078125000, 0.558309495449066162109375000,
0.546386539936065673828125000, 0.534718215465545654296875000, 0.523299098014831542968750000, 0.512123823165893554687500000,
0.501187205314636230468750000, 0.490484178066253662109375000, 0.480009675025939941406250000, 0.469758868217468261718750000,
0.459726989269256591796875000, 0.449909329414367675781250000, 0.440301328897476196289062500, 0.430898517370223999023437500,
0.421696513891220092773437500, 0.412690997123718261718750000, 0.403877824544906616210937500, 0.395252853631973266601562500,
0.386812061071395874023437500, 0.378551512956619262695312500, 0.370467394590377807617187500, 0.362555921077728271484375000,
0.354813396930694580078125000, 0.347236216068267822265625000, 0.339820832014083862304687500, 0.332563817501068115234375000,
0.325461775064468383789062500, 0.318511426448822021484375000, 0.311709463596343994140625000, 0.305052787065505981445312500,
0.298538267612457275390625000, 0.292162865400314331054687500, 0.285923600196838378906250000, 0.279817581176757812500000000,
0.273841977119445800781250000, 0.267993956804275512695312500, 0.262270838022232055664062500, 0.256669938564300537109375000,
0.251188635826110839843750000, 0.245824411511421203613281250, 0.240574732422828674316406250, 0.235437154769897460937500000,
0.230409294366836547851562500, 0.225488811731338500976562500, 0.220673412084579467773437500, 0.215960830450057983398437500,
0.211348906159400939941406250, 0.206835463643074035644531250, 0.202418401837348937988281250, 0.198095679283142089843750000,
0.193865269422531127929687500, 0.189725190401077270507812500, 0.185673534870147705078125000, 0.181708395481109619140625000,
0.177827939391136169433593750, 0.174030348658561706542968750, 0.170313864946365356445312500, 0.166676744818687438964843750,
0.163117289543151855468750000, 0.159633859992027282714843750, 0.156224802136421203613281250, 0.152888566255569458007812500,
0.149623572826385498046875000, 0.146428287029266357421875000, 0.143301263451576232910156250, 0.140240997076034545898437500,
0.137246102094650268554687500, 0.134315147995948791503906250, 0.131446793675422668457031250, 0.128639698028564453125000000,
0.125892534852027893066406250, 0.123204052448272705078125000, 0.120572984218597412109375000, 0.117998093366622924804687500,
0.115478195250034332275390625, 0.113012112677097320556640625, 0.110598690807819366455078125, 0.108236812055110931396484375,
0.105925373733043670654296875, 0.103663295507431030273437500, 0.101449519395828247070312500, 0.099283024668693542480468750,
0.097162798047065734863281250, 0.095087841153144836425781250, 0.093057207763195037841796875, 0.091069929301738739013671875,
0.089125096797943115234375000, 0.087221793830394744873046875, 0.085359133780002593994140625, 0.083536252379417419433593750,
0.081752300262451171875000000, 0.080006450414657592773437500, 0.078297875821590423583984375, 0.076625794172286987304687500,
0.074989423155784606933593750, 0.073387987911701202392578125, 0.071820758283138275146484375, 0.070286996662616729736328125,
0.068785987794399261474609375, 0.067317038774490356445312500, 0.065879456698894500732421875, 0.064472571015357971191406250,
External links
- MikIT filter code, with more details from Jeffrey Lim