If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding premade modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
Matched Lowpass Filter
36 posts
• Page 4 of 4 • 1, 2, 3, 4
Re: Matched Lowpass Filter
Sweet , testing these.
Thanks martin
Thanks martin

lalalandsynth  Posts: 600
 Joined: Sat Oct 01, 2016 12:48 pm
Re: Matched Lowpass Filter
I have made these approximation formulas to calculate coefficients for Butterworth 1st order LPF (fixed fs=44100Hz):
where x = cutoff frequency in Hz.
Approximation process wasn't simple because of you need to first calculate enough coefficients for the approximation so, not a real time process. In this 1st order example (coefficient calculation is based on Massberg's method), I calculated coefficients for every (whole) Hz in range 0.01...N (using Octave) and then approximated each coefficient column separately (using LibreOffice Calc). Maybe less samples could have been enough. Approximation formulas are taken from Calc's trend line equations and the R^2 values were around 0.999.
I had to split the range into two parts to get polynomial degrees lowered. I don't know what approximation method LibreOffice Calc implements).
Could this type of implementation give any advantages in real time applications ... (at least in case of (Butterworth) LP and HP filters with fixed Q)?
 Code: Select all
if x<1000
b0 = 2.8877914930158800E17*x^4 + 5.1505099601836300E13*x^3  8.3042766124760100E09*x^2 + 1.1658923888554000E04*x + 4.7538137317132600E09;
b1 = 8.5798500741765000E18*x^4 + 1.5075985241148900E13*x^3  1.8436891078309800E09*x^2 + 2.5886403730853200E05*x + 1.4813928303349300E09;
a1 = 1.0000210773722100E+00 * exp(1.4259268000113900E04*x);
else
b0 = 1.4099442035756000E30 * x^7 + 1.0017110602452500E25 * x^6  2.5601690530276300E21 * x^5 + 2.3521737834624400E17 * x^4 + 1.5572294695099200E13 * x^3  7.1802325915484600E09 * x^2 + 1.1519383331259800E04 * x + 4.0299292935725700E04;
b1 = 4.7895187177706000E30 * x^7 + 3.6547584697795600E25 * x^6  1.0692798201684300E20 * x^5 + 1.4808481293564600E16 * x^4  9.5370681840518000E13 * x^3 + 1.8314251162411300E09 * x^2 + 2.1044667135830600E05 * x + 1.4837308218941300E03;
a1 = 6.1994629213463400E30 * x^7 + 4.6564695300249300E25 * x^6  1.3252967254712400E20 * x^5 + 1.7160655077027700E16 * x^4  7.9798387145426300E13 * x^3  5.3488074753069200E09 * x^2 + 1.3623850044842700E04 * x  9.9811327624874200E01;
end if
where x = cutoff frequency in Hz.
Approximation process wasn't simple because of you need to first calculate enough coefficients for the approximation so, not a real time process. In this 1st order example (coefficient calculation is based on Massberg's method), I calculated coefficients for every (whole) Hz in range 0.01...N (using Octave) and then approximated each coefficient column separately (using LibreOffice Calc). Maybe less samples could have been enough. Approximation formulas are taken from Calc's trend line equations and the R^2 values were around 0.999.
I had to split the range into two parts to get polynomial degrees lowered. I don't know what approximation method LibreOffice Calc implements).
Could this type of implementation give any advantages in real time applications ... (at least in case of (Butterworth) LP and HP filters with fixed Q)?
 juha_tp
 Posts: 54
 Joined: Fri Nov 09, 2018 10:37 pm
Re: Matched Lowpass Filter
juha_tp wrote:Could this type of implementation give any advantages in real time applications ... (at least in case of (Butterworth) LP and HP filters with fixed Q)?
In principle, yes. Polynomial approximatios may be very efficient and have a smaller footprint than lookup tables. Personally I wonder what application would require such an extraordinarily accurate match to the analog magnitude response of a first order filter? Polynomials of seventh(!) degree, hmmm. Then, as you note, higher order filters have more independent parameters e.g. Q in addition to the cutoff frequency, which makes a polynomial fit a lot messier.

martinvicanek  Posts: 1229
 Joined: Sat Jun 22, 2013 8:28 pm
