DC offset

From Audacity Wiki
Jump to: navigation, search
DC offset is a mean amplitude displacement from zero. In Audacity it can be seen as an offset of the recorded waveform away from the center zero point. DC offset is a potential source of clicks, distortion and loss of audio volume.
This page explains the causes and dangers of offset and how to remove it. Ideally any DC offset that is present should be removed as the first editing step after recording audio or importing it, before any other editing is attempted.
Related article(s):



DC offset is an offsetting of a signal from zero. On the Audacity waveform it would mean that the waveform in default view appears not to be centered on the 0.0 horizontal line, as in the upper track in this image:

Left and right channels of a recording where the upper (left) channel displays noticeable DC offset

The cause is almost always a fixed voltage offset somewhere in the audio chain before the analog signal is converted to digital values. For example, the voltage may be directly caused by a faulty sound card, or may come from some other device that is attached to the card. Any offset is normally so small as to not be noticeable, but with defective or poor quality hardware it may become large enough to be a problem.

Warning icon You should check for and remove offset in any audio you are working with before editing it, even if the audio is not your own recording but an audio file you have obtained elsewhere.
  • A sound that has DC offset will not be at its loudest possible volume when amplified or normalized. This is because the offset reduces the headroom between the peak level of the audio and the maximum possible level without clipping. This problem can possibly extend to the mix as a whole, since a sound with DC offset and a sound without DC offset will have DC offset when mixed.
  • DC offset can cause inaudible low level distortion. The distortion may become audible when effects that change the frequency content are applied, or when exporting the audio to a size-compressed format like MP3.
  • DC offset can cause audible clicks where audio sections are cut and pasted together, and can cause a click on playback at the start and end of the track, even without editing.
  • DC offset will become worse if the recording is amplified.

Removing DC offset

Audacity's Normalize Effect

Audacity's DC removal method performs a calculation to make the average positive and negative sample values equal. To perform removal, choose Effect > Normalize..., with the option checked "Remove any DC offset (center on 0 vertically)". Uncheck the "Normalize maximum amplitude..." box unless you want to run Normalize as well (see Amplify and Normalize for what Normalize does and when to use it).

LADSPA dcRemove

An alternative method is to use dcRemove in the plugin.org.uk suite of LADPSA plug-ins for Windows, Mac or Linux. This uses an example of a High Pass Filter to remove the DC (0 Hz) component from the audio.

Cancel DC offset in sound devices on Windows

Newer Windows PCs may have a DC offset cancellation feature when recording from the built-in sound inputs. To check for or enable this:

  1. Right-click over the speaker icon in the System Tray > Recording Devices, or click Start > Control Panel > Hardware and Sound > Sound, then the "Recording" tab;
  2. Right-click over empty space, show disabled and disconnected devices, then right-click over each device and enable it;
  3. Right-click or select each device, choose "Properties" then look in the "Enhancements" tab;
  4. If there is no "Enhancements" tab, look in the sound device's own control panel in "Hardware and Sound".

Limitations of offset removal

Audacity's DC offset removal method could potentially create a new offset and therefore a click in some rare cases. Two cases are noteworthy:

* where a waveform is inherently asymmetrical, which is possible with recordings of brass instruments, violin, bass drum, some male bass voices and certain notes on woodwinds

