Hello, I have an audio file that contains human voice possibly with DC bias. What are the pros and cons of DC removal using high pass filter vs. just computing the average and subtracting from each sample? If using high pass filter, then what should be the cut frequency? Thanks, Ury.
DC Removal for human voice
Started by ●August 7, 2012
Reply by ●August 7, 20122012-08-07
"Ury" <49838@dsprelated> writes:> Hello, > > I have an audio file that contains human voice possibly with DC bias. > What are the pros and cons of DC removal using high pass filter vs. just > computing the average and subtracting from each sample?It depends on your scenario. If you're are doing this at a desktop PC one song at a time, the "compute the average" method is fine, or anytime you know how to split the input into separate blocks. However, if you're embedded this into a processor, you usually have to view the input as an indefinite stream of data.> If using high pass filter, then what should be the cut frequency?It's not black and white. Your telephone uses 300 Hz. I would think 50 Hz would be more than enough for most cases, and should give you an easy design goal. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Reply by ●August 7, 20122012-08-07
If your audio file is long, just subtracting the average should be fine. If the file is short, the accuracy of the dc estimate can be improved by starting and stopping your average computation on a zero crossing. Bob
Reply by ●August 7, 20122012-08-07
Robert Adams wrote:> If your audio file is long, just subtracting the average should be fine. >CAUTION - circular reasoning ahead!> If the file is short, the accuracy of the dc estimate can be improved by starting > and stopping your average computation on a zero crossing.OROBOROS has ended ;) Would one not have to know "average value" to identify a "zero crossing"? E.G. 1 v peak-to-peak signal superimposed on 10 v DC. Wherefore art thine "zero" crossings?
Reply by ●August 7, 20122012-08-07
I was assuming the signal is large and the dc is small, but if that's not true then you are right that this technique might fail. Bob
Reply by ●August 7, 20122012-08-07
On Tuesday, August 7, 2012 8:04:33 AM UTC-5, Ury wrote:> Hello, I have an audio file that contains human voice possibly with DC bias. What are the pros and cons of DC removal using high pass filter vs. just computing the average and subtracting from each sample? If using high pass filter, then what should be the cut frequency? Thanks, Ury.If the low-frequency cutoff is high enough, try a simnple 1-pole filter y(n) = alpha*y(n-1) + (1-alpha)*x(n) I used this in a telecom device, and it worked file, espicially if alpha is a factor of 2 (e.g. 1/256) y(n) = y(n-1) >> 8 + x(n) - x(n) >> 8 If you want more emphasis on the past values instead of the current, then y(n) = (1-alpha)*y(n-1) + alpha*x(n)
Reply by ●August 7, 20122012-08-07
On 7.8.12 10:50 , maury wrote:> On Tuesday, August 7, 2012 8:04:33 AM UTC-5, Ury wrote: >> Hello, I have an audio file that contains human voice possibly with DC bias. What are the pros and cons of DC removal using high pass filter vs. just computing the average and subtracting from each sample? If using high pass filter, then what should be the cut frequency? Thanks, Ury. > > If the low-frequency cutoff is high enough, try a simnple 1-pole filter > > y(n) = alpha*y(n-1) + (1-alpha)*x(n) > > I used this in a telecom device, and it worked file, espicially if alpha is a factor of 2 (e.g. 1/256) > > y(n) = y(n-1) >> 8 + x(n) - x(n) >> 8 > > If you want more emphasis on the past values instead of the current, then > > y(n) = (1-alpha)*y(n-1) + alpha*x(n) >This looks like a single-pole low-pass. The OP asked for a high-pass. -- Tauno Voipio
Reply by ●August 7, 20122012-08-07
Randy Yates <yates@digitalsignallabs.com> wrote: (snip, someone wrote)>> I have an audio file that contains human voice possibly with DC bias. >> What are the pros and cons of DC removal using high pass filter vs. just >> computing the average and subtracting from each sample?(snip)> It's not black and white. Your telephone uses 300 Hz. I would think 50 > Hz would be more than enough for most cases, and should give you an > easy design goal.My stereo amplifier has a switchable 18Hz (12db/octave) filter. Among other uses, warped vinyl records would be below that. -- glen
Reply by ●August 8, 20122012-08-08
Maybe one detail: computing the average of a signal that is known in its whole length is conceptually the same as a FIR filter. It does not introduce group delay ripple, as the impulse response is symmetric. A lowpass filter as discussed is IIR. It will cause group delay distortion near the band edge. Most likely, this doesn't matter in real-world audio applications. But it will show, if you plan to compare output to input for a known test signal. An easy solution is to apply the same filter also to the reference signal, so there is no group delay difference between signals.
Reply by ●August 8, 20122012-08-08
On Tuesday, August 7, 2012 3:11:59 PM UTC-5, Tauno Voipio wrote:> On 7.8.12 10:50 , maury wrote: > On Tuesday, August 7, 2012 8:04:33 AM UTC-5, Ury wrote: >> Hello, I have an audio file that contains human voice possibly with DC bias. What are the pros and cons of DC removal using high pass filter vs. just computing the average and subtracting from each sample? If using high pass filter, then what should be the cut frequency? Thanks, Ury. > > If the low-frequency cutoff is high enough, try a simnple 1-pole filter > > y(n) = alpha*y(n-1) + (1-alpha)*x(n) > > I used this in a telecom device, and it worked file, espicially if alpha is a factor of 2 (e.g. 1/256) > > y(n) = y(n-1) >> 8 + x(n) - x(n) >> 8 > > If you want more emphasis on the past values instead of the current, then > > y(n) = (1-alpha)*y(n-1) + alpha*x(n) > This looks like a single-pole low-pass. The OP asked for a high-pass. -- Tauno Voipiooops :(






