27 June 2008

The art of the flat balanced digital phono preamp

This is a brief overview of the work I've done with recording vinyl directly to a computer, with balanced cabling, without the use of RIAA equalization. Sorry, no pictures.


The Problem


Somewhere in my audio pursuits, I wound up desiring access to a flat-eq phono preamp - one that didn't have any RIAA equalization applied. I also wanted balanced inputs and an integrated ADC, so that the signal path would go straight to the computer. (My audio stuff is very close to my computer stuff, so issues like ground hum and EM interference are pretty important to me.) Such things don't seem to exist in the audiophile world. The closest tailor-made solution is EnhancedAudio's flat preamp system, which is not balanced, and perhaps, not audiophile enough.

The Solution

But enter Pure Vinyl. Although it's Mac only, it has full support for flat transfers (and in fact recommends them), and goes into great detail on how to actually accomplish it.

In summary: a phono preamp without RIAA equalization is really just a fancy way of describing a microphone preamp. The gains for a phono preamp are about the same as for a mic preamp, 40-70db. The load impedances for most mic preamps are in a reasonable range (1.5kohm) to load an MC with, although to be honest, I've never cared much for the finer points of MC loading (but that is for a separate post). So about a year ago I bought an E-MU 0404 USB, which is widely praised in some circles for its high quality microphone inputs, and I got started.

Pros
  • Mic preamps tend to be much more sanely valued than phono preamps. Even major tweak territory is not going to run you more than a thousand dollars a channel (compared to perhaps 5k/channel for a phono stage).
  • Mic preamps can obviously perform double duty as, well, mic preamps. This may help their resale value.
  • External computer audio interfaces tend to be a) very inexpensively priced, b) ridiculously packed with features, and c) very high quality. There are many extremely good interfaces in the <$500 price range worthy of consideration. Many also have high quality analog/digital outs, headphone outs, etc.
  • When used with balanced connections, a virtually noise-free signal path is guaranteed.
  • If the mic preamp has accurate low-frequency response or is DC coupled, very accurate rumble measurements can be derived. This is extremely useful for several technical measurements.
Cons
  • Software support for flat recordings is virtually nonexistent, with the notable exceptions of Pure Vinyl and DC Six. I've pretty much written my own software for this.
  • MC gains may test the upper limits of mic preamp performance.
  • May not be compatible with MM cartridges, depending on configuration.
  • Because of the scarcity of users of this scheme, many unforseen issues may develop (see below).
  • Per-channel mic gain control prevents completely accurate level matching. (But level matching was never that good on vinyl to begin with.)
  • Phantom power on XLR cabling may damage turntable gear if improperly wired.
  • XLR/TRS turntable wiring doesn't exist. Even balanced wiring in the form of 5-pin DIN is hard to find, and requires special cabling to terminate to XLR/TRS.
  • There are theoretical objections to flat-eq recordings on the basis of reduced dynamic range at some frequencies and a greater risk of overload in others. Rob Robinson of Pure Vinyl has argued convincingly that this should not be an issue.

Software Implementation

Software equalization was accomplished with a naive implementation of an RIAA filter as a prewarped bilinear transformed IIR filter, in LabVIEW. At 44khz the response isn't great (it's several db off at 20khz). I spent some time trying to make a better filter, but was mostly rebuffed. LabVIEW's facilities for optimizing FIR filters were not able to get to within +-0.1db across the audio band without fairly long lengths. Regardless, it sounds pretty good as is.

I've been informed of a technique by Robert Orban to use Remez optimization on IIR filters to make an extremely accurate filter. I'll probably do this in the future.

http://www.dsprelated.com/showmessage/73300/3.php

For rumble, I use two Butterworth highpass filters operating on the L+R and L-R signals. L+R is order 6 at 25hz; L-R is order 8 at 35hz. These numbers were evaluated a long time ago observing spectral content of blank grooves on HFNRR - the lateral and vertical content of the rumble is largely different. Of course, the exact nature of the rumble varies from record to record.

It's worth noting that Pure Vinyl has its own very high quality filters that would moot all this work had I be using a Mac. In particular, the rumble filter is phase-distortion-free.

Hardware Implementation #1

I didn't have a low impedance MC cartridge the first time around, merely an AT440ML, and I didn't want to rewire the turntable I had at the time, so I built an adapter box to convert RCA to XLR and add 47kohm of resistance. (I added capacitance too but there is likely enough capacitance in the entire circuit to make that unnecessary.)

This sorta worked, but the frequency response was completely off. After reading the 0404 USB docs between the lines, I determined that the XLR inputs were constantly loaded at 1.5kohms - completely unsuitable for MM use - but the TRS inputs were at 1Mohm. So I replaced the plugs with TRS and went on my way.

The resulting recordings sounded acceptable, but there were major EM interference issues. 60hz ground harmonics were severe, and oddly, peaked quite strongly at high frequencyes (15khz), which wound up being audible. I chalked this up to three issues:

  • the resistance/connector adapter box I built was fairly ramshackle.
  • The turntable wiring itself was not great.
  • The AT440ML (and apparantly most MM cartridges) wire one of the signal return pins to its ground. This may cause more issues than it fixes in this particular configuration.

Hardware Implementation #2

