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.66k stars 253 forks source link

Combine FIR filters in parallel #204

Closed idotta closed 10 months ago

idotta commented 10 months ago

This might be off-topic, but can you please confirm if, for having the same effect of applying two different filters, I just have to sum the coefficients in the taps? For example:

univector<fbase> tapsNotch(NumTaps);
univector<fbase> tapsBP(NumTaps);
fir_bandstop(tapsNotch, fn1, fn2, window, true);
fir_bandpass(tapsBP,  fbp1, fbp2, window, true);
filter_fir<fbase, fbase> parallelFilter(tapsNotch + tapsBP); // just a simplification
dancazarin commented 10 months ago

Yes, applying a filter that is the sum of coefficients of two filters is the same as applying two filters in parallel (equaliser-like). For filters in series you would need a convolution of two coefficient vectors.

idotta commented 10 months ago

Wow, thanks for the fast and clarifying response!