Page 1 of 1

FIR to IIR converter

Posted: Sun Feb 23, 2014 8:06 pm
by KG_is_back
This schematic can approximate IIR filter that has response as close as possible to filter that was used on the test tone.
Test tone can be practically anything (typically an impulse, sine sweep or white noise). You provide the schematic with DRY test tone and WET test tone (one passed through filter you desire to model...in case you have IR then input it here and input impulse to the DRY).

The schematic will preform Least Squares Method to approximate IIR filter coefficients. You can select the order of the filter (higher order, more precise the result, but also the filter will have to be more complex). In the output float array the filters are arranged as [b0,b1,...bn,a1,a2,...a,n] Note that A coefficients are inverse of standard IIR filter coefficients. that is because in standard IIR the an*y(n) is subtracted, but Least squares method assumes they are added.

EDIT: added the stable version of the filter. Old one using trogs float array to mem conversion was crashing.

Re: FIR to IIR converter

Posted: Mon Feb 24, 2014 2:49 pm
by KG_is_back
I've added Filter that handles any given order and array of coefficients. I've noticed that filter orders of 6+ are likely to get unstable. That is partially caused by low precision of matrix solver (ruby version might fix that) and the fact that 6+order filters are generally unstable :cry: Separating the High order filters into smaller biquad sections might improve it, but I would need help with that. I know it is possible by deflation (made in ruby would be awesome).

Re: FIR to IIR converter

Posted: Mon Feb 24, 2014 5:38 pm
by Jay
hi

that last one crashes FS for me m8! the only way i can open it is to start FS in safe mode and drag n drop the fsm onto the workspace! i even tries saving it out with another name but get the same problem!

Regards

Re: FIR to IIR converter

Posted: Mon Feb 24, 2014 6:15 pm
by KG_is_back
I think I know why... I used trogs experimental array to mem system, that saves array in ruby code and sends the address of the array to assembly component. I shoud've used traditional method to load the coefficient array into the filter. I will fix it later OK?

Re: FIR to IIR converter

Posted: Mon Feb 24, 2014 7:26 pm
by digitalwhitebyte
I hope this can help,
here is PURE RUBY - CLASS MATRIX / VECTOR
PURE RUBY - CLASS MATRIX_VECTOR - DWB~2014.fsm
(18.87 KiB) Downloaded 1295 times

Re: FIR to IIR converter

Posted: Mon Feb 24, 2014 7:30 pm
by digitalwhitebyte
HERE some example of Least Squares Implementation in ruby
http://nick-campbell.co.uk/matrixes-and ... ementation

Re: FIR to IIR converter

Posted: Tue Feb 25, 2014 3:12 am
by Jay
DWB, when i opened your fsm and clicked help matrix, ruby got updated automaticly to a new version! i went to screen cap its messagbox but it closed before i could, message at the top of my browser said ruby updated to 2.1.0.something!

is that supposed to happen?

Re: FIR to IIR converter

Posted: Tue Feb 25, 2014 8:56 am
by digitalwhitebyte

Re: FIR to IIR converter

Posted: Tue Feb 25, 2014 10:05 am
by Jay
lol never mind my last post! i was drunk and confused ha ha :mrgreen: i think what i saw was a popup site banner saying that their downloadable Ruby had been updated and not my Ruby within FloweStone :oops: well i had consumed 2 thirds of a bottle of Macallan

Re: FIR to IIR converter

Posted: Tue Feb 25, 2014 4:45 pm
by KG_is_back
digitalwhitebyte wrote:I hope this can help,
here is PURE RUBY - CLASS MATRIX / VECTOR
PURE RUBY - CLASS MATRIX_VECTOR - DWB~2014.fsm


ah :( too bad I have super-low ruby basics, so I do not know how to use this. Can you post an example of how to use this?