kfrlib / kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
https://www.kfrlib.com
GNU General Public License v2.0
1.62k stars 248 forks source link

zpk2tf, tf2zpk representation #191

Open xkzl opened 9 months ago

xkzl commented 9 months ago

Hello,

I would be interested in using tf representation for a filter that I designed.

Is there any existing interface to turn tf coefficients into zpk representation and opposite ?

It seems I am not the only one in need. https://github.com/kfrlib/kfr/issues/148

I have found a zpk2tf method but it is marked as internal. This tf2zpk would be great feature to implement. Could you advice on this ? @dancazarin

Thank you

dancazarin commented 9 months ago

Hello,

If an external solution is appropriate, python's scipy.signal.tf2zpk is compatible by all means with KFR and can be used to transform from tf to zpk representation. Or do you need a builtin function to do this at runtime?

Internal functions are absolutely ok for using in your code but may be changed/removed in future versions without any prior notice (not part of stable API).

xkzl commented 9 months ago

Right, indeed I need builtin. I am using C++ language in my programs. I have just implemented SOS, ZPK and TF conversion today. (but using GSL for solving polynomials) I can prepare a PR if you want to implement it.

dancazarin commented 9 months ago

GSL is GPL-licensed and not compatible with a dual-licensed KFR. You can perfectly use GSL together with the KFR in your GPL-licensed project but pull request cannot be merged if the changes contains or depends on GPL-only code because of our commercial clients. All code that is contained in KFR repository must be allowed to be used/linked with closed-source proprietary software.

xkzl commented 9 months ago

yes I definitely don't know whether kfr is able to solve polynomials, but this was the main limitation in my case.