Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: DC removal approaches (Read 7353 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

DC removal approaches

Hello, since i played with de-emphasis i stumbled upon a New Age cd from 1987 of Steve Roach and others. On this sampler every song has it own massive! dc-offset.
I´d like to prepare the whole image in one go.
I know a dcshift as sox can do doesn´t do it best cause it shifts the whole file by the same value so the songs still will have different DC. Besides that you can´t specify that shift for the channels seperately.
One way recommended by many is to add a highpass at low frequency. This works well but i don´t like the idea of using another filter.
Now i stumbled upon a free plugin called DC Killer! from Tobybear. His plugin has different approaches to remove over the time varying DC.
The first and to my understanding simplest method of his plugin already works perfect but i don´t really understand what i do with it
In his manual he describes this method as "comparison and substraction of incoming signal with last sample"
Can anyone of the Pros tell me in simple words what this can be? I understand it as a kind of DCshift that is calculated for every sample. No idea if this is good, bad or even ingenious.

Any input welcome!

Edit: The plugin is Donationware, sorry no freeware as mentioned above.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

DC removal approaches

Reply #1
Well, a DC shift that is calculated for every sample (or updated every sample), is a filter.

I would recommend the high-pass route.

DC removal approaches

Reply #2
Well, a DC shift that is calculated for every sample (or updated every sample), is a filter.

I would recommend the high-pass route.


That answer is simple enough for me. Thanks bryant!

Edit: one thing i notice is that a "highpass 10" makes the signal clip. using DCkiller brings down the max peak.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

DC removal approaches

Reply #3
Hello, since i played with de-emphasis i stumbled upon a New Age cd from 1987 of Steve Roach and others. On this sampler every song has it own massive! dc-offset.
I´d like to prepare the whole image in one go.
I know a dcshift as sox can do doesn´t do it best cause it shifts the whole file by the same value so the songs still will have different DC. Besides that you can´t specify that shift for the channels seperately.
One way recommended by many is to add a highpass at low frequency. This works well but i don´t like the idea of using another filter.
Now i stumbled upon a free plugin called DC Killer! from Tobybear. His plugin has different approaches to remove over the time varying DC.
The first and to my understanding simplest method of his plugin already works perfect but i don´t really understand what i do with it
In his manual he describes this method as "comparison and substraction of incoming signal with last sample"
Can anyone of the Pros tell me in simple words what this can be? I understand it as a kind of DCshift that is calculated for every sample. No idea if this is good, bad or even ingenious.

Any input welcome!

Edit: The plugin is Donationware, sorry no freeware as mentioned above.


In Adobe Audition or CoolEdit you 'amplify' 0 dB but check the 'DC bias adjust' to take it out.


DC removal approaches

Reply #4
In Adobe Audition or CoolEdit you 'amplify' 0 dB but check the 'DC bias adjust' to take it out.



Besides that i don´t use these programs i wonder what approach it uses to remove DC
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

DC removal approaches

Reply #5
I agree that a high-pass filter makes sense.  The DC is apparently an error and you do want to filter-out the DC, right? 

I once had a file that had a kind of "bias" that looked like offset (and there was mathematically an offset, but it was not constant), but there was little or no offset during the fade-in and fade-out.  After applying offset correction (with GoldWave), there was an offset at the beginning and end, plus  a "click"!  The better solution turned-out to be a high-pass filter!

Quote
I know a dcshift as sox can do doesn't do it best cause it shifts the whole file by the same value so the songs still will have different DC. Besides that you can´t specify that shift for the channels seperately.
  You should be able to isolate the songs & channels and process them all separately.  The process of isolating & re-joining the songs & channels is lossless, so the only changes to your audio data would be offset changes.  (I don't use SOX, so I don't know how to do that with SOX.)

Quote
Can anyone of the Pros tell me in simple words what this can be? I understand it as a kind of DCshift that is calculated for every sample. No idea if this is good, bad or even ingenious.
  You can't calculate the "DC level" for each sample...  If you look at an individual sample, it simply has a positive or negative value.  If you have a bunch of big positive values with no matching negative values, you have a DC offset.  Or, if silent parts are a series of identical non-zero values, you have a DC offset. 

My knowledge of DSP is limited, but I think a low-pass filter is easier to understand than a high-pass filter...  A low-pass filter is essentially a moving-average...  Do you inow how a moving average works?  (For example, take the average of samples 1 through 5, then take the average of samples 2- 6, then samples 3-7, etc.).  You can see how a moving average would "smooth-out" (filter) any fast (high frequency) changes.

Quote
Besides that i don´t use these programs i wonder what approach it uses to remove DC
I'm not 100% sure, but GoldWave apparently calculates an average of all samples in the file.  Then, it subtracts this value from every sample, which makes the new average exactly equal to zero!

 

DC removal approaches

Reply #6
Besides that i don´t use these programs i wonder what approach it uses to remove DC


There are two methods: "Absolute" and "Differential"

Quote from: Adobe Audition Help link=msg=0 date=
?Select Absolute and then specify the final DC percentage in the L and R boxes. This option lets you cancel out DC that’s not constant throughout a waveform. An extreme low?cut filter achieves this result. Keep in mind that the actual amount adjusted varies with each sample. For example, if you have a significant DC change in one area of the wave, at that boundary where the DC changes, the Absolute option makes all parts the same. (However, there will be a dip or peak right at the boundary point.) To introduce a DC bias by skewing the entire selected waveform above or below the center line, enter a positive or negative percentage. For example, a setting of 50% moves the entire waveform up halfway, and one of ?50% moves it down halfway.

?Select Differential and click Find Zero Now to analyze the entire selected area to get the DC offset, and adjust every sample by the inverse of that exact amount. The correct L and R percentages are entered automatically.

Ceterum censeo, there should be an "%is_stop_after_current%".

DC removal approaches

Reply #7
@DVDdoug
So the second vote for a simple High-Pass while i still don´t understand what DCkiller does then, thanks.
And yes when using dcshift on  the seperated files there are clicks that must be removed between files. What is lossless or not you don´t have to tell me btw

@pawelq
So Adobe gives you 2 choices, highpass or DCshift. So if DC is constant it may be better to DCshift or if it is varying use a highpass.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

DC removal approaches

Reply #8
You can't calculate the "DC level" for each sample...


In a way, you can. A single sample's DC offset is its deviation from 0, i.e., the sample value. The only problem with this approach is that if you remove this DC offset, there will we not much left to listen to ;-)/
Ceterum censeo, there should be an "%is_stop_after_current%".

DC removal approaches

Reply #9
My knowledge of DSP is limited, but I think a low-pass filter is easier to understand than a high-pass filter...  A low-pass filter is essentially a moving-average...  Do you inow how a moving average works?  (For example, take the average of samples 1 through 5, then take the average of samples 2- 6, then samples 3-7, etc.).  You can see how a moving average would "smooth-out" (filter) any fast (high frequency) changes.


If you take moving average and subtract it from the original file you get a crude high-pass filter.

DC removal approaches

Reply #10
I wouldn't try to correct for the DC offset problem in your digital file(s), because the analog stages your signal passes through during playback will remove the DC offset (continuously) by virtue of having coupling capacitors.  I don't think you'd enhance the sound quality of your recording by using any of the techniques mentioned in this thread.  I believe if anything, you might degrade the sound quality, although probably to an imperceptible degree.  This would make for an interesting listening test, if you were to post lossless clips from before and after your DC offset correction.


DC removal approaches

Reply #11
I wouldn't try to correct for the DC offset problem in your digital file(s), because the analog stages your signal passes through during playback will remove the DC offset (continuously) by virtue of having coupling capacitors.  I don't think you'd enhance the sound quality of your recording by using any of the techniques mentioned in this thread.  I believe if anything, you might degrade the sound quality, although probably to an imperceptible degree.  This would make for an interesting listening test, if you were to post lossless clips from before and after your DC offset correction.

No one claimed anything will sound better. Do you think i go thru my collection and remove DC for heavens sake? Like i wrote i´ll apply de-emphasis and thought about how to do it best these days. Therefore some processing is necessary. Removing DC is welcome while doing this. I only wondered about the "approaches" how to remove it.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

DC removal approaches

Reply #12
I suppose my post was read with a condescending tone, but I certainly didn't mean to write it that way.  I just meant to offer additional information that you might not have considered.

You were looking for approaches to deal with a DC offset, right?  Well, my suggested approach was to do nothing about it.

The idea of changing the sound quality was my own thought, not intended to be projected onto you as your ambition, and it was just a natural extension of my own thinking on the matter.

I was serious about the listening test.  It might help us all learn something new.  Let us know what you come up with.

DC removal approaches

Reply #13
Maybe i´ll explain. Half a year back i recognized i have some cds with pre-emphasis in my collection and wanted to remove it correctly. This sounds much simpler as it is. While reading on the net there were some howtos but as Hydrogenaudio member i of cause wanted the theoretical best way to do it.
I ended up to use sox with its mature efects set. These days when you look for a free high precission audio tool you get beaten to sox all the time 
Now these days another member posted a graph that should prove sox isn´t as exactly as mentioned so i got the interest to play around again with this de-emphasis stuff.
And again i end up using "sox"
When applying that equalizing and volume maximizing everywhere is recommnded to remove DC before applying effects to make them behave correcctly.

Now with some input from you people here i found piece of mind in using a simple highpass like i did before

Even using a highpass at 5Hz with sox removes the dc. So one tool in one command to do it all.

One thing i should mention is that i used sox 14.2.o cause 14.3.0 adds tiny clicks to the material using deemph. This is a known bug i found out later.

I doubt i can do a serious listening test for finding effects behaving wrong with existing DC or a highpass 5 changing sound.
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

DC removal approaches

Reply #14
I'm glad you were able to find a solution to the DC offset problem.

I was wondering if we could set up a listening test for anyone on HA who's interested in participating.  If you're able to post some samples, that would be great. 

If not, I might try to do something like this by adding a DC offset to a recording that has no DC offset to begin with, and then go from there with the software you found useful.

DC removal approaches

Reply #15
If not, I might try to do something like this by adding a DC offset to a recording that has no DC offset to begin with, and then go from there with the software you found useful.

Just make sure that your added offset does not cause clipping.

DC removal approaches

Reply #16
I'm glad you were able to find a solution to the DC offset problem.

I was wondering if we could set up a listening test for anyone on HA who's interested in participating.  If you're able to post some samples, that would be great. 

If not, I might try to do something like this by adding a DC offset to a recording that has no DC offset to begin with, and then go from there with the software you found useful.

Here is one 14s sample. Since it is pretty unspectular New Age i offer one part with some "action"
http://www.hydrogenaudio.org/forums/index....showtopic=76265
Much luck in getting to any conclusion.
I deemph with sox "highpass -1 5 deemph vol 1.064 dither -f low-shibata" on that album
Is troll-adiposity coming from feederism?
With 24bit music you can listen to silence much louder!

DC removal approaches

Reply #17
If you're talking about audio files, the best approach is to go through the whole file, sum all samples and divide by the total number of samples and then subtract that (with dither, and watch for clipping) from each sample.

There are two hazards with using a low-pass filter to remove DC: 1/ the filter will pass some of the DC (as a subsonic bump) at the beginning of the file until it settles in and removes it. 2/ digital filters operating at low frequencies require high precision or alternate topology. If the filter is not designed to operate at low frequencies, it will exhibit a "limit cycle" behavior and introduce noise.

DC removal approaches

Reply #18
If you're talking about audio files, the best approach is to go through the whole file, sum all samples and divide by the total number of samples and then subtract that (with dither, and watch for clipping) from each sample.

No, do not use dither. Just round to the nearest integer and subtract that value from each sample.

DC removal approaches

Reply #19
Quote
If you're talking about audio files, the best approach is to go through the whole file, sum all samples and divide by the total number of samples and then subtract that (with dither, and watch for clipping) from each sample.
That will not work unless the offset is constant throughout the file.  If the offset is not constant, you can get a "click" at the beginning/end which is exactly what happened to Wombat (and to me):

Quote
And yes when using dcshift on the seperated files there are clicks that must be removed between files.


Of course if the offset is constant, the above method will remove the click.

DC removal approaches

Reply #20
Quote
That will not work unless the offset is constant throughout the file. If the offset is not constant, you can get a "click" at the beginning/end which is exactly what happened to Wombat (and to me):


If it varies, then it's not DC

For best results, in this case I would run the filter through the first second of the material to get it's state aligned with the offset at the beginning of the file then go back to the beginning without resetting filter state (I'm assuming an IIR filter) and do the whole file.

Quote
No, do not use dither. Just round to the nearest integer and subtract that value from each sample.


Yeah, I guess I was wrong about that.

DC removal approaches

Reply #21
Whatever you do to the file to remove the DC (or near-zero frequency content), it will always be equivalent to some sort of highpass filtering.