What about digital RIAA?

Administrator
Joined 2004
Paid Member
I had half forgotten this thread. Last week I was running my phono cart straight into my USB soundcard because my phono premp was dead. I used an impulse with convolution in Windows Equalizer APO to do the RIAA curve as well as EQ for the cart loading. It took some fiddling to get the cart EQ right, but it worked like a charm once in place. There is so much correction already in the RIAA EQ that tweaking it a bit for the cartridge doesn't hurt. CPU load was tiny for 48/24

What I did find - and the reason I'm posting - is that NOT boosting anything below 20 Hz was a big help as a rumble filter. Why boost what you don't want? I just left gain at zero below ~20Hz. Well worth a try if you are doing digital RIAA.
 
Yes, its necessary to damp down those low frequencies.
When doing IIR based filtering one could add 48dB/oct HPF @ 10Hz before PhonoEQ filter and after this add 18dB/oct HPF @ 20Hz (and 18db/oct LPF @ 20kHz).

Attached separate RIAA.ny files for common sample rates (from 44100 to 384000Hz) to be used in Audacity Nyqvist prompt. Sorry, but I didn't test these with recorded audio source (tested just using noise generator data in Audacity). Have to add case structure then later so all coefficient sets can be in one file.
As a rumble filter, one could add line: (highpass8 s 20.0) before (or after) RIAA biquads (add one empty line between highpass8 and biquad command) so rumble filtering becomes done in same process with RIAA filter (faster to do this way).
 

Attachments

  • RIAA.zip
    2.6 KB · Views: 85
Administrator
Joined 2004
Paid Member
My methods are crude, so may not apply for everyone. It's just that I realized my digital EQ was boosting everything down to 1 Hz by 20 dB. That meant the rumble, tone arm resonance and anything else down there. When I left everything <20Hz at zero instead of +20 dB boost, the signal cleaned up very audibly.

I don't think I was running into clipping anywhere, but it's possible. I do remember the tone arm resonance being the highest peak after RIAA.
 
In addition to Pano's reply,
there's lot of un-needed power there at low end (below 20Hz) you can't hear but sure you can see it. Just take off the cover of your speaker front while playing vinyl or recording of it (with and without high passing)... I guess the situation is same if you use headphones though the pumping effect isn't that noticeable.
 
...

I have also released today this RIAA coefficient builder prototype as Matlab/Octave code (not yet tested in real time application):