Steve: 31Oct12 I have heard many rumours that asymmetric waveforms can produce DC offset when "corrected", but no actual evidence to support that claim. I think it is a myth and without evidence to the contrary we should not perpetuate this belief. I think that it is worth mentioning asymmetric waveforms somewhere (I'm not sure where yet) as this is a common point of confusion re. DC offset.

Gale: 31Oct12 From my trawl to find the "asymmetrical" link I added, the idea that DC offset exists in asymmetric brass waveforms and should be corrected therein is commonplace. Do you agree with that, to begin with? Wherever else we mention asymmetric waveforms I think we must do so here, if only to debunk any myths.

But...I find I have six complaints in my inbox about Audacity's DC offset removal creating clicks in brass and wind recordings. They were sent to me personally, not to mailing lists. There was no evidence by way of audio files, though two of them said dcremove fixed the offset without adding clicks. I've written to these people again today, hopefully someone "may" respond. But where are the online complaints, on -devel or the Forum, and is there not aural evidence there? Also see this public post by yourself where you state unequivocally Audacity's offset correction can create clicks in asymmetrical waveforms. Can we not test this? You play the violin and I understand that can produce asymmetical waveforms too? I am sceptical that there is no problem here.

  • Steve: 31Oct12 What can I say, I think I was wrong. At the time I believed that was true, but have repeatedly failed to prove it, nor have I seen any compelling evidence to support it. I have seen some rare cases that appear to support the idea but are actually misleading. Asymmetric waveforms are not uncommon in real world recording, and are easy to synthesize. A high pass filter will often change the shape of a waveform due to phase shifts, and this can add to the illusion and confusion. I've posted a sample on the forum to illustrate. http://forum.audacityteam.org/viewtopic.php?p=195648#p195648
    • Gale 06Nov12: ToDo-2 We need to discuss naturally occurring offset recordings as I am sure this wants to be covered here. I asked if Steve agrees that DC offset exists in asymmetric brass waveforms. Does non-constant offset naturally exist in brass waveforms? And since these waveforms frequently "look" offset (even if they are not), does the user need to apply a DC removal tool to them (let's say your Nyquist tool, as that seems without flaw at present)? In other words, is a naturally occurring offset as dangerous as one caused by defective hardware?
  • where only part of the audio is offset, for example if absolute silence with no offset has been inserted into an offset recording.
Gale 31Oct12: Re: the below, is it confirmed with evidence that Audacity's DC offset removal can create a click in these type of waveforms? I don't think this bullet can stand as is. Why is it not "slowly changing DC offset" if "DC offset" and "DC bias" are indeed interchangeable terms? Should we not have an image of this phenomenon so users can tell the difference?
  • Steve: 31Oct12 It can be easily demonstrated that the Audacity method of DC offset correction will not perform well if the "bias" is not constant. In audio engineering, "DC offset" is usually taken to mean a constant offset. The method for correcting that is used by the Audacity Normalize effect assumes that this is the case.
  • Steve: 01Nov12 The newly updated Nyquist DC offset tool handles non-constant bias better than either the Audacity Normalize effect or the LADSPA effect.
  • where the offset is not constant. Strictly speaking this is not DC offset, it is sub-sonic modulation or "slowly changing DC bias", but over a short time period it looks very much like DC offset.

In the case where some sections of the audio are clearly offset and some not, the solution in Audacity is to first carefully select each section of non-offset audio then use Edit > Clip Boundaries > Split New to split it a new track. Then remove the offset from the remaining audio, and paste the non-offset audio back. Use Edit > Find Zero Crossings before split and paste if the non-offset audio is not absolute silence.

Gale 31Oct12: "High Pass DC removal as in LADSPA dcRemove may well remove offset without adding new clicks if the offset is not constant." Is there any doubt dcremove avoids creating clicks where only part of the audio is offset (which bit you removed)? Dcremove works for me on that test file I PM'ed to you that had non-offset silence preceding offset audio. There is a small visible "wiggle" before the audio starts, but it is inaudible as it is masked by the start of the music.
  • Steve: 31Oct12 dcremove will generally perform better than "absolute" offset removal in cases where the bias is not constant, though it may not avoid the problem of clicks. In particular it cannot correct DC offset at the very beginning of the selection and it will not remove clicks if the offset suddenly changes.

High Pass DC removal as in LADSPA dcRemove may well remove offset without adding new clicks if the offset is not constant.

Warning icon Note: Removing offset after the event does not reinstate the original loss of headroom. Without offset it would have been possible to record louder, so with greater dynamic range and greater signal-to-noise ratio. It is always preferable to try to find and fix the source of the offset in the hardware. Updating the sound device drivers might help, too.
Personal tools