Turntable -> PC (RIAA EQ done by software filter)

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Turntable -> PC (RIAA EQ done by software filter)

Hello!

Well, after many tries w/ not so good results in using various EQ plugins and standalone EQ software for RIAA compensation, I have now started implementing a solution of my own ... a RIAA reproduction filter to be used when turntable is connected into soundcard without hardware RIAA stage in signal path .. but just through a flat pre-amp. I've seen there some commercial solutions available and one 'open source' solution for Soundblaster/kX users (link given below).

All I can say so far, is that the results I get are really qood (especially w/ 88.2kHz and 96kHz filters) but, since I have only one set of hardware to evaluate this software, I would like you to evaluate this too. This filter,

An externally hosted image should be here but it was not working when we last tested it.


( :D .. Sorry 'bout the visual outlook but ... don't laugh, it should work well)

which I have linked below, is prepared only for this evaluation purpose. It's optimized for 44.1 kHz audio (any bit depth can be used), its for output only and it can be used through Cycling74 Max/MSP runtime enviroment only. ASIO, MME, DS, etc. are supported as well as Windows XP and MAC OS/X 10.3.9-> (there is a runtime for both systems available). For this "evaluation" version, I have included a rumble filter (Subsonic) w/ ability to set the cutoff frequency (5-30Hz) and Q (0.1-1.41). It's allways ON and not very well implemented (see below).

Here are listed the needed software:
RIAA Filter (for 44.1kHz) DEMO.rar (~16kB)
Mirror 1
Mirror 2
-- 3 files included (2 pictures and the filter .pat file)
NOTE: Filename may become changed by the service providers system.

Max/MSP 4.6.2 Runtime enviroment for PC/MAC (~4.5MB/9.1MB)

Setting it up (Windows):
- connect your turntable output through some flat pre-amp (no RIAA stage in signal path) into PC through soundcard line input(s)
- connect your output device (amp/active speakers/headphones) into soundcard output(s)
- install the Max/MSP runtime enviroment
- extract the "RIAA Filter (for 44.1kHz) DEMO.rar" to your harddisk
Start the RIAA Filter program either by
- starting the runtime enviroment and Open the "RIAA Filter (for 44.1kHz).pat" or
- double-clicking the "RIAA Filter (for 44.1kHz).pat" (through Windows Explorer -> .pat extention should be associated to Max/MSP runtime then)

In "RIAA Filter (for 44.1kHz)" screen (important):
- set I/O devices; ASIO recommended (if no sound, remember check settings in mixer software)
- adjust the Subsonic filter by dragging w/ mouse (Hz = 25Hz and Q = 0.71 are good to start from) (see below)
- adjust Gain to somewhere near the 0dB mark (128)
- press the Play/Stop button to enable the playback through filter

NOTE: If you can hear audio when Play/Stop is set "OFF" (there should be total silence) then you need to set something in your mixer software (maybe monitoring OFF, mute something, etc.) otherwise the unfiltered signal is summed into playback --> brighten sound.

Some notes:

As mentioned, this filter is for 44.1kHz samplerate/data only. What it means is that the mathematical model is matched for amount of this much samples per second (sample accurate processing). Biquad method used in this filter uses three samples to get the new output value calculated (current sample and two previous samples). What happens if you set samplerate to 48kHz, as for an example, ... samples becomes processed wrong --> quality becomes bad.


Subsonic filter:
It's low order highpass filter so the cut is not very sharp/steep ... you can use 25-30Hz as cutoff frequency w/o loosing much from above the 20Hz frequencies.
Example on how # of orders effects (this is for lowpass filter).


RIAA filter:
You see the RIAA de-emphasis curve for this filter as a background image for Filter screen. The original filter coefficients (15 decimal accuracy) gives quite accurate de-emphasis curve (error: ±0.23dB) even as a 2nd order filter (4th order filter would give error: ±0.0006dB) .. as the Max/MSP enviroment seem to scale and round the given value into 6 decimal value, it may have some negative effect on accuracy. I have compared the orignal 15 decimal data against rounded 7 decimal data and those didn't differ very much by the results (sound and frequency response curve). Some other results from measures (all these measure data is got from the project version of filter (VST)):


