Software based RIAA EQ for PC/MAC systems.

By jiiteepee@yahoo.se



T.O.C.

1. EQ (VST -plug-in) w/ RIAA preset

2. Max/MSP implementation (standalone)

3. SynthMaker implementation (simple VST plug-in)

4. SynthEdit implementation (simple VST plug-in)

5. CPS implementation (simple)

External Subsonic/Rumble filtering

RIAA Filter software specs





Hardware setup:



Resolution 1. EQ (VST -plug-in) w/ RIAA preset

ddmf has couple good free EQ's you can use for this:

Additional software, you may need

Available RIAA EQ Presets for above mentioned ddmf EQ's:

NOTE: These RIAA EQ Presets does not work correctly w/ other ddfm EQ's (meaning LP10 and IIEQ Pro) and are samplerate sensiteve (44.1kHz filter does not work @ 96kHz).

IIEQ v1.12 DISCONTINUED PRODUCT

RIAA Preset for IIEQ v. 1.12 @ 44.1kHz and 96kHz

SmallEQ

RIAA Preset for SmallEQ @ 44.1kHz

IIEQ v. 1.21 and Morcky IIEQ

RIAA Preset for IIEQ v. 1.21 @ 44.1kHz

Download (Alternative Download location)

Above 44.1kHz presets gives the RIAA curve shown red in below picture (blue is the reference curve (RIAA standard)):



If you prefer to tweak those 44.1kHz presets to become more accurate, it's easiest to do by using Cristian Budde's Plugin Analyzer.

Quality:

The IIEQ/SmallEQ VST preset is adjusted visually by the results got from a filter build using Orbans coefficients, on VST Plugin Analyzer ... so it's basically as accurate as you be able to zoom the graph to get the curve fitted/data resolution (Hz, Q, Gain) on IIEQ/SmallEQ. It's possible to export the plot result from "VST Plug-in Analyzer" (my graphs were made w/ it) but, as it's not accurate plot (only 4096 points). I did compare the results between a Delphi implementation of VST filter prepared using Orbans coefficients and IIEQ/SmallEQ version ... error: avg. under ±0.05dB (0Hz- ~ 18.2kHz) and from ±0.1dB to -1.6dB (~18.2kHz - 20kHz)). RIAA EQ curve accuracy comparison between Delphi implementation (most accurate I have implemented) and ddmf preset implementation: http://jiiteepee.fortunecity.com/riaafilter/Delphi_ddfm_44_1kHz.html (same zipped http://rapidshare.com/files/139061295/Delphi_ddfm__44_1kHz.rar.html and as SVG document http://rapidshare.com/files/139551375/HQ-IIEQ.svg.html)



Resolution 2. Max/MSP implementation

Needed components:

Additional software (extract these into same directory w/ RIAA_Filter (or install using the installer)):

RIAA Filter software for Max/MSP 4.x:



for Max/MSP 5.x:




I found E-MU 0404 USB troublesome when changing samplerate on-the-fly. If the filter freezes, just kill the MaxRT or Max process through task manager (ctrl-alt-del).


I/O Settings:






Resolution 3. SynthMaker implementation

Download SynthMaker (NOTE: trial version adds peridiocal noise ...)


On SynthMaker enviroment, it's possible to use two different methods to build a plug-in:


1. by Coding:


// RIAA EQ Reproduction Filter for 48kHz data
monoin inL;
monoin inR;
monoout outL;
monoout outR;

float a0, a1, a2;
float b0, b1, b2;
float inL1, inL2, inR1, inR2;
float outL1, outL2, outR1, outR2;

a0= 1.00000000000000000;
a1=-0.75555209999999995;
a2=-0.16462571129709999;
b0= 1.00000000000000000; // never needed
b1=-1.73276550000000020;
b2= 0.73455344362250008;

// Proces left channel
outL = a0*inL + a1*inL1 + a2*inL2 - b1*outL1 - b2*outL2;

// Process right channel
outR = a0*inR + a1*inR1 + a2*inR2 - b1*outR1 - b2*outR2;

// save previous I/Os
outL2 = outL1;
outL1 = outL;
inL2 = inL1;
inL1 = inL;

outR2 = outR1;
outR1 = outR;
inR2 = inR1;
inR1 = inR;



  1. 2. By using build-in components:




Coefficients for various filters can be found in the end of this page.


Load the RIAA EQ VST plug-in to a VST Host software etc. .



Resolution 4. SynthEdit implementation

Download / install:

You may also need to make a folder named as ”vstplugins” under \Program Files\SynthEdit\.


Save SE project as a VST plug-in:

It's needed to create separate plug-in for each samplerate (44.1/48/88.2 and 96kHz) so, I have made four separate projects because of that (to make it simple).

Start SynthEdit and load the project file (riaa_se_xxx.se1) you want to save as VST plug-in.

Something like this should appear:



From File -menu, select Save as VST...




Name the .dll file and give an unique ID for each plug-in you create.


NOTES:





Load the RIAA EQ VST plug-in to a VST Host software etc. .


Subsonic filter result:






Resolution 5. CPS implementation


<not implemented yet>



Additional plug-ins



SUBSONIC/RUMBLE Filtering

A better subsonic/rumble filtering may be achieved by using either AIXCoustic's Electri-Q


Chebyshev I, HP Filter 36dB/oct (subsonic/rumble filter) @ 20Hz / BW20

Result







or by using Christian W. Buddes RubberFilter :

(48dB/oct @ 20Hz)

Result:







