DSPRelated.com
Forums
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →

DC Blocker

Started by b2508 ●October 22, 2015
On 10/24/2015 12:32 PM, robert bristow-johnson wrote:
> > but the simplification of > > d[n] = 2^(N-1)*x[n] - 2^(N-1)*x[n-1] > > y[n] = y[n] - 2^(1-N)*( 2^(N-1)*(1-p)*y[n-1] + d[n] )
Can you tell me if this formula is correct? y[n] is calculated from y[n]?
> to > >>> >>> >>> y[n] = x[n] - (2^(1-N)) * w[n] >>> >>> w[n+1] = w[n] + ( (2^(N-1))*(1-p) ) * y[n] >>>
-- Rick
On 10/24/15 1:35 PM, rickman wrote:
> On 10/24/2015 12:32 PM, robert bristow-johnson wrote: >> >> but the simplification of >> >> d[n] = 2^(N-1)*x[n] - 2^(N-1)*x[n-1] >> >> y[n] = y[n] - 2^(1-N)*( 2^(N-1)*(1-p)*y[n-1] + d[n] ) > > Can you tell me if this formula is correct? y[n] is calculated from y[n]? > >
of course it's not. should be d[n] = 2^(N-1)*x[n] - 2^(N-1)*x[n-1] y[n] = y[n-1] - 2^(1-N)*( 2^(N-1)*(1-p)*y[n-1] + d[n] ) remember that this one:
>>>> >>>> y[n] = x[n] - (2^(1-N)) * w[n] >>>> >>>> w[n+1] = w[n] + ( (2^(N-1))*(1-p) ) * y[n] >>>>
is simpler and leads to the same transfer functions (with a zero at z=1 and a pole at z=p) for both Y(z)/X(z) and Y(z)/E(z) where e[n] would be the additive error resulting from truncation. so modeling in that error signal e[n], it would look like (for my lame algorithm): d[n] = 2^(N-1)*x[n] - 2^(N-1)*x[n-1] y[n] = y[n-1] - 2^(1-N)*( 2^(N-1)*(1-p)*y[n-1] + d[n] + e[n] ) and for Tim's better and more concise alg: y[n] = x[n] - (2^(1-N))*( w[n] + e[n] ) w[n+1] = w[n] + ( (2^(N-1))*(1-p) ) * y[n] in both cases, e[n] is whatever non-positive signal that must be added to whatever it's added to, to make the bottom N-1 bits go to zero before the word is shifted right by N-1 bits. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On 10/22/15 11:54 AM, radams2000@gmail.com wrote:
> Unless you are really constrained in terms of gate count I would recommend using full double precision in the recursive section. It's only slightly more expensive than noise-shaping and you won't have troubles with idle tones from the noise-shaping.
Bob, do you get idle tones with a 1st-order HPF with one path error feedback? it's hard for me to picture that.
> Idle tones have a nasty way of only being detected by your customers after you are shipping product.
then you should do something Dilbertian to those damn customers that are causing trouble. hope to see you in NYC this coming week. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
>Hi all, > >I am trying to implement this DC blocker in FPGA. > >http://www.digitalsignallabs.com/dcblock.pdf >
looking to above document I got a bit curious, to get rid of truncation dc bias why add fraction of truncation when you can just use rounding to nearest integer or to nearest even. Kaz --------------------------------------- Posted through http://www.DSPRelated.com
On 10/24/15 10:50 PM, kaz wrote:
>> Hi all, >> >> I am trying to implement this DC blocker in FPGA. >> >> http://www.digitalsignallabs.com/dcblock.pdf >> > looking to above document I got a bit curious, to get rid of truncation dc > bias why add fraction of truncation when you can just use rounding to > nearest integer or to nearest even.
it's what error shaping is all about. suppose your quantization error was +1/4 LSB. which is better?: 1. that it rounds down all of the time? 2. that it rounds down 75% of the time and rounds up 25% of the time? let's say that the filter has non-zero input for a while and then the input is solidly at zero. now, if the filter is linear and stable, the output is going to (exponentially) decay toward zero. what happens when it gets so low that the next value is less than 1/2 LSB from the current non-zero value. what will happen then? will it ever decay to zero? not sure Randy will agree, but much of that article (the IIR part) was derived from a trick i "published" here 15 years ago and now lives at dspguru: http://www.dspguru.com/dsp/tricks/fixed-point-dc-blocking-filter-with-noise-shaping what you *really* don't want is a DC blocker that generates its own DC, due to limit-cycling. in the audio world, this can be confusing for an operator that is expecting his/her dB meter to drop below -70 dB when silence is going in and it never does. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
>let's say that the filter has non-zero input for a while and then the >input is solidly at zero. now, if the filter is linear and stable, the >output is going to (exponentially) decay toward zero. what happens when
>it gets so low that the next value is less than 1/2 LSB from the current
>non-zero value. what will happen then? will it ever decay to zero? >
Thanks Robert. OK I got it but still I would ask why not just add some nice zero dc mild oscillation to input to avoid output dc if input is solid constant.
>not sure Randy will agree, but much of that article (the IIR part) was >derived from a trick i "published" here 15 years ago and now lives at >dspguru: > > >http://www.dspguru.com/dsp/tricks/fixed-point-dc-blocking-filter-with-noise-shaping >
They should have mentioned that and should have explained this noise shaping.
>what you *really* don't want is a DC blocker that generates its own DC, >due to limit-cycling. in the audio world, this can be confusing for an >operator that is expecting his/her dB meter to drop below -70 dB when >silence is going in and it never does. > > >-- > >r b-j rbj@audioimagination.com >
Why not just ignore such case of mild dc instead of a 32 bit subtractor/adder plus registers. For FPGA this means plenty of resource and fmax bottleneck. Kaz --------------------------------------- Posted through http://www.DSPRelated.com
This discussion also reminds me of oscillation introduced by polyphase
filter in upsampling. Since the gain of each polyphase may turn out
slightly different from each other then a dc input will be oscillating as
its gain slightly varies and can be confusing to the unwary. But I rather
accept this than manually force each and every polyphase to have same
gain.