Code:
% RIAA equalization filter
% Standard samplerates from 44100 to 384000 supported
% Brought to you by [email]jiiteepee@yahoo.se[/email] (8 April 2020)
function [b, a] = RIAA_deemphasis((x, inverted)
  %        x = samplerate in Hz
  % inverted : true = emphasis, false = de-emphasis
switch x 
  case { 44100, 88200, 176400, 352800 }
    a(1) = -3.78572821649894E-17*x^3 + 2.52492635019007E-11*x^2 - 5.29140550506889E-06*x + 0.4183761420686;
    a(2) = -3.29659785253531E-17*x^3 + 2.18188804908089E-11*x^2 - 4.49558809614241E-06*x + 0.340803782016109;
    a(3) = 2.13427162324699E-17*x^3 - 1.44832812129522E-11*x^2 + 3.14910650666778E-06*x - 0.270743433143131;
    a(4) = 2.43878784135422E-17*x^3 - 1.63703244700658E-11*x^2 + 3.47872123422787E-06*x - 0.284280409184197;
    a(5) = 5.14722389769101E-18*x^3 - 3.44467018649422E-12*x^2 + 7.27288189729686E-07*x - 0.05855692642697;
    a(6) = 1.78214502585031E-19*x^3 - 1.18972620155484E-13*x^2 + 2.49862328884841E-08*x - 0.001987028069768;
    b(1) = 1.0;
    b(2) = -4.55290631534176E-17*x^3 + 3.04003816124316E-11*x^2 - 6.38623072649445E-06*x + 0.036651228977512;
    b(3) = -2.17886339309136E-17*x^3 + 1.45484739554451E-11*x^2 - 3.05694119649456E-06*x - 1.15432992268202;
    b(4) = 3.87367489428091E-17*x^3 - 2.58899887170957E-11*x^2 + 5.45011238426768E-06*x - 0.156383761864616;
    b(5) = 2.40425973859099E-17*x^3 - 1.60789566553566E-11*x^2 + 3.38997016926901E-06*x + 0.247425823969509;
    b(6) = 2.54127108991136E-18*x^3 - 1.70179240935058E-12*x^2 + 3.59921561223217E-07*x + 0.041145736788926;
  case { 48000, 96000, 192000, 384000 }
    a(1) = -2.7452780571244E-17*x^3 + 1.99154393419583E-11*x^2 - 4.53584676661555E-06*x + 0.388910789461241;
    a(2) = -2.35251182142996E-17*x^3 + 1.69460468999989E-11*x^2 - 3.79976340701253E-06*x + 0.313417459710588;
    a(3) = 1.60394779826124E-17*x^3 - 1.18134248157214E-11*x^2 + 2.77914944092047E-06*x - 0.256686985639999;
    a(4) = 1.79214193481841E-17*x^3 - 1.30758453834294E-11*x^2 + 3.01551209856552E-06*x - 0.266372686264431;
    a(5) = 3.75875129146243E-18*x^3 - 2.73515275421544E-12*x^2 + 6.27167882845746E-07*x - 0.054669929110542;
    a(6) = 1.29466085326558E-19*x^3 - 9.40021380146474E-14*x^2 + 2.14525398501157E-08*x - 0.001849383721124;
    b(1) = 1.0;
    b(2) = -3.31087520545089E-17*x^3 + 2.40419060193625E-11*x^2 - 5.48704255441296E-06*x + 0.001655256200658;
    b(3) = -1.58217404372195E-17*x^3 + 1.14907596097219E-11*x^2 - 2.62396853400952E-06*x - 1.17120945842617;
    b(4) = 2.82267460112979E-17*x^3 - 2.05145448671967E-11*x^2 + 4.69079915137507E-06*x - 0.126870578343129;
    b(5) = 1.75227789917925E-17*x^3 - 1.27437895605759E-11*x^2 + 2.91872050553504E-06*x + 0.265751206588621;
    b(6) = 1.85456891004083E-18*x^3 - 1.35060949072864E-12*x^2 + 3.10309889494121E-07*x + 0.043074905938478;
  otherwise
    b = [1 0 0 0 0 0];
    a = [1 0 0 0 0 0];
  end
  
  if not(inverted)
    c = b;
    b = a;
    a = c;
  endif

This is enough accurate filter in question, even for 44.1kHz sampling, but, it is 6th order IIR implementation. If needed it can be turned to second order sections (SOS) with few lines of Matlab/Octave code (each sample rate needs its own set of SOS coefficients):

Code:
% Octave related package (comment next line for Matlab)
pkg load signal

format long;

fs = 44100; % user variable

[b, a] = RIAA_deemphasis(fs, inverted = false);
FLT=tf(b, a, 1/fs);
[a, b, T] = tfdata(FLT, 'v');
[sos, g] = tf2sos (b, a)
save -append RIAA.txt fs sos

Took a look of magnitude accuracy of these filters.

errors.png


Copy of error plot attached.
 

Attachments

  • errors.png
    errors.png
    28.5 KB · Views: 125
Member
Joined 2014
Paid Member
When I left everything <20Hz at zero instead of +20 dB boost, the signal cleaned up very audibly.
<snip>
I don't think I was running into clipping anywhere, but it's possible. I do remember the tone arm resonance being the highest peak after RIAA.
Makes sense. If it sounds better that's good. The highest peak is generally the 0.55Hz centering error. But above that tonearm resonance for an undamped arm appears highest in all the plots I have seen.


In addition to Pano's reply,
there's lot of un-needed power there at low end (below 20Hz) you can't hear but sure you can see it. Just take off the cover of your speaker front while playing vinyl or recording of it (with and without high passing)... I guess the situation is same if you use headphones though the pumping effect isn't that noticeable.


OK, if you suffer from pumping it makes perfect sense. As that infrasonic is causing damage to the signal that you cannot filter out my current preference is to address it as much as possible mechanically then add LPF to taste as needed.
 
No. Jiiteepee, good to see you still have energy for this. One precaution when you break a high order IIR into biquad sections you can have numerical error issues depending on the order. At 96K only two biquads do +-0.000010dB all the way to 20kHz.

@PANO the Windows equalizer says it does not work with things like WASAPI exclusive but this is the only way my USB sound card will do 24/96 in Audacity.
 
Last edited:
No. Jiiteepee, good to see you still have energy for this. One precaution when you break a high order IIR into biquad sections you can have numerical error issues depending on the order. At 96K only two biquads do +-0.000010dB all the way to 20kHz.

Yes, and a 3 pole IIR can do better, as like (quote from R. Orban's post at comp.dsp)
MAXIMUM ERROR FROM 0.00 Hz TO 20000.00 Hz IS 0.0000046dB
... but the question is: "how you do it".
I know its risky with SOS filters....
 
...
@PANO the Windows equalizer says it does not work with things like WASAPI exclusive but this is the only way my USB sound card will do 24/96 in Audacity.

If you mean EqualizerAPO ... you should be able to use it even with ASIO, WASAPI Exclusive and WDM/KS devices through VB-Audio's Voicemeeter (BANANA) ... though, this would bring an extra layer to your audio path then.
 
Eek. I first posted on this thread in 2015 and I'm only now ready to load up miniDSP for testing. Amazing how much kids slow down projects...

Yes, amazing.
I'm the opener and almost forget this thread...
Anyway, i report my experience.
With jriver and an audio interface (scarlett 2i2 in my case) i loaded in convolution a RIIA file i did take here and it did work like a charme.

Some thoughs:
1 i saw the error chart of the riia and it is amazing.
Maybe one could concentrate in a "tube" sound, more than the perfect response (bell frequency response);
2 i saw the tip of cutting away frequencies below 20Hz and i think it's an excellent idea.
3 i don't think it's an excellent idea to cut away frequencies above 20KHz.
One of the best part of a vynil record is it eventually doesn't cut frequencies above 20KHz, as per red book, but it is very common to see records with an audio band until 60KHz.
Of course one cannot listen to that frequency, but the effects of modulation still reflects on in-band contents.
So, to be really perfect, it's necessary to think the audio band - and the riia file too - from 20Hz to 60KHz.
it will be up to the amplifier to be able to reproduce those frequencies or not, as is always the case in an analog chain.

Edit:
what riia eq will be from 20KHz to 60KHz?
I really don't know.
Maybe a straight line...

Edit2: of course the audio interface must be able to acquire up to 60KHz, which is not too common, therefore it remains more a theoretical exercise than a practical one
 
Last edited:
...
Edit:
what riia eq will be from 20KHz to 60KHz?
I really don't know.
Maybe a straight line...

Edit2: of course the audio interface must be able to acquire up to 60KHz, which is not too common, therefore it remains more a theoretical exercise than a practical one

For outputting up to 60kHz you'd need use sampling rate of 120kHz (Nyqvist's sampling theorem) --> so, if we follow the common rates, your audio interface should support at least 176.4kHz sampling. Many audio interfaces uses limiter to filter out HF content so ... .
Here are RIAA responses for common, 44100 based sample rates (range 1Hz - 100kHz (blue: 44100, green: x2, cyan: x4 and red: x8)):

44100based.png


Copy of same image attached.
 

Attachments

  • 44100based.png
    44100based.png
    21.7 KB · Views: 107
Last edited:
One of the best part of a vynil record is it eventually doesn't cut frequencies above 20KHz, as per red book, but it is very common to see records with an audio band until 60KHz.


Actually, most vinyl pickups don't really reproduce actual music signals much above 20 kHz. What you see is harmonic products (distortion) and noise.

The various 4-channel vinyl formats used ultrasonic frequencies up to 40 kHz for the rear channel information, but that required special pickups and needles, and it was observed that the ultrasonic signal decayed after the record was played several times.


Of course one cannot listen to that frequency, but the effects of modulation still reflects on in-band contents.


Yes, in a harmful way.