So I scored a Technics SL-1200MK2 over Christmas, and an Audio Technica OC9MLII a few months ago. I also procured a balanced audio cable from Blue Jeans cable - about 3 meters of Belden 1800F terminated with Neutrik TRS. I cut the cable in two and replaced the external wiring on the 1200 with the 1800F (causing some pretty severe damage to the 1200's cabling circuit board in the process).

Everything worked great, except for one glaring problem: noise. The SNR was way, way too low. In fact, what had happened was that the 60db of gain on the 0404 counted against its SNR, resulting in roughly 50db of SNR before equalization. This is apparantly 40db (or more!) worse than it should be.

The built-in gain on the XLR inputs was a smidge better, and the load impedance is compatible with the cartridge, so I was able to buy a few more db by rewiring back to XLR. But longer term the only surefire solution is to get a better preamp. One of the bigger potential drawbacks to XLR is that phantom power (+48V to the turntable ground!) is only a push button away, but after deliberately pressing this and not seeing any ill effect beyond lots of noise while it's enabled, it should not be a concern as long as the cables are properly wired.

Recording process

Recording is currently done in the version of Cubase LE that came with the 0404. The 0404 USB has major driver issues and consumes 50% of the CPU time, on a 3ghz P4, while playing back or recording audio. Overrun susceptibility is also quite high, and it's virtually unusable on my Dell laptop (although that may be more of an issue with the network drivers than the card). So most of the time no other interrupt-intensive work can be done while the recording is in progress.

After the recording is over I run RIAA eq and derumble in LabVIEW. Then I open the wavs up in Audacity and manually remove the loudest pops, normalize, trim the edges and export to 16/44 lossless. Tagging and transcoding is done in foobar2000.

The 0404 USB (and most 2-channel mic preamps for that matter) have separate gain pots for each channel, resulting in a fairly obvious level imbalance. This can be calibrated away somewhat by using a test record, but my de-rumble utility also estimates L/R energy content in db, which I can then use to amplify one channel over the other in Audacity.

Future Plans
  • The 0404 USB really has to go.
  • I would prefer some more specific tool for recording the audio over ASIO. A LabVIEW interface to PortAudio would arguably be most powerful, and would most easily let me do online monitoring, but short of that, a commad line recorder would be great.
  • If a preamp can be obtained that has acceptable gain with Hi-Z inputs, then I could craft in-line load resistance correction for MM cartridges over the XLR pins. That would cleanly solve MM loading issues.
  • Develop an accurate real-time high speed meter capability, to read test band levels off in real time, to aid in adjusting mic gains.
  • Grab a hold of (or write) some A-weighting filter routines to compare SNR ratios with.
  • Streamline the recording and processing chain. Pop/tick removal, normalization and trimming can in large degree be made automatic. Those steps take up perhaps 10-30 minutes per record and speeding those up would make large-scale recording much faster.
  • Of course, I could just buy a Mac and Pure Vinyl and forget about this, or (Goddess forbid) buy an MC phono stage, but what's the fun in that?

Thanks to Rob Robinson at Pure Vinyl for pointing me to this technique and overall guidance.

UPDATE 1: recording sample.

UPDATE 2: "Trouble In Vinyl-dise", Or, "How does Dell Manage To Sell Such Cheap Computers? Film At 11".

Some notes on pfpf

It's been quite a while since the first update, and I didn't mean this to be a one shot deal, so I might as will give a status update on pfpf. I haven't had the opportunity to work on a new version, but plenty of comments have been made so far:

On Missing Files. First, my hosting provider, storing my screenshots and files, disappeared without any contact information. I just got a new one set up, so all the links work again.

On Download Sizes. Lots of people don't like the 90MB LabVIEW Runtime download, or that registration is required on NI's website to download. I can't get rid of the runtime download entirely, but there is a smaller (28MB) runtime that may work for you - download here.

On Magnitudes. Several people commented that the dynamic range figures seemed too low. A well-mastered pop track may only show up as having only 3-4db of dynamic range on short/medium time scales, and virtually no range on long time scales. Extremely dynamic symphonic works may only have 16db of dynamic range, where by most "normal" evaluations, there should be more like 40-60db. While the choice of scaling has little effect on comparison of pfpf-derived numbers, it has a great effect on their overall interpretation in relation to other decibel figures

Much of this stems from the choice of percentiles used in the variance measurement (from the 50th to the 98th). If this range were to be doubled, the numbers would probably fall more into line with what people normally expect. This could be accomplished by either doubling the 50-97.7 figure.

On Dynamic Range Manipulation. Michael Jamsmith and I independently came up with the idea of running pfpf's histogram plot in reverse to make a Photoshop-like levels adjustment for loudness on a music track. In other words, a reversible 2-pass dynamic range compressor. Certainly something to work on in my copious free time :)

On Resolutions. One persom didn't like that a greater than 1024x768 resolution is required. I'll see what I can do to make the resolution requirements nicer, but I can't promise much. I might just require that people use a 1680x1050 or higher display.

Bob Katz's comments.

An Alternative Proposal - the Sparklemeter. Chromatix on HA has recently proposed measuring dynamic range by comparing the ratio between a PPM and a VU meter (suitably modified), preparing a histogram of the result values, and computing a figure of merit based on the mean and variance of that histogram. The resulting functionality is similar to the medium- and short-timescale figures that pfpf outputs, but the use of exponential-decay meters is new, as is using direct percentile values from the histogram rather than ranges between percentiles. Using VU/PPM meters gives the result great intuitive meaning for audio engineers, although I fear the required modifications may compromise that. Watch that thread.