<p>You can also reduce DC offset by applying a band filter to the signal, which will reduce the effects of DC offset in the spectrogram. Applications like <a href="https://ravensoundsoftware.com/" rel="noreferrer">Raven Lite</a> and <a href="https://www.audacityteam.org/" rel="noreferrer">Audacity</a> make this approach easy.</p>
<p>In Raven Lite you select &quot;Edit &gt; Band Filter &gt; Filter All With&quot; from the menu, then select Bandstop with Lower Limit 0 Hz and Upper Limit of 1 Hz. In Audacity select &quot;Effect &gt; High Pass&quot; from the menu, then type in a Frequency of 1 Hz.</p>

CC BY-SA 4.0
2022-07-01T20:55:25.243Z
2022-07-01T20:55:25.243Z
Michael Pitzrick
<p>Removing the DC component in the frequency domain is not trivial, and generally not recommended. Although ideally all the DC content should be at the 0-th bin of your Discrete Fourier Transform, in practice the DC content tends to &quot;leak&quot; to nearby bins due to <a href="https://en.wikipedia.org/wiki/Spectral_leakage" rel="nofollow noreferrer">spectral leakage</a>. The amount of leakage will depend on a bunch of factors such as the magnitude of your DC component, DFT size, amount of zero-padding, and chosen windowing function. This leakage may interfere with the estimation of your nearby lower frequencies, which may or may not be a significant problem for your signal analysis.</p>
<p>In general, it is more efficient, more controllable and more reproducible to perform a DC removal in the time domain, as you described in your question, or even a linear trend removal. Some packages/languages already contain pre-built functions to perform this task, such as <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.detrend.html" rel="nofollow noreferrer">SciPy/Python</a>. Another option is to high-pass filter your signal at a very low frequency, e.g. 1 Hz or lower, as suggested in other answers.</p>
<p>See <a href="https://holometer.fnal.gov/GH_FFT.pdf" rel="nofollow noreferrer">here</a> (chapter 11) for more details on this issue.</p>

CC BY-SA 4.0
2022-07-04T11:02:24.007Z
2022-07-04T11:02:24.007Z
fabio_hirono
<p>If you work with R and you can remove it with the function rmoffset() from seewave package.</p>

CC BY-SA 4.0
2022-07-04T07:35:13.177Z
2022-07-04T07:35:13.177Z
Amandine Gasc
<p>Simply put the zero'th frequency bin to zero.</p>

CC BY-SA 4.0
2022-07-01T14:53:17.423Z
2022-07-01T14:53:17.423Z
WMXZ
<p>Depending on how you're converting to the spectral domain, this may happen automatically.  Many transformation algorithms either implicitly or explicitly drop the zero-frequency component of the signal during the conversion process.</p>

CC BY-SA 4.0
2022-07-01T21:01:00.933Z
2022-07-01T21:01:00.933Z
Mark
<p>You may not need to. The DC offset should show up only in a single bin of the FFT, namely the one corresponding to 0 Hz, which is (usually) the very first element of the vector output by an FFT function. As WMXZ suggests, you can zero it out.</p>
<p>In a horizontally-displayed spectrogram, this bin is the bottom edge - the bottom row - of the spectrogram. If you ignore that row, or adjust your display so that you don't even see that row, you shouldn't have to worry about it.</p>

CC BY-SA 4.0
2022-07-02T01:55:03.107Z
just to add if your desired signal contains near-dc frequencies & you may wish to preserve them. if so consider zero padding (and correct window) the end of your sample set if required to sufficiently shrink your bin resolution prior to nulling the zero bin.
antimony
CC BY-SA 4.0
2022-07-01T23:42:42.330Z
2022-07-01T23:42:42.330Z
Dave Mellinger
<p>I have audio recordings with a consistent DC offset, which I would like to correct. I know that in the time domain, I can subtract the mean of the entire signal from the original signal</p>
<p>(<strong>Data_without_dc_offset = Data_with_dc_offset - mean(Data_with_dc_offset)</strong>)</p>
<p>to remove the DC offset, but I am uncertain how to do this in the spectral domain (e.g. removing the DC offset from FFT data). How do I do this?</p>

<analysis><spectral>
How to remove DC offset from my audio recordings in spectral domain?
# How to remove DC offset from my audio recordings in spectral domain?

(Asked by: username_0 on 2022-07-01)

I have audio recordings with a consistent DC offset, which I would like to correct. I know that in the time domain, I can subtract the mean of the entire signal from the original signal

(**Data\_without\_dc\_offset = Data\_with\_dc\_offset - mean(Data\_with\_dc\_offset)**)

to remove the DC offset, but I am uncertain how to do this in the spectral domain (e.g. removing the DC offset from FFT data). How do I do this?

**Tags:** analysis, spectral


---

## 6 answers

### Answer by username_6 on 2022-07-01. Score: 10 | Accepted answer

You may not need to. The DC offset should show up only in a single bin of the FFT, namely the one corresponding to 0 Hz, which is (usually) the very first element of the vector output by an FFT function. As username_4 suggests, you can zero it out.

In a horizontally-displayed spectrogram, this bin is the bottom edge - the bottom row - of the spectrogram. If you ignore that row, or adjust your display so that you don't even see that row, you shouldn't have to worry about it.

> **Comments:**
> **username_7**: just to add if your desired signal contains near-dc frequencies & you may wish to preserve them. if so consider zero padding (and correct window) the end of your sample set if required to sufficiently shrink your bin resolution prior to nulling the zero bin.  

---

### Answer by username_1 on 2022-07-01. Score: 6

You can also reduce DC offset by applying a band filter to the signal, which will reduce the effects of DC offset in the spectrogram. Applications like [Raven Lite](https://ravensoundsoftware.com/) and [Audacity](https://www.audacityteam.org/) make this approach easy.

In Raven Lite you select "Edit > Band Filter > Filter All With" from the menu, then select Bandstop with Lower Limit 0 Hz and Upper Limit of 1 Hz. In Audacity select "Effect > High Pass" from the menu, then type in a Frequency of 1 Hz.


---

### Answer by username_2 on 2022-07-04. Score: 3

Removing the DC component in the frequency domain is not trivial, and generally not recommended. Although ideally all the DC content should be at the 0-th bin of your Discrete Fourier Transform, in practice the DC content tends to "leak" to nearby bins due to [spectral leakage](https://en.wikipedia.org/wiki/Spectral_leakage). The amount of leakage will depend on a bunch of factors such as the magnitude of your DC component, DFT size, amount of zero-padding, and chosen windowing function. This leakage may interfere with the estimation of your nearby lower frequencies, which may or may not be a significant problem for your signal analysis.

In general, it is more efficient, more controllable and more reproducible to perform a DC removal in the time domain, as you described in your question, or even a linear trend removal. Some packages/languages already contain pre-built functions to perform this task, such as [SciPy/Python](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.detrend.html). Another option is to high-pass filter your signal at a very low frequency, e.g. 1 Hz or lower, as suggested in other answers.

See [here](https://holometer.fnal.gov/GH_FFT.pdf) (chapter 11) for more details on this issue.


---

### Answer by username_3 on 2022-07-04. Score: 2

If you work with R and you can remove it with the function rmoffset() from seewave package.


---

### Answer by username_4 on 2022-07-01. Score: 1

Simply put the zero'th frequency bin to zero.


---

### Answer by username_5 on 2022-07-01. Score: 1

Depending on how you're converting to the spectral domain, this may happen automatically. Many transformation algorithms either implicitly or explicitly drop the zero-frequency component of the signal during the conversion process.


---

