endolith / waveform-analysis

Functions and scripts for analyzing waveforms, primarily audio. This is currently somewhat disorganized and unfinished.
MIT License
255 stars 82 forks source link

matched z-transform vs biliear #22

Closed berndporr closed 2 years ago

berndporr commented 2 years ago

Hi,

I have seen your discussion on a gist about replacing the bilin transform with matched-z. I was surprised that it's not in scipy.

I needed a simple module to get digital coefficients for A&C weighting filters and created based on your repo just that and using the matched-z transform.

You might find some of the fragments useful! I didn't send a PR as I had a different objective.

https://github.com/berndporr/sound_weighting_filters

Best, /Bernd

berndporr commented 2 years ago

...and thanks for putting the effort in creating the analogue transfer functions. That was very helpful!

endolith commented 2 years ago

MZT isn't accurate at low sample rates and MZTi is better at normal ones, but I'm not sure the best way to handle this because it's becoming kind of a matched frequency response optimization problem anyway so why not just do that directly?

https://gist.github.com/endolith/148112?permalink_comment_id=3920822#gistcomment-3920822

berndporr commented 2 years ago

I see your point that it's an optimisation problem. I've shovled over also your unit tests and the only issue is towards higher frequencies as also https://www.khabdha.org/wp-content/uploads/2008/03/optimizing-the-magnitude-response-of-mzt-filters-mzti-2007.pdf discusses. It basically produces less damping towards fs/2 than required. I take your point that this ends up in an optimisation problem but then towards fs/2 you'll also have additional damping from the analogue anti-alias filter so that one needs to correct the freq response anyway. Either way: I'm happy as it is in my repo. Just pinged you just in case. Closing it now.