All About DC OffsetDC Offset: Case of the Missing Headroom
It was a dark and stormy night. I was rudely awakened at 3 AM by the ringing of a phone, pounding my brain like a jackhammer that spent way too much time chowing down at Starbucks. The voice on the other end was Pinky the engineer, and he sounded as panicked as a banana slug in a salt mine. "Anderton, some headroom's missing. Vanished. I can't master one track as hot as the others on the Kiss of Death CD. Checked out the usual suspects, but they're all clean. You gotta help."
Like an escort service at a Las Vegas trade show, my brain went into overdrive. Pinky knew his stuff...how to gain-stage, when not to compress, how to master. If headroom was stolen right out from under his nose, it had to be someone stealthy. Someone you didn't notice unless you had your waveform Y-axis magnification up. Someone like...DC Offset.
Okay, so despite my best efforts to add a little interest, DC offset isn't a particularly sexy topic. But it can be the culprit behind problems such as lowered headroom, mastering oddities, pops and clicks, effects that don't process properly, and other gremlins.
DC Offset in the Analog Era
We'll jump into the DC offset story during the 70s, when op amps became popular. These analog integrated circuits pack a tremendous amount of gain in a small, inexpensive package with (typically) two inputs and one output. Theoretically, in its quiescent state (no input signal), the ins and out are at exactly 0.00000 volts. But due to imperfections within the op amp itself, sometimes there can be several millivolts of DC present at one of the inputs.
Normally this wouldn't matter, but if the op amp is providing a gain of 1000 (60dB), a typical 5 mV input offset signal would get amplified up to 5000mV (5 volts). If the offset appeared at the inverting (out of phase) input, then the output would have a DC offset of –5.0 volts. A 5mV offset at the non-inverting input would cause a +5.0 DC offset.
There are two main reasons why this is a problem.
- Reduced dynamic range and headroom. An op amp's power supply isbipolar (i.e., there are positive and negative supply voltages with respect to ground). Suppose the op amp's maximum undistorted voltage swing is ±15V. If the output is already sitting at, say, +5V, the maximum voltage swing is now +10/-20V. However, as most audio signals are usually symmetrical around ground and you don't want either side to clip, the maximum voltage swing is really down to ±10V—a 33% loss of available headroom.
- Problems with DC-coupled circuits. In a DC-coupled circuit (sometimes preferred by audiophiles due to superior low frequency response), any DC gets passed along to the next stage. Suppose the op amp mentioned earlier with a +5V output offset now feeds a DC-coupled circuit with a gain of 5. That +5V offset becomes a +25V offset—definitely not acceptable!
With capacitor-coupled analog circuits, any DC offset supposedly won't pass from one stage to the next because the capacitor that couples the two stages together can pass AC but not DC. Still, any DC offset limits dynamic range in the stage in which it occurs. (However, if the coupling capacitor is leaky or otherwise defective, some DC may make it through anyway.)
There are traditionally two ways to deal with op amp offsets.
- Use premium op amps that have been laser-trimmed to provide minimum offset.
- Include a trimpot that injects a voltage equal and opposite to the inherent input offset. In other words, with no signal present, you measure the op amp output voltage while adjusting the trimpot until the voltage is exactly zero. Some op amps even provide pins for offset control so you don't have to hook directly into one of the inputs. (Note: As trimpot settings can drift over time, if you have analog gear with op amps, sometimes it's worth having a tech check for offsets and re-adjust the trimpot setting if needed.)
Digital DC Offset
In digital-land, there are two main ways DC offset can get into a signal.
- Recording an analog signal with a DC offset into a DC-coupled system
- More commonly, inaccuracies in the A/D converter or conversion subsystem that produce a slight output offset voltage. As with analog circuits, a processor that provides lots of gain (like a distortion plug-in) can turn a small amount of offset into something major.
In either case, offset appears as a signal baseline that doesn't match up with the "true" 0 volt baseline (Fig. 1).
Fig. 1: With these two drum hits, the first one has a significant amount of DC offset. The second has been corrected to get rid of DC offset, and as more headroom is available, it can now be normalized for more level if desired.
Fig. 2: The top signal is the original normalized version, while the lower one has been processed by a steep low-cut filter at 20Hz, then re-normalized. Note how the level for the lower waveform is much "hotter."
Fig. 3. Like many programs, Sonar 5's audio processing includes the option to remove DC offset from audio clips.
Digital technology has also brought about a new type of offset issue that's technically more of a subsonic problem than "genuine" DC offset, but nonetheless causes some of the same negative effects. As one example, once I transposed a sliding oscillator tone so far down it added what looked like a slowly-varying DC offset to the signal, which drastically limited the headroom (Fig. 2).
In addition to reduced headroom, there are two other major problems associated with DC offset in digitally-based systems.
- When transitioning between two pieces of digital audio, one with an offset and one without (or with a different amount of offset), there will be a pop or click at the transition point.
- Effects or processes requiring a signal that's symmetrical about ground will not work as effectively. For example, a distortion plug-in that clips positive and negative peaks will clip them unevenly if there's a DC offset. More seriously, a noise gate or "strip silence" function will need a higher (or lower) threshold than normal in order to be higher than not just the noise, but the noise plus the offset value.
There are three main ways to solve DC offset problems with software-based digital audio editing programs.
- Most pro-level digital audio editing software includes a DC offset correction function, generally found under a "processing" menu along with functions like change gain, reverse, flip phase, etc. This function analyzes the signal, and adds or subtracts the required amount of correction to make sure that 0 really is 0. Many sequencing programs also include DC offset correction as part of a set of editing options (Fig. 3).
- Apply a steep high-pass filter that cuts off everything below 20Hz or so. (Even with a comparatively gentle 12dB/octave filter, a signal at 0.5Hz will still be down more than 60dB). In practice, it's not a bad idea anyway to nuke the subsonic part of the spectrum, as some processing can interact with a signal to produce modulation in the below 20Hz zone. Your speakers can't reproduce signals this low and they just use up bandwidth, so nuke 'em.
- Select a 2—10 millisecond or so region at the beginning and end of the file or segment with the offset, and apply a fadein and fadeout. This will create an envelope that starts and ends at 0, respectively. It won't get rid of the DC offset component within the file (so you still have the restricted headroom problem), but at least you won't hear a pop at transitions.
Granted, DC offset usually isn't a killer problem, like a hard disk crash. In fact, usually there's not enough to worry about. But every now and then, DC offset will rear its ugly head in a way that you do notice. And now, you know what to do about it.
Originally published on Harmony Central. Reprinted with permission.