The definitive MIDI controller | This is not rocket science

The plan, analog hardware design

Having discussed the purpose and construction of an audio distortion analyzer with my friend Janne, the question he posed was clear: why couldn’t you build one simply with a high-quality DAC and ADC?

The main usage I could foresee for such a tool would be to measure other codecs, and perhaps some simple analog circuits. Most of the reasonably priced audio codecs are specified with a dynamic range of some 100-110 dB, and a THD figure of about -100 dB. The analyzer would have to be quieter and more linear than that, preferably with a dynamic range and THD of at least -110 dB. Are there any such codecs available?

Even then, would the analyzer be accurate? Would it be possible to say anything about the reliability of the meter circuit without any special (very expensive) calibration tools?

THD analyzer environment diagram

The above figure shows the major parts of the setup. A probe signal is first produced by software running in the THD analyzer, converted to an analog signal, and sent to the DUT. The DUT does its job, and the analyzer section records the result. Once enough data has been collected, the software filters the recorded signal with a notch filter to cancel the original probe signal, calculates the power spectrum of the residue, and finds the distortion peaks in the power spectrum. Easy.

Since both the generated and the recorded signals are known, it is easy to estimate the frequency response of the analyzer itself with a simple loopback connection. On the other hand it’s not so simple to tell if the amplitude of the generated signal is correct, but it can be calibrated to a sufficiently high accuracy even with just a cheap oscilloscope or multimeter. As a bonus it’s relatively easy to measure the total delay of the signal through the full signal chain, and also here the analyzer’s inherent delays can be measured with the loopback. Many audio codecs can run at 192 kHz sampling rates, which would allow measuring even high (audio) frequency distortion.

I’m only interested in measuring low-voltage electric circuits, not power amplifiers, so the codecs must be interfaced with analog circuits on the normal line levels. The analyzer hardware itself turns out to be just a simple audio interface without many thrills. But with which codecs?

The major high-end codec manufacturers are Analog, Cirrus Logic, AKM, and Texas Instruments, and after comparing their offerings two chips stood out.

Burr-Brown’s PCM1792A boasts an insane -132 dB dynamic range and THD+N of 0.0004%. Analog’s AD1955 was another option, but the PCM1792 datasheet has a nice-looking schematic for the output line amplifier.

The ADC would have to be either AK5388AEQ, which is a very high quality 4-channel ADC, or PCM4220 with a slightly lower spec. The AKM chip looked much more interesting, as it also came with nice schematics (that turned out to have errors in them) and the whole idea of using a 4-channel ADC to sample a mono input seemed sufficiently overkill to me.

Wait, what was that about feeding one input channel to a 4-channel ADC?

Multichannel codecs

Since the DAC has two channels, these can drive the positive and negative lines of a balanced audio interconnect separately, doubling the maximum output voltage. Theoretically this also gives an easy way to double the dynamic range of the output. Each DAC channel is also balanced to maximize the dynamic range of the codec, but it seems that the best use for these is to drive a preamplifier.

The ADC circuit is only slightly different, but since the input amplifier is actually reducing the input signal level (from +-13V!) to a range the codec can work with, it is possible that the preamplifier opamps may contribute significant amounts of noise. To avoid this, two sets of opamps are placed in parallel. The noise from the opamps will be uncorrelated, which can be exploited to increase the dynamic range theoretically by -3 dB. The opamps on the positive and negative sides of the balanced interconnect also mix the same way, reducing the noise floor by another -3 dB. To make use of the 4 ADC input channels, the output of each opamp pair is fed to two channels, allowing the software to sum the inputs to reduce the codec’s noise floor (if it’s uncorrelated between the channels) by -3 dB. This looks too good to be true; it can’t be this easy.

In principle an unbalanced output can be produced by sending a zero signal on the negative output. And the input should be able to deal with unbalanced inputs too, as the negative side will just be grounded. Well, that may not work so well due to many reasons, but balanced lines are good enough to start with.

The software is trivial.

Let’s build it!

Leave a Reply

Your email address will not be published. Required fields are marked *