can't get rid of dc offeset on wav file.

I am using Audacity 2.2.1

I have used normalize, which looks like it does a good job, except
the silence portion has a dc offset.

It looks like a bug in the normalize plugin.

Is there any way to remove the dc offset without distorting
the audio waveform?

I am attaching the wav to this post.

DC Removal is not perfect. It only works on natural sounds which naturally settle at “zero” DC. Any DC Offset in this case is generally caused by a broken microphone or preamp.

That’s not a natural sound. That’s a data construction with no nature at all.

You can get rid of it the “classic” way by lopping off the low frequencies. Effect > Equalization: Low Rolloff for Speech works, but you are warned that this process causes distortion of its own which is why Normalize doesn’t do it this way.

You can also use Effect > High Pass Filter, 20Hz, 24dB.

Same thing. It causes distortion.


You may also find a manufacturing shortcut.

Nobody is interested in paying for a perfect alarm-clock sound when thumping and non eee-eee sounds in the tone generator will never make it past the tiny clock speaker.

You have what happens when you carefully lift that sound into a formal sound system where those distortions suddenly matter.


Offset correction can be a compromise. In this situation I’d go with Koz’s high-pass filter technique.

Your original waveform is asymmetrical, but there is no true DC offset. True DC offset will show-up during silence. Mathematically, the wave is more negative than positive, so you could say there’s an overall negative bias or negative offset.

Is there any way to remove the dc offset without distorting
the audio waveform?

Either way you shouldn’t be hearing any distortion… But, whenever you change the wave shape, that’s “distortion”. You can’t hear DC, but you can (sometimes) hear a click when you start playing the file and the DC offset kicks-in and another click at the end of the file when the DC offset cuts-off.

The supplied sample sound file has a very serious DC offset but a more-or-less simple sound wave. I’m betting this sound file started out life with 100% DC offset and in its native state goes between ground and 5 volts. This is the problem with forum diagnostics following a poster’s failed corrections instead of looking at the original, uncorrected work.

I’m betting the original work was something like this (scroll down).
Screen Shot 2017-12-29 at 19.03.34.png

It isn’t a bug.
DC offset correction looks at the average level across the entire selection. For “normal” audio, the positive going waveform will be exactly balanced by the negative going waveform.
In your sample, the negative going waveform exceeds the positive going waveform, giving an average level that is negative, That negative average is the “DC offset”.
DC offset correction applies an equal and opposite bias to the entire selection, so that the average is zero.

What you are wanting to do is to apply DC offset correction to the "peep"s while ignoring the flat (silence) in between two "peep"s.
The obvious, though arduous, way to do that, is to manually select each of the peeps and apply DC offset correction to each of the peep’s (one at a time).

Fortunately there is a shortcut which works almost as well:
Apply the Equalization effect, with the “Low roll-off for speech” preset and the “Length of filter” set to maximum.
This works because “DC” is essentially a frequency of “zero Hz”, and the Equalization settings described will very strongly reduce frequencies below 60 Hz. The "peep"s have very little content below 800 Hz, so are virtually unaffected.

The Equalization effect is better in this case than the High Pass filter because the Equalization effect has linear phase response, meaning that it has little effect on the shape of the waveform of the "peep"s.

If this was a waveform that you generated programmatically, the better solution would be to fix the program so that it doesn’t produce DC offset.

While not a perfect copy, this code run in the Nyquist Prompt effect ( gives a pretty close simulation (with no DC offset):

(mult 0.3 (sum 1 (osc-pulse 1.86 0.24))
  (osc (hz-to-step 830) 1 *saw-table*)
  (sum -1 (mult 0.2 (osc (hz-to-step 80) 1 *saw-table*))))