- Announcement about May 10th, 2018 update and your password.
Generating PASM IIR digital filters using Python (scipy.signal library).
This is something I've posted a rudimentary version of before, but as an aside, and I've been improving and enhancing the code recently.
The python scipy.signal library has lots of stuff for designing digital filters easily. I've put together some code to generate PASM implementations of IIR (infinite impulse response) digital filters using this. The code also uses matplotlib the Python plotting library to show the response of the filter too. You can specify a bit depth for the coefficients to speed up and reduce the size of the generated code.
There are some problems still for some filters, the code to gather zeroes and poles into stages is decided ropey for edge cases, but many things work.
I've used one of the examples (band_pass_2) on my Prop audio board (it has I2S ADC and DAC so can handle 24 bit audio sampled at 48kHz) to show the actual performance matches the calculated performance well (~90 dB S/N).
(The slight slope on the passband is due to my spectrum analyzer's tracking generator AC coupled output dropping in amplitude below about 15kHz)
The main graphs displayed show response in magnitude and phase and impulse and step responses:
There is also a complex filter mode, demonstrated by one of the examples.