Kaz

---------------------------------------
Posted through http://www.DSPRelated.com
On 10/25/15 6:35 AM, kaz wrote:
> This discussion also reminds me of oscillation introduced by polyphase > filter in upsampling. Since the gain of each polyphase may turn out > slightly different from each other then a DC input will be oscillating as > its gain slightly varies and can be confusing to the unwary.
there is a way to design your polyphase FIR to avoid that (and not the cheating solution below). think about what would happen if you had notches (all the way to -inf dB) at multiples of your sampling frequency (except the 0 multiple, of course). send me an email. i'll show you.
> But I rather accept this than manually force each and every polyphase > to have same gain.
but that's sorta cheating and cheating in mathematics usually has other consequences. (like your DC might not have tiny oscillations in gain, but some other frequency might have worse oscillations than before.) -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
>On 10/25/15 6:35 AM, kaz wrote: >> This discussion also reminds me of oscillation introduced by polyphase >> filter in upsampling. Since the gain of each polyphase may turn out >> slightly different from each other then a DC input will be oscillating
as
>> its gain slightly varies and can be confusing to the unwary. > >there is a way to design your polyphase FIR to avoid that (and not the >cheating solution below). think about what would happen if you had >notches (all the way to -inf dB) at multiples of your sampling frequency
>(except the 0 multiple, of course). > >send me an email. i'll show you. > >> But I rather accept this than manually force each and every polyphase >> to have same gain. > >but that's sorta cheating and cheating in mathematics usually has other >consequences. (like your DC might not have tiny oscillations in gain, >but some other frequency might have worse oscillations than before.) > > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge."
Well it is editing, not cheating. If I got 5 polyphases with a difference of +/-3 (sum) on 16 bits signed scale then I might as well force some large coefficients so that their sum is same and make sure the prototype filter stays symmetrical (in case) and recheck its response against my spec. After all any filter can be modified by windowing, scaling, methodology ...etc and no solution is unique. Just a thought. Kaz --------------------------------------- Posted through http://www.DSPRelated.com
robert bristow-johnson <rbj@audioimagination.com> writes:

> On 10/24/15 10:50 PM, kaz wrote: >>> Hi all, >>> >>> I am trying to implement this DC blocker in FPGA. >>> >>> http://www.digitalsignallabs.com/dcblock.pdf >>> >> looking to above document I got a bit curious, to get rid of truncation dc >> bias why add fraction of truncation when you can just use rounding to >> nearest integer or to nearest even. > > it's what error shaping is all about. > > suppose your quantization error was +1/4 LSB. which is better?: > > 1. that it rounds down all of the time? > 2. that it rounds down 75% of the time and rounds up 25% of the time? > > let's say that the filter has non-zero input for a while and then the > input is solidly at zero. now, if the filter is linear and stable, > the output is going to (exponentially) decay toward zero. what > happens when it gets so low that the next value is less than 1/2 LSB > from the current non-zero value. what will happen then? will it ever > decay to zero? > > not sure Randy will agree, but much of that article (the IIR part) was > derived from a trick i "published" here 15 years ago and now lives at > dspguru: > > > http://www.dspguru.com/dsp/tricks/fixed-point-dc-blocking-filter-with-noise-shaping
I agree. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com