Software based RIAA EQ - part 2
Mar 30, 2008 at 6:57 PM Thread Starter Post #1 of 68

jiiteepee

Headphoneus Supremus
Joined
Apr 5, 2005
Posts
1,606
Likes
62
Hi!

LATEST VERSIONS:
For Max/MSP 4.x Runtime :
April 1, '08 - RIAA Reproduction EQ v.1.o (information posted in this and 2nd post)

For Max/MSP 5.x Runtime :
Nov 30, '08 - RIAA Reproduction EQ v.1.8a (information posted here)

================================================== ============================
Max/MSP 4.x version: (this is the last version for 4.x)

'bout a year ago I posted here (and somewhere else) regarding a software based solution for RIAA EQ needed for vinyl playback on computer based audio setup when no RIAA stage available. Well, here I'm again. I've been so busy since last summer so not much happening on that front. Now, when testing the method using E-MU 0404 USB Interface, I prepared another filter by using some dedicated tools (quite easy to prepare this type of filters in this programming enviroment). Looks like the filter works so, I decided to give the project file out so if there are members who would like to try it out or needs this type software. If anybody likes to extent/improve it's functionality, I don't mind.

This RIAA Filter software works now @ 44.1, 48, 88.2 and 96 kHz and the recording (if done as I have set it up) can be done using 16, 24, 32 and 32float resolution to a wav file. It's also possible to extent the software to use other type of processing tools through VST/DX plug-ins but, you'll need to modify the project file a bit to load some VST/DX chainer (ACON Digital's EffectChainer as for an example) or certain plug-ins (check the KVR database for some) ... stereo to surround conversion, HRTF, restoration (de-Click, etc.), EQ, etc. comes into mind 1st.


Setting it up.

Needed components:

- download the Max/MSP Runtime v. 4.x (or trial version, if you like to examine/edit the filter software by your self) NOTE: At the moment, do not use v. 5.x because of it has changed some functionality and therefore the RIAA Filter maybe does not work properly.

- download and extract the RIAA Filter 1.0.zip (there's an attachment linked in this post) EDIT April 1st
tongue.gif
. : new, final version v. 1.0 attached.
Additional components:

- download the Voxengo Recorder and Voxengo SPAN, extract those into same directory w/ RIAA_Filter (or install using the installer)

Hardware setup:

- connect your turntable w/o RIAA stage to your PC audio interface (either through a flat preamp or directly (this filter can be used to gain the weak signal up to 36dB if needed))
- set the audio interface for recording (i have tried recording through analog only so I can't be sure if everything works well through S/PDIF too)

On Max/MSP and RIAA Filter software:

riaafilter10hw3.jpg


- open the RIAA_Filter.pat into Max/MSP enviroment
- open the I/O settings dialog and configure driver (samplerate, latency, etc.) and I/O ports properly
- start the engine by pressing the Start/Stop -button
- reset the Filter
- select Filter sample rate (needs to be equal w/ driver sample rate because of, these four filters are fixed for certain sample rates)


Extra options:
You'll get the SPAN and Recorder called by pressing the Open buttons. If nothing happens, move the VST .dll files into same directory with the filter software. These VST's are connected parallel so you can adjust the recording level by the SPAN output graphics/data.

If you like to edit the project file, you need least the trial version of Max/MSP. Editing is enabled through menu option View -> Edit. You can save the project ans use it even after the trial period through Max/MSP runtime.

Issues?
If no audio ... maybe you need to use ASIO drivers, try by resetting the filter, set the subsonic filter parameters (drag with mouse). If still no audio or no filter added (i.e. bassless/bright audio coming out) then, check your connections, levels, check the HW monitoring state, etc.). I found E-MU 0404 USB troublesome when changing sample rate "on-the-fly". If the filter freezes, just kill the MaxRT or Max process through task manager (ctrl-alt-del).


jiitee

 
Apr 1, 2008 at 5:53 PM Post #2 of 68
Updated the RIAA EQ Filter software to the final version v.1.0:
- more readable information fields
- selection for subsonic filter (enable/disable)

I probably prepare a better subsonic filter someday and maybe add a selection for to link those slider moves.

By setting up Electri-Q for Chebyshev I, HP Filter 36dB/oct @ 20Hz / BW20 it's possible to get quite steep subsonic/rumble filter (lighter line on graph):

http://img138.imageshack.us/img138/403/subsonicxc9.jpg


http://img86.imageshack.us/img86/9499/eqni3.jpg


Schematic for this filter project:

http://img135.imageshack.us/img135/9...erscemazi2.jpg

As seen in picture, I have multiplied the gain coefficients by 10. This gains the filter output signal over +30dB. Harmonic distortion stays still under -100dB but, if you feel it's gained too much then, just change those three first values on each RIAA filter. By dividing values by 10 you'll get the original level (~0dB @ 1kHz (as seen in the background image of tis filter software)). Do not touch into those two last filter coefficients !!


Quote:

RIAA Filter software specs:

44.1kHz
Maximum error from 0.00 Hz to 20000.00 Hz = ~0.224dB
Maximum phase error from 0.00 Hz to 20000.00 Hz = ~+/- 30 degrees

where the "phase error" is computed after a constant delay is added or subtracted to make the phase error equiripple

48kHz
Max error from 0.00 Hz to 20000.00 Hz = ~0.14dB
Max phase error from 0.00 Hz to 20000.00 Hz = ~+/- 24 degrees

88.2kHz
Maximum error from 0.00 Hz to 20000.00 Hz = ~0.0082dB
Maximum phase error from 0.00 Hz to 20000.00 Hz = ~+/- 3 degrees

96kHz
Maximum error from 0.00 Hz to 20000.00 Hz = ~0.0057dB
Maximum phase error from 0.00 Hz to 20000.00 Hz = ~+/- 2.4 degrees




jiitee
 
Aug 19, 2008 at 10:14 AM Post #3 of 68
This is the greatest thing since sliced bread, for many reasons.

If I'm loading up the IIEQ preset, is that just a standard RIAA +20db @ 20hz to -20db @ 20kHz? IS the 30db of gain you mention only if I use the MAx/MSP method?

I'll be using plenty of linear gain via hardware and want to keep the digital RIAA implementation as minimal as possible.

If using VST method, I don't need to chain the IIEQ and the Electri-Q in any order? I'm also trying a rumble filter via Waves DirectX plugin.

Great project! Thank you so much.
dc
 
Aug 19, 2008 at 4:14 PM Post #6 of 68
Quote:

Originally Posted by doctorcilantro /img/forum/go_quote.gif
This is the greatest thing since sliced bread, for many reasons.

If I'm loading up the IIEQ preset, is that just a standard RIAA +20db @ 20hz to -20db @ 20kHz? IS the 30db of gain you mention only if I use the MAx/MSP method?

I'll be using plenty of linear gain via hardware and want to keep the digital RIAA implementation as minimal as possible.

If using VST method, I don't need to chain the IIEQ and the Electri-Q in any order? I'm also trying a rumble filter via Waves DirectX plugin.

Great project! Thank you so much.
dc



Thanks, again.

The Max/MSP is a standalone implementation w/ driver and I/O settings etc..
You don't need anything more to get the RIAA EQ done. RIAA EQ is coded through biquad filters. There are some additional features added though...

The ddmf:SmallEQ VST version (showed on Creative forums as for an example) is a separate implementation. When using this VST implementation, you don't need other than a subsonic/rumble filter (if you prefer). Same w/ the SynthMaker version (it's easy to prepare by the instructions I left onto SynthMaker Forums.


The 30dB gain put in filter (and max +36dB gain through sliders) on Max/MSP implementation is for those who does not have enough hardware gain for input signal (I have used this Max/MSP implementation by directly connecting the turntable into a Soundblaster Audigy 2 card ... levels were good but as it's not the best way to boost signal after ADC ... though, you be able to gain the output signal from panel too... If there's enough hardware gain available then my suggestion is to multiply those filter gain coefficients by 10 to get the filter work @ normal level.

The Max/MSP version is quite easy to modify and can be used w/ the ax/MSP runtime version w/o restrictions on a PC and MAC.


Quote:

Originally Posted by billbillw /img/forum/go_quote.gif
I have to try this! I have a spare TT that I've wanted to hook up to my computer rig, but don't have an extra phono stage. This would be perfect if it works.


It should work if your card is ASIO capable (I had some issues w/ Audigy when used other nut ASIO (even w/ Asio4All) but, I guess it was the monitoring settings in question ... both signals (original and processed) came through ... only processed signal should be allowed)


jiitee
 
Aug 20, 2008 at 2:58 PM Post #7 of 68
I'm looking at Diamond Cut 7 trial right now; nice because they have other RIAA EQs programmed in for US & European 78s and 45rpm.

I would probably monitor with RIAA and record flat using Samplitude. Then apply RIAA and rumble after the fact with either the VST method noted here or use Diamond Cut.

I'll compare the results.

Either way, I 've decided to keep an extra copy of the masters archived raw i.e. without RIAA.

My ribbon mic-pre wasn't shipped until today so hopefully next week things will be up and running.

DC
 
Aug 20, 2008 at 6:14 PM Post #8 of 68
I just can't get this to work. I have the EMU 0404PCI. Hooked the TT to Analog in. I got the lastest Max runtime. Opened RIAA with Max (it listed some errors in the Max window). Set the inputs/outputs. Did the reset. Still very weak sound. No bass. Doesn't seem to have any effect at all. Is there something I need to do in Patchmix?
 
Aug 20, 2008 at 7:03 PM Post #9 of 68
Quote:

Originally Posted by billbillw /img/forum/go_quote.gif
I just can't get this to work. I have the EMU 0404PCI. Hooked the TT to Analog in. I got the lastest Max runtime. Opened RIAA with Max (it listed some errors in the Max window). Set the inputs/outputs. Did the reset. Still very weak sound. No bass. Doesn't seem to have any effect at all. Is there something I need to do in Patchmix?


I suppose those errors comes from that you have not installed those Voxengo plug-ins or you're using DirectSound driver mode?

Use ASIO driver mode.
Did you check monitoring setting?
Did you remembered press the Start/Stop -button?

Sorry but I don't know the E-MU 0404 PCI (which type input ports or how to set the card for stereo ASIO input) ... if you install those Voxengo plug-ins, you could see the signal level (SPAN).


jiitee
 
Aug 21, 2008 at 3:11 AM Post #11 of 68
I didn't realize the Voxengo plugins were necessary. I installed them. That got rid of most of the errors, except it still says "doesnt understand interp" or something similar.

I'm still not seeing anything in the SPAN.

I am using ASIO drivers and the latest Pathmix from EMU.

Do I need a different ASIO driver? In your DSP window, I've selected "ad_asio E-MU ASIO".

I'm just not that familiar with Patchmix yet, so I don't know if I need to setup something special there or not. Right now, its just in a default session.

Quote:

Originally Posted by jiiteepee /img/forum/go_quote.gif
I suppose those errors comes from that you have not installed those Voxengo plug-ins or you're using DirectSound driver mode?

Use ASIO driver mode.
Did you check monitoring setting?
Did you remembered press the Start/Stop -button?

Sorry but I don't know the E-MU 0404 PCI (which type input ports or how to set the card for stereo ASIO input) ... if you install those Voxengo plug-ins, you could see the signal level (SPAN).


jiitee



 
Aug 21, 2008 at 3:36 AM Post #12 of 68
Quote:

Originally Posted by billbillw /img/forum/go_quote.gif
I didn't realize the Voxengo plugins were necessary. I installed them. That got rid of most of the errors, except it still says "doesnt understand interp" or something similar.

I'm still not seeing anything in the SPAN.

I am using ASIO drivers and the latest Pathmix from EMU.

Do I need a different ASIO driver? In your DSP window, I've selected "ad_asio E-MU ASIO".

I'm just not that familiar with Patchmix yet, so I don't know if I need to setup something special there or not. Right now, its just in a default session.



No, those Voxengo plug-ins are not needed (you just get an error if not found) nor part of implementation.

IIRC, when you set-up the RIAA software, you need to select the Filter samplerate even it looks being right (i.e. equal w/ driver sample-rate) ... this is because there aren't functionality on reset option which would set the filter sample-rate equal w/ driver sample-rate automatically.

Yes, the PatchMix is confusing ... here are couple set-up 'courses' for E-MU PatchMix:

Configuring E-MU PatchMix to record a Stereo source using ASIO
Emu's Patchmix DSP Demystified...
http://www.emu.com/support/kbase/wel...sp?Centric=764 (search SID1631)

0404 Stereo product Default Session for WDM and ASIO applications + Tutorials :
E-MU: Downloads

NOTE: Check the direct monitoring state.

I'll check the latest MaxMSP Runtime if there's something changed.

jiitee

EDIT:

Looks like something has been changed for MaxMSP 5.x (does give one error) ... I'll check this later ...

You can use the older version of Runtime (RIAA filter has been prepared using Max/MSP 4.5.7)
Cycling '74 || max4
 
Aug 21, 2008 at 2:36 PM Post #13 of 68
Channel D replied to my questions about "how good" is this VST RIAA implementation (I was curious as to their opinion):

Quote:

"I would have preferred to see a curve showing the difference between the standard RIAA curve and that EQ curve, because can't determine anything from that sort of graph unless the accuracy is way out of whack. But that is beside the point...

The standard RIAA curve has only three time constants. I'm not quite sure how much error will accumulate (I'm speaking of generating spurious distortion and noise, etc., not RIAA error) from those 10 EQ filters, which are probably state variable filters; at least 4 separate coefficients per filter = 40 total; that is one heck of a lot of computation; also, a highpass rumble filter is necessary to remove the LF shelf in that response, or you will have problems. And aside from all that, I don't think that anyone would ever contemplate doing it this way in the analog domain, either...

When you have a Mac... then we can talk.
smily_headphones1.gif
"


Comments?

DC
 
Aug 21, 2008 at 3:47 PM Post #14 of 68
I have implemented this filter using three different programming environments + the preset for ddfm:IIEQ/SmallEQ versions.

On My Delphi implementation, I use 3th-4th order filters, on Max/MSP (Standalone) version only 2nd order filter and on SynthMaker (a VST plug-in or Standalone) 2nd - 4th order filters. Most of my filters are based on Robert Orbans calculations. Max/MSP and SyntMaker versions are made using Demo/Trial software -> I can share/show just a project file (like this MaxMSP version showed here) or a .dll/exe (periodical noise added).

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

Quote:

@ 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 is accurate compared to RIAA standard.

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

Quote:

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 e-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.



The IIEQ/SmallEQ VST preset for RIAA EQ 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 @ 44.1kHz ... error: avg. under ±0.05dB (0Hz- ~ 18.2kHz) and from ±0.1dB to -1.6dB (~18.2kHz - 20kHz) @ 44.1kHz). I think you need to prepare an unique preset for each sample-rate as well.

As I don't have the sample accurate data for "exact" RIAA curve other than what those Orban coefficients gives (though, those should be accurate because of being calculated using 1:1 same 'components' which the original RIAA curve is based/defined of), I can't exactly compare the software implementation results against hardware RIAA EQ results.

EDIT: Here is the comparison for Delphi VST (2 pole) vs ddfm:IIEQ/SmallEQ VST (it's a 2MB HTML page so it may load slowly on a slow speed connection). I have ~20 versions of EQ presers for IIEQ so I can't say if this is the most accurate (I don't use ddfm:IIEQ/SmallEQ for RIAA so ...). If you prefer a RAR packed version then here it is.
As those Orban coefficients gives a gained filter, in my Delphi implementation, I have adjusted the 1kHz @ 0dB "visually" so, the Delphi filter might be gained or de-gained a bit (though, not much).

EDIT2: I prepared a .svg page showing graphically the difference. The red line there is the 'reference' (~0.2dB wide) and the blue line is what IIEQ outputs (0.1dB wide).


jiitee
 
Aug 22, 2008 at 3:06 PM Post #15 of 68
Is this the correct IIEQ for the .fxp you posted on rapidshare?

I note the Pro, Normal (pic below), and the often mentioned Small version, but haven't seen the Small one for download.

I'm using ddfm_IIEQ-RIAA_Reproduction-6.fxp with this one:

IIEQ.jpg
 

Users who are viewing this thread

Back
Top