Audio effects and synthesizers are noisy beasts. In addition to the music signal itself, all electric circuits add their own touch in the way of characteristic distortion and noise floor. Sometimes you can hear the distortion when you wouldn’t want to, sometimes it’s exactly what you’re looking for. And if you just amplify the signal coming from an electric device enough, you can hear the quiet background hiss even when it’s otherwise silent.
Digital algorithms share the exact same limitations, just in a slightly different form. The achievable noise floor and distortion characteristic depend on the choice of algorithm and data format, which is why we keep pushing for higher bit depths and bit rates. 24 bits is better than 16 bits, 192 kHz is better than 48 kHz, right?
Sometimes it matters
Distortion is a measure of unwanted contamination in a signal. It’s usually measured as a ratio of the amount of error in the signal versus the signal strength. For example, 1% of distortion would mean that the signal differs by one hundredth from some “undistorted” reference signal. The human ear is a very sensitive instrument, and with a little bit of practice it’s easy to hear such differences.
It’s often easier to think about audio signal levels, sound volume, and sound pressure on the logarithmic decibel scale. The ear has a dynamic range of about 120 dB, meaning that the loudest sound the ear can take is 120 dB, a million times, louder than the most quiet sound that can be heard. 1%, or 1:100, is a relative difference of 40 dB. That’s roughly the difference between the sound of a jackhammer and your TV at home.
Now, certainly some kinds of “errors” in sounds are more annoying than others. Much of the sound processing industry is built around acceptable, or even preferred forms of introduced distortions (ever heard a distorted electric guitar, by any chance?). But regardless, usually it’s a good starting point to have a clean signal with the minimum of unwanted noises.
Since engineering is what it is, you always end up trying to get the most out of your circuits, so you have to know what you’re looking at. The device intended for measuring these characteristics of a device is called a “THD analyzer”, because it measures the Total Harmonic Distortion.
The THD analyzer consists of a signal generator and a signal analyzer. The basic scheme is that the analyzer produces a measurement signal, which is fed to the device-under-test (DUT), and the output of the DUT is passed back to the analyzer. The analyzer is designed to produce certain signals with very high accuracy, and it can also identify these signals very accurately in the input to the analyzer.
The combination of a signal generator and analyzer can be used to measure how the signal is changed by the DUT. The noise floor can be found by measuring the background hiss coming from the tested device. Distortion can be found and measured by looking for additional signals produced by the DUT in frequency bands where the original signal had nothing.
The figure above shows a generated audio signal at a frequency of 440 Hz on the left, and the result of passing this signal through an external device on the right. The upper row shows the signal waveform itself, but the naked eye cannot distinguish any difference in them. With the help of some FFT analysis, the more delicate details of the signal can be visualized, and the result is plotted in the form of a spectral analysis on the bottom row. The main signal appears as a tall peak (due to how FFT works, the peak has a wide “tail” on both sides of it, called the side lobes) and in the processed signal on the right two additional peaks appear.
In this case the peaks are located at 880 Hz (2*440 Hz) and 1760 Hz (4*440 Hz), so they are the second and fourth harmonics of the 440 Hz sinusoid. A THD meter measures the total harmonic distortion, so the THD figure is a sum of the strengths of these added harmonics.
The noise floor also appears in the bottom-right figure, and it defines the available dynamic range of the DUT by covering and hiding all quieter signals under it.
Since the signal generator and signal analyzer are really one and the same device, it is possible to remove the original signal from the processed signal. The residue consists of just the added distortion and the noise floor.
So technically what the THD analyzer really does is that it filters the signal coming from the DUT to recover this residue, and measures its amount.
Since these are the limiting characteristics of any audio circuit, measuring them will give a good indication of the quality and performance of such a circuit, in addition to making any kinds of issues visible and debuggable.