Phase:

An externally hosted image should be here but it was not working when we last tested it.


Harmonic distortion:

An externally hosted image should be here but it was not working when we last tested it.



Software notes:
Gain, and Subsonic controllers resets to "0" when filter is loaded into runtime enviroment so, all these needs to be set every time after filter is loaded otherwise you get bad quality audio if at all. If you get rattle in audio, just toggle the Play/Stop or reassign your I/Os. Hmm.. I hope there are no bugs since I can't test or fix in realtime because of I'm still using W2k and the Max/MSP needs XP being installed (even the runtime won't get installed in W2k SP4).


Hardware notes:
You need some pre-amplification for turntable output (in most cases) to get signal levels good enough for soundcard input.


So, are you interested to try it out?

I beg you not to turn this thread into "hardware vs software RIAA" question. I just wish you could try this filter and comment the results you get. If you don't like the result then just say it and it also would be better if you could specify the reason for your opinion (I need a lot of all kind of information).

jiitee

P.S.

Actually, I have a VST/Standalone RIAA Filter project (becomes released as donationware) ongoin' but, as I want to hear some commenting and maybe suggestions from you, I prepared this special version just because of it (thanks to Peke for letting me to sit w/ him in front of his PC over a couple of hours ...). The project filter do have some additional features as like
- (22.05,) 44.1, 48, 88.2, 96 (172.4 and 192) kHz (in both)
- filter for 50/60/..Hz humming, (in both)
- maybe pop/click filter, (in both)
- better Subsonic filter (6-8th order filter) (in both)
- recording capability (16-32bit wav), (in standalone only)
- audio file playback capability (if you like to rip w/o RIAA EQ), (in standalone only)
- various presets for RIAA (there are plenty of different ones used before 1955) (in both)
- better de-emphasis accuracy for RIAA curve (3rd/4th order filters) (in both)
- DBX filter (I do have couple of DBX recordings)? !! If I can find needed data to get those filter coefficients calculated
- etc. (suggest some)


P.S.2.

BTW, if here are kX Project driver users, who are interested on this matter, there is a DSP macro for same purpose made by Hannes Rohde. You can DL it from here.
 
Hello jiiteepee -

Are you the same person who has been posting on this as juha_p at kvraudio.com and as jtp_1960[ AT ]hotmail[ DOT ]com at musicdsp.org?

If so then I guess it is you who made this post at kvraudio.com.

If so then I guess you are using the IIR biquad filter coefficients referred to in that post, which are based on inverting the coefficients given in this post at musicdsp.org for playback equalization. The musicdsp.org coefficients are for an inverse RIAA filter with the recording equalization as defined in this Hageman app note fig.2.

I have looked at the conformance to RIAA playback curve of these coefficients for 44.1kHz using LTSpice, the magnitude response is about the same as a good RIAA preamp filter, +0.27dB at 4khz and -0.5dB at 15kHz compared to 1kHz, but the phase response leads with increasing frequency, +4.7deg at 4kHz, +13 at 9kHz and +32 at 15kHz.

I think the magnitude response could be improved somewhat below 15kHz but improving the phase response requires a higher sampling rate. The normal means of translating an analog filter to IIR biquad coefficients (bilinear transform) gives significant magnitude error above 5kHz which can be compensated for by "warping" the poles/zeroes before translation, but there will still be some magnitude error, and the phase error will not be improved. At 88.2kHz or higher the magnitude and phase response could be practically perfect.

I have been investigating software RIAA playback equalization out of curiosity, and if I were to implement this I would process the 50Hz pole and 500Hz zero in software and the 2122Hz pole and optional 50kHz zero in hardware, to reduce loss of amplitude resolution in the midrange (and improve the high frequency phase response though this is not significant at 88.2kHz), but I respect your request to not debate software vs. hardware approaches. In any case, 24 bit resolution is mandatory with a software approach and highly recommended with a hybrid approach.
 
jackinnj said:
Ya know what would be really helpful -- an RIAA eq. in which you can choose the much, much older formats -- Rod Elliot has the time constants somewhere on his website.

With this one could transfer those very old non-LP records without having to build a filter for each format.


The Audacity sound editor (1.3 beta version) has an equalizer with presets for these older formats. It's an FFT filter so its phase response may be linear instead of minimum like analog filters or IIR filters derived from analog.
 
Yep, same person.

I have looked at the conformance to RIAA playback curve of these coefficients for 44.1kHz using LTSpice, the magnitude response is about the same as a good RIAA preamp filter, +0.27dB at 4khz and -0.5dB at 15kHz compared to 1kHz, but the phase response leads with increasing frequency, +4.7deg at 4kHz, +13 at 9kHz and +32 at 15kHz.

I think the magnitude response could be improved somewhat below 15kHz but improving the phase response requires a higher sampling rate. The normal means of translating an analog filter to IIR biquad coefficients (bilinear transform) gives significant magnitude error above 5kHz which can be compensated for by "warping" the poles/zeroes before translation, but there will still be some magnitude error, and the phase error will not be improved. At 88.2kHz or higher the magnitude and phase response could be practically perfect.

Are you talking 'bout those coeffecients F. Umminger released there? If so then those given for 44.1kHz are maybe not OK (compare those 44.1 vs 48 there).

I have calculated those 44.1kHz cefficients which I used in this evaluation version from different sources. If you just like, I can post you the link to the source (there are coefficients for 44.1-96 up to 3rd-4th 'order' available).

I have been investigating software RIAA playback equalization out of curiosity, and if I were to implement this I would process the 50Hz pole and 500Hz zero in software and the 2122Hz pole and optional 50kHz zero in hardware, to reduce loss of amplitude resolution in the midrange (and improve the high frequency phase response though this is not significant at 88.2kHz), but I respect your request to not debate software vs. hardware approaches. In any case, 24 bit resolution is mandatory with a software approach and highly recommended with a hybrid approach.

Hmm... aren't the phase response problematic only when it's totally opposite w/ the frequency responce curve (IIRC, someone mentioned this). The Phase plot given here looks the same w/ the one I got from VST plugin analyzer (which supports 44.1kHz mode only).

If you like to check the RIAA filter evaluation version using higher samplerate coefficients, but you don't have Max/MSP there, you can download the trial version of it and just swap those coefficients I used there with 88.2 or 96 kHz ones (you need to transfer those complex values, given behind the link I post you if you like to, into decimal values 1st). Those F. Ummingers coefficients for 88.2 and 96 didn't work when inverted (produced an unstable filter) without changing the value a1 and a2 a bit so that the result in formula "-a1 - a2" didn't exceed 1.0. By manually changing those valuse the filter results differently ofcourse.


jiitee
 
Are you talking 'bout those coeffecients F. Umminger released there? If so then those given for 44.1kHz are maybe not OK (compare those 44.1 vs 48 there).

Yes, that is all you have referred to in your posts elsewhere that I could find.

I have calculated those 44.1kHz cefficients which I used in this evaluation version from different sources. If you just like, I can post you the link to the source (there are coefficients for 44.1-96 up to 3rd-4th 'order' available).

Yes, please do. I'm curious about how you calculated them, I guessed that you inverted and then perhaps adjusted the Umminger coefficients, but maybe not. Every reference to IIR biquad coefficients for RIAA eq I could find on the Web seemed to trace back to Umminger, and unfortunately he did not base his calculations on the actual transfer function for RIAA playback eq: (3.183e-4*s+1)/((3.183e-3*s+1)*(75e-6*s+1)), but on component values of an inverse RIAA filter from the Hageman app note.

Hmm... aren't the phase response problematic only when it's totally opposite w/ the frequency responce curve (IIRC, someone mentioned this).

Theoretically the phase response of the combined RIAA recording and playback eq is flat, in other words 0 deg. To accomplish this the phase response of the playback eq should be as close as possible to the curve shown in your reference, a very good one BTW. The numbers I quoted were for the response of the combined eq using ((3.183e-3*s+1)*(75e-6*s+1))/(3.183e-4*s+1) for the recording eq and Umminger's inverted coefficients for the playback eq, this shows how closely the playback eq matches an ideal analog implementation. In practice of course the imperfect magnitude and phase response of the physical elements in the signal chain come into play so you can never acheive flat response with respect to the master tape, so the deviation may be of academic interest. In any case at 88.2kHz or higher the deviation should be insignificant, it's only an issue for 44.1kHz.
 
Originally posted by nuvistor

Yes, please do. I'm curious about how you calculated them, I guessed that you inverted and then perhaps adjusted the Umminger coefficients, but maybe not. Every reference to IIR biquad coefficients for RIAA eq I could find on the Web seemed to trace back to Umminger, and unfortunately he did not base his calculations on the actual transfer function for RIAA playback eq: (3.183e-4*s+1)/((3.183e-3*s+1)*(75e-6*s+1)), but on component values of an inverse RIAA filter from the Hageman app note.



Inversing can be done by swapping a and b vectors and then just multiplying all values by 1/a0. Normalization for b's can be done then by dividing each b by the sum of b's. From Ummingers data, you get only 44.1 and 48 kHz filters stable.

Actually, these are inversed already ... depending on the usage, you perhaps need to transform from pole/zero presentation to coefficients only (I did use functions from DFilter component (comes with VST SDK for Delphi) for transform those 44.1kHz values I needed in the evaluation version ... need to tranform those higher order versions then later when it's topical).

And yes, don't ask, it's one of my 'personalities' as well in question, who started the thread there.


jiitee
 
I found the poles/zeros list by Orban in your reference and tried this one:

44.1 kHz:
SUPPLY # POLES IN Z-PLANE (<=10):2
Zero # Real Imag.
1 -0.2014898 0.000000
2 0.9233820 0.000000
Pole # Real Imag.
1 0.7083149 0.000000
2 0.9924091 0.000000
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

I get a magnitude error of 0.447dB or +/-0.2235dB, and a phase error of +53deg at 15kHz, consistent with the errors quoted. The contributor probably input the RIAA playback eq s-plane poles/zeroes into an program or Matlab script that calculates the z-plane poles/zeroes to match the s-plane magnitude. I noticed that Umminger does not explain his methods, but Orban does so in this thread.

I tried to get a single z-biquad from the s-biquad using a freeware called StoZ available at digitalfilterdesign.com. It carries out the bilinear transform, unfortunately the s-pole/zero entry does not work, give it s-biquad coefficients instead, and for 44.1kHz the resulting z-biquad is < 0.2dB low below 4kHz, 1.5dB low at 10kHz, 4.5dB low at 15khz. I have not tried this at 88.2kHz but the results are probably 1.5dB low at 20khz, the Orban results for a single biquad are much better.
 
No feedback/results yet??

Allright, maybe it is/was too hard to use or too limited to get your attention so, ... I prepared another evaluation version ... now it's fixed for 48kHz instead of 44.1kHz, it can be used without preamplifier too (in most cases) and it's possible to record the output to a 16-/24-/32-/32f-bit wav file (though, this needs another plugin being installed, see below).

I also added a "reset to defaults" button so It's possible to get everything working much easier. Subsonic filter is not improved ... it still cuts only 6dB/oct instead of 'required' 36dB/oct.

'bout recording the output:
You need to install Voxengo Recorder VST plugin into the same directory where to this RIAA Filter is placed to, to get the recorder working. Actually, you could use any plugin but it needs to be renamed equally to the voxengo recorder .dll. Set the "MME Device" to "Sound Mapper" .. otherwise you may hear some unwanted noises (those are not added into recorded file). Set the "Output To " -> "File". Name the file before recording. Set the bit-depth.


Here are links for the new version.
RIAA Filter (optimized for 48kHz) DEMO.rar
Mirror 1 -
Mirror 2 -


Hmm... still waiting some feedback/comments ...


jiitee
 
I've evaluated the magnitude and phase error of some of the Orban IIR filter z-domain poles/zeroes against the actual RIAA playback eq s-domain transfer function by frequency analysis calculation. The 44.1/48kHz 4 pole/4 zero versions and all of the 88.2/96kHz versions yield a practically perfect match to the RIAA function by this analysis.

My results:

44.1kHz 2 pole/2 zero -
+/- 0.225dB +/- 5 deg 20Hz - 17kHz

44.1kHz 4 pole/4 zero -
+/- 0.03dB +/- 1.8 deg 20Hz - 17kHz

88.2kHz 2 pole/2 zero, 3 pole/3 zero -
+/- 0.03dB +/- 0.3 deg 20Hz - 20kHz

48kHz is similar to 44.1kHz, 96kHz should be similar to 88.2kHz.

Calculation was done in the s-domain, using the identities:

z = exp(j*2*pi*f*(1/Fs)), s=j*2*pi*f, Fs = sample rate (44.1kHz, etc), f = signal frequency, j = sqrt(-1), pi = 3.14159...

My first attempts confirmed the magnitude error quoted by Orban but showed a large positive phase shift above 2kHz, this is because I did not account for (quoting Orban): "the "phase error" computed after a constant delay is added or subtracted to make the phase error equiripple". The phase error is better than Orban quoted after accounting for the delay.

One more point, the resulting IIR filters should be stable since the poles are in the range -1 < p < +1.

Though I am now satisfied that in theory an IIR filter can approximate RIAA frequency/phase response better than most analog filters, I have no interest in using one at this time, I may do so after I can set up and compare that filter with a filter having the 2122Hz pole in hardware and the 50Hz pole/500Hz zero in software.
 
Thanks, you've been working hard on this matter.

Hmm... I suppose there starts to become other factors to fight against when trying to produce even better resulting software (and hardware) based RIAA stage ... as like
- magnitude error of cartridge (effective mass (i.e. materials), frequency responce deviation by the temperature changes, stylus pressure, etc.)
- load impedance and capacitance (soundcard is maybe not the best possible partner),
- effects of computer internal noising/interfernces etc..
- soundcard specs (ADC/DAC, op-amps, etc.)
- etc.

Sure these can be partly fixed to be the best possible.
I suppose the 4th order filetr for 44.1/48kHz and 3rd order filter for 88.2-> kHz are already on level you can't achive with hardware needed in this entirety. Maybe the hybrid you're thinking 'bout would be the last bit of improvement you could get.

jiitee
 
Your post and project is interesting to me.

I have a perhaps unique perspective on this approach since I have a patent on an analog RIAA preamp and I now practice DSP.

I'm am not going to try to make analog versus digital arguments, but I thought I might share some DSP insights.

I assume that you used bilinear transform to map the RIAA curve into the Z plane. There is no perfect mapping from the s plane into the z plane. In other words, you can not make a digital filter meet the exact RIAA curve.

OTOH, you can't buy perfect Rs & Cs and active devices eirher, so everything is an approximation.

If you used the bilinear transform, the frequency response fall more rapidly than the idea rolloff. It will go to 0 at fs/2. You can improve this situation by sampling at a higher rate. You could also interpolate in software before the RIAA filter. This will cause you filter to conform more closely to the ideal curve at high frequency. There are tricks that you can also use to move the zero at PI to better approximate the curve.

I didn't look at your coefficients so maybe I am not telling you anything you don't already know.

The other issue are the 50Hz and to a much lesser extent, the 500 Hz corners. As you sample at a higher rate, the precision of your filter becomes much more important. If I was implementing this filter, I would probably use a DFI (Direct Form I) with 32 bit precision coefficients and either first order error shaping or double precision (fixed point math). This assumes a double width accumulator for the results. Jon Dattoro has a great paper in the AES journal that discusses these issues.

I think the other issue with your preamp will probably be S/N. I'm not sure that a sound card is going to be good enough. You might look at some of the high performance sound cards as opposed to the typical AC-97 based types.

You could also play with a hybrid approach. You could use a low noise buffer followed by a 75uS RC (2122 Hz). This might help your S/N. It would also insure help avaoid aliasing of the soundcard and also effectively avoids slewing distortion of the front end of the ADC buffer (if relevant).

Al Clark
 
the better balance of s/n and headroom would come from a single pole that nearly matches the RIAA curve, nearer 50 Hz would be my choice

with the 75 uS pole you need 2122 / 50 = 40x digital "gain" for the low freq eq which cuts into the s/n

with a 50 Hz pole you need 4x digital eq attenuation above 2122 Hz but with music having a ~ 3 KHz power bandwidth this should have little headroom cost
 
I haven't had time to elaborate on my suggestion of a hybrid RIAA eq with digital 50Hz/500Hz and analog 2122Hz until now, in the meantime it's encouraging to see the continued technical interest.

The main problem I see with the all-digital eq has been noted before, 20Hz is amplified 40dB more than 20kHz, suggesting a loss in A/D resolution of 40dB or 6-7 bits at 20Hz, or 20dB/3 bits at 1kHz. As jcx notes, music power bandwidth is limited so there may not be as much resolution loss in practice with careful level setting, but overload margin for pops/clicks may be too small.

An external preamp is really necessary to match the phono cartridge and to manage electrical noise, and allows simple inclusion of a 75us analog pole. The 75us analog pole eliminates the resolution loss above 1kHz and reduces it to 3dB at 500Hz, 6dB at 280Hz, 12dB at 120Hz, 20dB at 20Hz. In addition the 50Hz/500Hz can be accurately approximated using the bilinear transform which can be easily calculated.

This hybrid approach was proposed in this 1991 IEEE paper, by this time vinyl was in decline so I doubt there was any commercial interest.


Hi danville -

Thanks for your reply, I found some of your postings from a few years ago at music.columbia.edu/music-dsp on this subject. I'm no DSP expert, but I believe I did correctly verify the magnitude/phase error of the z-plane poles/zeroes against the s-plane RIAA transfer function as referenced in my earlier posts.

Using the bilinear transform to derive the z poles/zeroes from the RIAA transfer function gives an unsatisfactory approximation below about fs/8. The z poles/zeroes contributed by Orban are derived with another method that he describes briefly in one of the links I quoted earlier, the better sets have magnitude/phase error as good or better than a practical analog implementation, unfortunately his methods appear to be proprietary. Some papers on the subject of z-plane approximations to arbitrary magnitude/phase s-plane functions can be found by web searching but the math is not elementary. Matlab has yulewalk which gives IIR coefficients to match an arbitrary magnitude response table but does not consider phase.

I agree that computing precision is an issue here, jiiteepee's project is run on a PC, he doesn't mention data format but 32 bit floating point is a standard representation for audio data, hopefully this is sufficient. I found 6 significant digits to be enough when I verified the poles/zeroes, does higher coefficient precision reduce roundoff errors?

I agree that S/N is an issue, as noted above.


Hi jcx -

I guess you are suggesting a 50Hz analog pole and 500Hz/2122Hz digital zero/pole? If so the digital eq has 6dB gain at 1kHz and 11-12dB above 3kHz, this can certainly be done though the digital filter design is not as convenient. I can see where this might improve overload margin for pops/clicks over the other approaches. I wonder though whether the resolution loss might be more perceptable since hearing is most sensitive between about 500Hz and 6kHz and there is more resolution loss in this range than with the 75us pole. Vinyl S/N with analog eq is rather low below 200Hz anyway.
 
I realized after reading a bit closer, that the bilinear transform was not being suggested. I concur that this would not be a good choice unless the sample rate is very high.

I don't see an advantage to a digital implemention for precisely the dynamic range issues presented in the last post.

A fixed point direct form I is probably superior to a 32 bit float (DF II transpose would probably be a reasonable choice).

As an engineer, I think its fun to play with ideas. I am not convinced that a digital RIAA is the best approach. If one considers a digital approach, there are implementation details that will affect the final performance. Of course, the same is true of any analog solution as well.

I thought a lot about RIAA preamps in my youth. At one time, I could listen to a phono preamp and draw the basic circuit topology from what I was hearing with reasonable accuracy. I have probably built most of the circuit topologies. I invented (or perhaps reinvented) the split passive phono preamplifier. I have a patent on this idea. It was the basis for the Van Alstine Model One (and the unreleased and much better, Model Seven).

I even revisited phono preamp design a few years ago. The idea was to see if I could design a phono preamp that was good by comtemporary standards. I never actually went past a paper design. I don't even have a turntable anymore so I am not really in a position to judge. I might have had a "golden" ear 25 years ago since this is mostly a matter of training. I certainly can't claim this skill at present.

Moving back on topic, I do think that any digital implementation is going to need a very good ADC and a good filter implementation to achieve reaonable results. It would be fun to try this approach.
My current company specializes in embedded DSP using Analog Devices SHARC DSPs. We are working on a number of high performance digital audio modules. One of these modules is intended for high perfomance crossovers. I might implement a digital RIAA filter with one of these boards later this year just to observe the result. The ADC is an AKM AK5394 which in my view, is the best the semiconductor industry has to offer.

Al Clark
 
Yes, the ADC (and DAC) needs to be good enough ... onboard AC'97/HDA is not good enough (and those are quite noisy systems too). As for an example, I have M-Audio AP 192 here and I have tried w/ general Soundblaster Audigy 2 card. Quality difference between these two is clear but even the consumer card Audigy does give really good results when set to 96kHz (for Audigy, 96kHz is the max SR for recording and 24-bit mode is not well implemented (gives ~same dynanic range than 16-bit does) in SB cards (excl. 'original' X-Fi serie cards)). Also is the pre-amp a must before soundcard (I have compared connection w/ and w/o pre-amp and the results differs quite noticeable).

I'm using 32-bit (double) math, 17 decimal coefficients in my 3rd-4th order filter implementation (! not the one I have given out here).
I have also compared the decimal accuracy effect graphically a bit (17 decimals against 7 - 2 decimals @ 44.1kHz w/ biquad filter) -->

http://img134.imageshack.us/img134/4356/dectestxv4.png


FYI, here are biquad coefficients for 96kHz filter:

biquad~
1.0
-0.85353309999999993
-0.11045951130062
-1.8666083
0.86703828725601995

which should be accurate as:

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

NOTE: these are a bit gained (~12.5dB) ... to get the EQ curve cross the 0dB line @ 1kHz, just divide those three first coefficients with ~5.85. by lowering the gain the harmonic distortion gets lower.

You need the Max/MSP (Trial version goes too) software to get those original coefficients swapped w/ these ones (modify the 48kHz filter given earlier: see picture below). You can also save the modified filter as new one if you like to.

48kHz Filter construction:

http://img231.imageshack.us/img231/6205/riaapatnn8.png

(in Max/MSP's Edit mode, just move those objects by dragging w/ mouse)


BTW, are there some software available which I could use for to measure these Filters more (now I can only measure some data for 44.1kHz Filter (magnitude, harmonic distortion, phase, group delay, power, etc.))?

jiitee
 
... as an addon ...

If you like to try these filters in VST plugiin format then it's quite easy to be done using Synth Maker. There is a SM demo available you can use:

http://www.synthmaker.co.uk/

After installing and starting SM, close the demo project opened automatically, start a new project and 1st press the "developer" button in SM main screen -> you'll get all available component groups into use.
Select the Module component under Elements group ... doubleclick it to open another 'window', active it and add those needed data/objects listed below.

Either built this type schematic:

http://img48.imageshack.us/img48/2231/smriaafilterna4.png

(Filter group: biquad filter objects, Element group: float data objects and Module Input/Output objects )

or use SM's "Code" element w/ code something like this

Code:
// 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; // never needed
a1=-1.73276550000000020;
a2= 0.73455344362250008;
b0= 1.00000000000000000;
b1=-0.75555209999999995;
b2=-0.16462571129709999;

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

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

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

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


(Other group: Code object and Element group: Module Input/Output objects)

Remember add those Left/Right Input/Output 'pins' (Element group: ...) as in schematic.
If you like to prepare a standalone Filter then just add ASIO I/O (External group: ASIO In, ASIO Out) elements and make needed connections for those (in Top 'window').

Remember also to change coefficients for 44.1/96 kHz filters (you'll get the 44.1kHz coeffs from the filter I linked in my 1st post)

Complile to a VST or EXE by selecting the target type in Module object ("Top" window) by selecting the Module object and then pressing the VST or EXE choice showing there.

For VST plugin, as a simple VST Host you can use Hermann Seib's VSTHost or SAVIHost. Both can be found @ http://www.hermannseib.com/english/default.htm

SAVIHost -> copy the savihost.exe into same folder the plugin .dll is placed then just rename the savihost.exe to your_vst_plugin.exe (as like if you did save the filter VST plugin as Filter.dll -> rename the savihost.exe to Filter.exe) ....

VSTHost -> load the plugin through File->New PlugIn... (you can add multiple plugins as well but read the manual first ...)

In both software, set the Devices->Wave device to ASIO, select Devices->ASIO I/O Channels and start the engine (Engine->Run). ou can use MME or Asio4All if you don't have ASIO capable audio system there (remember disable monitoring while recording in this case you can't use native ASIO).

- http://www.asio4all.com

jiitee
 
I am very interested in Remez's second algorithm as referenced by Robert Orban. The results of this method are very impressive.

I was wondering if anyone knows of a C program, Matlab program or a good tutorial article on this method.

I was playing around earlier today with generating coefficients at 48kHz. I used a combination of bilinear transform and impulse invariant.

The basic idea is to start with just the 318us & 3180 uS shelf. These will convert almost perfectly using BLT.

This leaves the 75uS filter. I used impulse invariant as a starting place. This would typically be of the form:

H(z) = (b1+b2z-1)/(1-az-1) where b1 is 1 and b2 = 0. If you use this filter the response will not roll off fast enough due to aliasing.

The BLT would also be in this form where b1 = 1 and b2 = 1.

The BLT has a zero at PI (24kHZ in my example), The II has a zero at the origin.

If you look at the a term, it will be very close to the same when the sample rate is relatively large as compared to the corner freq.

The trick is to make the b2 something between 0 and 1. This causes a real zero to be placed between the unit circle at PI and the origin. I tried b2 = .12, .15 & .2. The .15 choice was fairly good.

You can combine the 318/3180 shelf and the 75uS filter to make a composite 2nd order biquad if you like.

If you use a combo digital - analog filter where the analog filter does the 75uS corner, the digital filter will be nearly perfect.

Here is the 75uS filter that I calculated:

H(z) = (1-.7574651)/(1+1.15) * ( 1+ .15z-1)/(1-.7574651z-1).


The .7574651 = exp(-1/(48000*75e-06))

If anyone cares, I will calculate the detailed 318/3180 portion and attach pictures of the overall results.

I'm not claiming that my results are better than the Orban method, just a lot easier to get to. I would really like to have a version of the Orbin program for some other filter projects.

Al Clark
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.