Re: Matched Lowpass Filter
martinvicanek wrote:In principle, yes. Polynomial approximatios may be very efficient and have a smaller footprint than lookup tables. Personally I wonder what application would require such an extraordinarily accurate match to the analog magnitude response of a first order filter? Polynomials of seventh(!) degree, hmmm. Then, as you note, higher order filters have more independent parameters e.g. Q in addition to the cutoff frequency, which makes a polynomial fit a lot messier.
Yes, the Q and gain change would mean another sets of approximations ... (dunno yet how linear are the changes in coefficients when these parameters are changed .... Another issue would be that sample rate is fixed... .
This (base) 1st order filter was just an easy example (you know the math needed to get it that accurate... ) but, I have tried similar approximations for 2nd and 4th order Butterworth HPF and LPF and it looks like those works well. Polynomial degree can be dropped by splitting the frequency range and also, its possible to mix various implementations (Massberg, Orfandis, MZTi, MIM, BLT, MZT, IIM etc...) when carefully select those ranges... .
 juha_tp
 Posts: 54
 Joined: Fri Nov 09, 2018 10:37 pm
Re: Matched Lowpass Filter
Hi martinvicanek,
I came across your work on matched filters and this thread in particular from reading Will Pirkle’s Designing Audio Effect Plugins in C++, second edition, §11.4.3. Congratulations on the fantastic work and thanks for sharing it with the community!
I’m talking with some fellow developers (Justin Johnson and Theo Niessink (https://www.martinic.com)) about some audio effects (for example, https://github.com/JustinJohnson/ReJJ), and we’re interested in replacing Andy Simper’s SVF with your filters.
I noticed that in http://vicanek.de/articles/BiquadFits.pdf you introduced secondorder lowpass, highpass, bandpass, and peak filters. Then, in https://vicanek.de/articles/ShelvingFits.pdf you introduced firstorder lowshelf and highshelf.
Do you know if the technique is amendable to producing other filters shapes including firstorder lowpass and highpass, second order lowshelf and highshelf, allpass, notch and so forth? If so, do you have advice on how we would go about deriving these?
I tried the standard approach of, for example, highshelf = originalsignal + highpass. But it doesn’t quite work as I end up with resonances where they shouldn’t exist (see, for example, the dip before the shelf in https://userimages.githubusercontent.c ... 6f619e.png).
Thanks in advance and congratulations again on the fantastic work!
Best,
Leandro Facchinetti.
I came across your work on matched filters and this thread in particular from reading Will Pirkle’s Designing Audio Effect Plugins in C++, second edition, §11.4.3. Congratulations on the fantastic work and thanks for sharing it with the community!
I’m talking with some fellow developers (Justin Johnson and Theo Niessink (https://www.martinic.com)) about some audio effects (for example, https://github.com/JustinJohnson/ReJJ), and we’re interested in replacing Andy Simper’s SVF with your filters.
I noticed that in http://vicanek.de/articles/BiquadFits.pdf you introduced secondorder lowpass, highpass, bandpass, and peak filters. Then, in https://vicanek.de/articles/ShelvingFits.pdf you introduced firstorder lowshelf and highshelf.
Do you know if the technique is amendable to producing other filters shapes including firstorder lowpass and highpass, second order lowshelf and highshelf, allpass, notch and so forth? If so, do you have advice on how we would go about deriving these?
I tried the standard approach of, for example, highshelf = originalsignal + highpass. But it doesn’t quite work as I end up with resonances where they shouldn’t exist (see, for example, the dip before the shelf in https://userimages.githubusercontent.c ... 6f619e.png).
Thanks in advance and congratulations again on the fantastic work!
Best,
Leandro Facchinetti.
 leafac
 Posts: 1
 Joined: Mon Feb 28, 2022 5:43 pm
Re: Matched Lowpass Filter
Hi Leandro,
thank you for your kind words. I do have magnitude fits for all first and second order filter types. Drop me an email (address here, you have to type not copy and paste it) and we can have an indepth discussion.
Cheers Martin
thank you for your kind words. I do have magnitude fits for all first and second order filter types. Drop me an email (address here, you have to type not copy and paste it) and we can have an indepth discussion.
Cheers Martin

martinvicanek  Posts: 1229
 Joined: Sat Jun 22, 2013 8:28 pm
36 posts
• Page 4 of 4 • 1, 2, 3, 4
Who is online
Users browsing this forum: No registered users and 5 guests