Both mentioned plug-ins can be found @ http://www.savioursofsoul.de/Christian/?page_id=64



RIAA Filter software specs

Phase

Harmonic distortion








Filter Background (regarding coefficients)


This RIAA Filter accuracy depends on sample-rate because of the filter is sample accurate. By calculated results (by Robert Orban),


@ 44.1 kHz:
two pole IIR filter:
MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS 0.2239207dB
MAXIMUM PHASE ERROR FROM 0.00 Hz TO 20000.00 Hz IS ~+/- 30 degrees
where the "phase error" is computed after a constant delay is added
or subtracted to make the phase error equiripple

three pole IIR filter:
MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS 0.0113530dB
MAXIMUM PHASE ERROR FROM 0.00 Hz TO 20000.00 Hz IS ~+/- 23 degrees
four pole IIR filter:
MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS 0.0005780dB
MAXIMUM PHASE ERROR FROM 0.00 Hz TO 20000.00 Hz IS ~+/- 21 degrees

@ 48 kHz:
two pole IIR filter:
MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS 0.1395898dB
MAXIMUM PHASE ERROR FROM 0.00 Hz TO 20000.00 Hz IS ~+/- 24 degrees
Three pole IIR filter:
MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS 0.0037544dB
MAXIMUM PHASE ERROR FROM 0.00 Hz TO 20000.00 Hz IS ~+/- 16 degrees
four pole IIR filter:
MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS 0.0000998dB
MAXIMUM PHASE ERROR FROM 0.00 Hz TO 20000.00 Hz IS ~+/- 15 degrees

@ 88.2 kHz
two pole IIR filter
MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS 0.0081862dB
MAXIMUM PHASE ERROR FROM 0.00 Hz TO 20000.00 Hz IS ~+/- 3 degrees
three pole IIR filter
MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS 0.0000096dB
MAXIMUM PHASE ERROR FROM 0.00 Hz TO 20000.00 Hz IS ~+/- 2 degrees
etc.

@ 96 kHz:
two pole IIR filter:
MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS 0.0057028dB
MAXIMUM PHASE ERROR FROM 0.00 Hz TO 20000.00 Hz IS ~+/- 2.4 degrees
three pole IIR filter:
MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS 0.0000046dB
MAXIMUM PHASE ERROR FROM 0.00 Hz TO 20000.00 Hz IS ~+/- 1.6 degrees
etc.

--> the filter should be accurate compared to RIAA standard.

Robert Orban, person behind these filter coefficients, describes the method he used for to calculate coefficients:

An IIR simulation of the RIAA phono de-emphasis curve (assuming s-plane poles at 50.5 and 2122 Hz and an s-plane zero at 500.5. Hz), here are some good minimum-phase magnitude approximations. (The RIAA de-emphasis is minimum-phase in the analog domain.)

Given a desired magnitude response in the z-plane, there exists a
response in a frequency-warped u-plane that, when bilinear-transformed
to the z-plane, creates the desired z-plane magnitude response.

-Compute the [magnitude response]^2 of the s-plane prototype on a grid.
This is the square of the desired z-plane response.

-Warp the frequency axis by using the bilinear transform, recognizing
that we are approximating using omega^2 as our frequency variable. The
warp maps Nyquist to infinity.

-Make a least-squares rational approximation (i.e., ratio of
polynomials) to the values on the frequency grid. (I used the Numerical
Recipes routine RATLSQ, which uses Chebychev polynomials.)

-Refine the approximation to make the fractional error minimax by using
Remez's Second Algorithm [which applies to rational functions; it's not
the same as the Remez algorithm used in the classical MPR FIR design
program; see Forman S. Acton, Numerical Methods That Work (Revised
Edition), Washington D.C., American Mathematical Society, 1990, pp 310-
314]

-Transform the result into the z-plane in two steps. The first
recognizes that we have been approximating using the magnitude square
function, so we must take the square roots of the poles and zeros of the
approximated rational function, taking the negative real parts to
guarantee a stable, minimum-phase function. The second step is to apply
the bilinear transform to the result of the first step. This yields the
final z-plane poles and zeros.

There are some "interesting" numerical issues in making this procedure
work, mainly because the Remez update formulas require solving a system
of mildly nonlinear equations that tend be ill-conditioned.

The nice thing about the algorithm is that the frequency-warping moves
Nyquist to infinity and thus increases the resolution of the
approximation close to Nyquist, which is where difficulties often occur.


RIAA EQ filter coefficients to use with SynthMaker, SynthEdit and Max/MSP Biquad -implementations.


kHz/coefficient

b0

b1

b2

a0

a1

a2

44.1

1.0

-1.700724

0.7029382

1.0

-0.7218922

-0.1860521

48

1.0

-1.732766

0.7345534

1.0

-0.7555521

-0.1646257

88.2

1.0

-1.855465

0.8559721

1.0

-0.8479577

-0.1127632

96

1.0

-1.866608

0.8670383

1.0

-0.8535331

-0.1104595


NOTES:


- By swapping the a1<->b1 and a2<->b2 you'll get the production filter.

Given coefficients gives a bit gained filter (~+12.5dB) so, if you like to adjust the 1kHz point to hit 0dB line, it can be done quite accurately by finding those linear differences using Tobybear's FilterExplorer. Just enter those coefficients into FilterExplorer, find/point the ~1kHz position in magnitude plot and then check the magnitude value (value inside the brackets) found in info field. Use this value as divider for b coefficients (i.e. for a coefficients in SM implementation if you use biquad objects).