0
$\begingroup$

I'm trying to find out if the correction (Jackson, Nelatury, Mecklenbräuker) could improve the (IIM based) filter response near Nyqvist.

Here's my c++ routine (which is used for to calculate various RIAA and non-RIAA filters by just changing the timeconstant values and samplerate):

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

Tried to google "ready to use" solution of this but the only source code I found few papers I could use for correction.

Papers:

Juha

EDIT:

Bypassed the above mentioned papers. Improved the method so that now there's no need for additional correction biquad but by using z2 (which is unused) for the correction. One can decide where the error lies. Result:

better fit

$\endgroup$
2
$\begingroup$

You might be surprised to hear that your code implements neither the conventional impulse invariance method (IIM) nor the corrected IIM. Instead it implements the matched Z-transform, which maps the poles and zeros of the analog prototype according to

$$z_k=e^{s_kT}\tag{1}$$

where $T=1/f_s$ is the sampling interval.

The two versions of the IIM can be derived as follows. If we take as an example the RIAA de-emphasis transfer function

$$H(s)=\frac{sT_2+1}{(sT_1+1)(sT_3+1)}\tag{2}$$

with $T_1=3.18\,\text{ms}$, $T_2=75\,\mu\text{s}$, and $T_3=318\,\mu\text{s}$, we first have to do a partial fraction expansion of $(2)$ to get

$$H(s)=\frac{A_1}{s-p_1}+\frac{A_2}{s-p_2}\tag{3}$$

with $p_1=-1/T_1$, $p_2=-1/T_3$, and

$$A_1=\frac{1}{T_1}\frac{T_2-T_1}{T_3-T_1},\qquad A_2=\frac{1}{T_3}\frac{T_3-T_2}{T_3-T_1}$$

With the constants used in $(3)$, the transfer function of the transformed system can directly be written as

$$H(z)=\frac{TA_1}{1-e^{p_1T}z^{-1}}+\frac{TA_2}{1-e^{p_2T}z^{-1}}\tag{4}$$

From $(4)$ it can be seen that the poles are the same as for the matched Z-transform, but the zeros are different. Note that for this example there is only one zero for the matched Z-transform as well as for the conventional IIM.

The corrected IIM according to Mecklenbräuker and Jackson subtracts a constant term from the transfer function $(4)$ of the conventional IIM:

$$H(z)=\frac{TA_1}{1-e^{p_1T}z^{-1}}+\frac{TA_2}{1-e^{p_2T}z^{-1}}-\frac{T}{2}(A_1+A_2)\tag{5}$$

Note that this solution has one more zero than the other two methods. The poles of all three methods are identical.

The figure below shows the approximation of the RIAA de-emphasis filter given by $(2)$ according to the three aforementioned transformations (IIM in red, IIM corrected in green, matched Z in magenta). IIM performs worst, matched Z-transform and the corrected IIM are similar but their errors have different signs. This fact could be used to come up with a filter that combines the corrected IIM and the matched Z-transform. Since their poles are identical, we only need to combine their numerator coefficients. The result of the combined filter is shown in black. Its approximation error is less than 1 dB over the whole frequency range.

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ thank you very much for clearing this to me (DSPnoob). I was already thinking there's something strange ongoing because of equations didn't look match well. Yes, I think at some point I already started to combine those two methods (I thought it was IIM's) as you're suggesting but as I don't know how to do it properly in 'one solution' so I did something like find the difference of those two and after tweaking the formula to match the RIAA specs at 10kHz just made it a separate filter. This resulted around 0.6dB error which is fair but not for two biquads. Could you light a bit how to combine? $\endgroup$ – Juha P Mar 15 '16 at 10:35
  • $\begingroup$ @JuhaP: You just combine the numerator coefficients like $b = cb_1+(1-c)b_2$ where $b$ is the vector of numerator coefficients, and $c$ is some appropriately chosen constant $0<c<1$. $\endgroup$ – Matt L. Mar 15 '16 at 10:40
  • $\begingroup$ @JuhaP: I combined the numerator coefficients of the corrected IIM (Eq. 5 in my answer) with the matched Z-transform that's implemented in your code. I think I used 0.65*(matched-Z) + 0.35*(corrected IIM) (numerator coefficients, as shown in my previous comment). $\endgroup$ – Matt L. Mar 16 '16 at 16:16
  • $\begingroup$ @JuhaP: BTW, do you have the electronic versions of the papers by Jackson and Nelatury? I would be grateful if you could send them to me! $\endgroup$ – Matt L. Mar 16 '16 at 16:18
  • $\begingroup$ I don't have those papers but found the info by googling: Jackson - researchgate.net/publication/… (1st page showing) and the other by googling google.fi/?gws_rd=ssl#q=correction+to+impulse+invariance (IIRC, it was some citeseerx.edu who listed the pdf) $\endgroup$ – Juha P Mar 16 '16 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.