Hello, and thanks for fixing the posting problem! I'm using this (Impulse Invariance Method based) code for to calculate coefficients for biquad digital filter (for RIAA and non-RIAA de-emph.). double a0, a1, a2, b0, b1, b2; double fs = 44100; //timeconstants (case RIAA): // frequency -> time conversion 1/(2*pi*fc) (= R*C) //poles double p1 = 3180e-6; // 1/(2*pi*50.05Hz) double p2 = 75e-6; // 2212Hz //zeros double z1 = 318e-6; // 500.5Hz double z2 = 0.0; // 3.18e-6 for Neumann pole (50kHz) double pole1= exp(-1.0/(fs*p1)); double pole2 = exp(-1.0/(fs*p2)); double zero1 = exp(-1.0/(fs*z1)); double zero2 = exp(-1.0/(fs*z2)); a0 = 1.0; // = 1.0 a1 = -pole1 - pole2; // = -0.931176 a2 = pole1 * pole2; // = 0 b0 = 1.0; // = 1.0 b1 = -zero1 - zero2; // = -1.731986 b2 = zero1 * zero2; // = 0.733838 Known issue for IIM is magnitude error close Nyqvist with low samplerates ... above filter results about -0.5dB error at 10kHz and over -3dB error at 20kHz. I'm trying to find a way to fix/reduce this error. When using 96kHz sampling the error at 20kHz is around 0.5dB so the error (range 20Hz-20kHz) gets fixed by rising the sampling frequency high enough. My target is less than ±0.1dB error (range 20Hz - 20kHz) and also I'm trying to avoid upsampling. Recently Martin Visanec published an article "Matched Second Order Digital Filters" http://www.vicanek.de/articles.htm and he even kindly looked this case, tweaked his method suitable for this type filter but the results he posted was not what I'm looking after (though, (without additional pole/zero pair) the reslut was less than ±0.3dB error in this 44.1kHz case). Google returned me few other fitting methods as like MZTi, Orfandis, etc. but those seem to be made for common/certain filter types. With my math/dsp skills bringing those equations into suitable form for this type of filters I'm working with and to usable c++ code isn't an option for me to solve. Not long ago Scott Wurcer released some python based optimization tools within his article for Linear Audio but AFAIK, those are hard to adopt into c++ coding intended for VST/AU plugin or even to standalone software. http://linearaudio.net/downloads Are there other methods one could consider to use for to improve the filter at low fs (for filtering system where coefficients are calculated in real time (though not very intesively))? I found these papers: http://www.sciencedirect.com/science/article/pii/S0165168400001134 http://www.sciencedirect.com/science/article/pii/S1051200406001424 which presents some correction for IIM and shows some plots comparing the magnitude/phase difference of original IIM and the corrected one. By the plots it looks like magnitudes are similar to certain point but opposite to each other compared to analog model. I was thinking if taking mean of those two methods could work ? Dunno how or averaging what. My bad, the example used in article is for 1st order filter and, as said already, with my math skills even those equations in paper looks very ... cryptic. Any thoughts and help with equations would be appreciated. Juha --------------------------------------- Posted through http://www.DSPRelated.com

# How to improve filter quality at low fs

Started by ●March 11, 2016

Reply by ●March 11, 20162016-03-11

On Fri, 11 Mar 2016 10:12:27 -0600, jtp_1960 wrote:> Hello, and thanks for fixing the posting problem! > > I'm using this (Impulse Invariance Method based) code for to calculate > coefficients for biquad digital filter (for RIAA and non-RIAA de-emph.). > > double a0, a1, a2, b0, b1, b2; > double fs = 44100; > //timeconstants (case RIAA): > // frequency -> time conversion 1/(2*pi*fc) (= R*C) > //poles double p1 = 3180e-6; // 1/(2*pi*50.05Hz) > double p2 = 75e-6; // 2212Hz //zeros double z1 = 318e-6; // 500.5Hz > double z2 = 0.0; // 3.18e-6 for Neumann pole (50kHz) > > double pole1= exp(-1.0/(fs*p1)); > double pole2 = exp(-1.0/(fs*p2)); > double zero1 = exp(-1.0/(fs*z1)); > double zero2 = exp(-1.0/(fs*z2)); > > a0 = 1.0; // = 1.0 a1 = -pole1 - pole2; // = -0.931176 a2 = pole1 * > pole2; // = 0 b0 = 1.0; // = 1.0 b1 = -zero1 - zero2; // = -1.731986 b2 > = zero1 * zero2; // = 0.733838 > > Known issue for IIM is magnitude error close Nyqvist with low > samplerates .. above filter results about -0.5dB error at 10kHz and over > -3dB error at 20kHz. I'm trying to find a way to fix/reduce this error. > When using 96kHz sampling the error at 20kHz is around 0.5dB so the > error (range 20Hz-20kHz) gets fixed by rising the sampling frequency > high enough. My target is less than ±0.1dB error (range 20Hz - 20kHz) > and also I'm trying to avoid upsampling. > > Recently Martin Visanec published an article "Matched Second Order > Digital Filters" http://www.vicanek.de/articles.htm and he even kindly > looked this case, tweaked his method suitable for this type filter but > the results he posted was not what I'm looking after (though, (without > additional pole/zero pair) the reslut was less than ±0.3dB error in this > 44.1kHz case). > > Google returned me few other fitting methods as like MZTi, Orfandis, > etc. but those seem to be made for common/certain filter types. With my > math/dsp skills bringing those equations into suitable form for this > type of filters I'm working with and to usable c++ code isn't an option > for me to solve. > > Not long ago Scott Wurcer released some python based optimization tools > within his article for Linear Audio but AFAIK, those are hard to adopt > into c++ coding intended for VST/AU plugin or even to standalone > software. > > http://linearaudio.net/downloads > > Are there other methods one could consider to use for to improve the > filter at low fs (for filtering system where coefficients are calculated > in real time (though not very intesively))? > > I found these papers: > http://www.sciencedirect.com/science/article/pii/S0165168400001134 > http://www.sciencedirect.com/science/article/pii/S1051200406001424 which > presents some correction for IIM and shows some plots comparing the > magnitude/phase difference of original IIM and the corrected one. By the > plots it looks like magnitudes are similar to certain point but opposite > to each other compared to analog model. > I was thinking if taking mean of those two methods could work ? Dunno > how or averaging what. My bad, the example used in article is for 1st > order filter and, as said already, with my math skills even those > equations in paper looks very ... cryptic. > > Any thoughts and help with equations would be appreciated.Greg Berchin's FDLS method may work. I think it's a nonlinear curve-fit, which you could do if you have good optimization chops. He posts here from time to time, and tells people to email him for information. Hopefully I'm not stepping on his toes by giving out his address: gjberchin AT charter DOT net -- www.wescottdesign.com

Reply by ●March 11, 20162016-03-11

On Friday, March 11, 2016 at 11:46:47 AM UTC-6, Tim Wescott wrote:> Greg Berchin's FDLS method may work. I think it's a nonlinear curve-fit, > which you could do if you have good optimization chops.It's a straightforward weighted least-squares fit. I've used FDLS for RIAA; don't remember whether I was able to get 0.1 dB all the way to 20 kHz at 44100 sampling, but I'm pretty sure that it was close. It also matches phase better than any other method I've tried.> He posts here from time to time, and tells people to email him for > information. Hopefully I'm not stepping on his toes by giving out his > address: gjberchin AT charter DOT netMy toes are safe. You just did what I would have done myself. Greg

Reply by ●March 12, 20162016-03-12

Slightly OT Who still makes phono cartridges ? Are they just manufacturing an old design from 1975 or is there actually new development going on? If CD's had never happened, I bet we would have digital output phono cartridges by now, with built-in pop/click reduction algorithms. But I would miss debugging a dead HiFi by touching the phono wires and hearing that satisfying hum.