From: robert bristow-johnson on
On Dec 22, 11:41 pm, Tim Wescott <t...(a)seemywebsite.com> wrote:
>
>
> OTOH, leading with a more highly-damped pole pair would hinder energy
> from getting through to overflow later stages.

the idea of matching such poles with the zeros that would do the most
to "dampen" their resonance seems directed to that purpose.

dunno what you would do with cascaded all-pole biquad filters.
whether it's good to put the highest Q first or last. i might think
it would be good to put the highest Q all-pole filter last.

all this assumes that each biquad stage has 5 coefficients so that you
can apportion the "right amount" of gain for each section and sweep
whatever leftover makeup gain into the last section. i might put into
the first section the most constant gain possible so that from the
cascade input to the output of that particular section, no frequency
has gain exceeding 0 dB. do that until the last section, then the
leftover gain would be whatever is needed to satisfy the spec for the
whole damn thang.

so maybe the flattest or broadest or least sharp magnitude response
goes first and each section has DC gain adjusted so that the maximum
gain (at any frequency) from the overall input to the output of that
section is 0 dB.

i can't imagine that some IEEE dude hasn't already written a treatise
about this in the 60s or 70s. no? maybe some old Bell System
Technical Journal? (*never* assume you've invented or discovered
something novel until you check there.)


r b-j
From: robert bristow-johnson on
On Dec 22, 11:50 pm, Vladimir Vassilevsky <nos...(a)nowhere.com> wrote:
> Tim Wescott wrote:
> > On Tue, 22 Dec 2009 20:32:58 -0800, robert bristow-johnson wrote:
>
> >>it's not a proof, but a sorta rule of thumb that i thought made sense is
> >>to start with the pole pair (i'm gonna assume everything is complex
> >>conjugate) that are the least stable;
> > OTOH, leading with a more highly-damped pole pair would hinder energy
> > from getting through to overflow later stages.
>
> The higher Q stage is noisier then the lower Q stage. If you have low Q
> stage after high Q stage, the noise of the first stage gets filtered by
> the second stage. It is a tradeoff of noise vs overflow.

i might suggest being careful with terminology (perhaps you are, Vlad,
and if so, then i might disagree). i consider the Q of a biquad
section to be a function solely of the poles of that section. with
Direct Form 1 and a double-wide accumulator, i really think that the
noisiness depends on the whole frequency response, not just the
frequency response due to the poles (well, that's not right, the
quantization error for a section is filtered only by the poles - okay,
you're right for the DF1).

BTW, i might highly recommend the DF1 for cascaded biquads over the
DF2. for order N, the DF2 being canonical, requires N states and the
cascaded DF1 requires N+2 states (not the 2N states that the naive
think). if you use a double-wide accumulator, there is only one point
of quantization in the DF1 (two for a single DF2 stage, but if you're
willing to carry a double precision result into the next section, you
can make the number of quantizers N+1 for DF2 compared to N for DF1).
but the real reason is that if you have some nice "virtual" pole/zero
cancellation (like you would for a peak/cut parametric EQ) the DF2
applies poles first and inflates your signal up to a high level (where
clipping might happen unless you reduce the input signal thus lowering
the "S" in S/N) before the zeros get to beat it back down. not a
problem in DF1.

also, surrounding the quantizer in a DF1 with simple noise shaping
with a zero at z=1 (a.k.a. "fraction saving" if your quantizer is
always rounding down or truncating) is a piece of cake. it's what i
used in that simple DC blocker trick on Grant's website.

r b-j
From: robert bristow-johnson on
On Dec 23, 12:34 am, robert bristow-johnson
<r...(a)audioimagination.com> wrote:
>
> BTW, i might highly recommend the DF1 for cascaded biquads over the
> DF2.  for order N, the DF2 being canonical, requires N states and the
> cascaded DF1 requires N+2 states (not the 2N states that the naive
> think).  if you use a double-wide accumulator, there is only one point
> of quantization in the DF1 (two for a single DF2 stage, but if you're
> willing to carry a double precision result into the next section, you
> can make the number of quantizers N+1 for DF2 compared to N for DF1).

ooops, i forgot that N is the order (let's assume even for shits and
grins) not the number of sections which is N/2. so there are 2
quantization points in a single DF2 section, but if you're carrying a
double precision result to the input of the following DF2 section, you
can make the total number of quantization points to be N/2 +1 compared
to N/2 for the DF1.

dotting the t's and crossing the i's is important.

r b-j

From: Kenn Heinrich on
Vladimir Vassilevsky <nospam(a)nowhere.com> writes:

> Tim Wescott wrote:
>> On Tue, 22 Dec 2009 13:59:28 -0600, Vladimir Vassilevsky wrote:
>>
>>
>>>Let's say we need to implement H(z) = P(z)/Q(z) in the fixed point. The
>>>typical implementation would be a cascade of biquads. So we factor P(z)
>>>and Q(z) and distribute poles and zeroes between the stages.
>>>
>>>The dynamic range of a filter is limited by overflow at the top, and by
>>>quantization artifacts at the bottom. We can try all variants of
>>>assignment of poles and zeroes to different stages to maximize the
>>>dynamic range from rms quantization noise to full scale sine wave at the
>>>"worst" frequency. So far so good.
>>>
>>>However, this doesn't tell if some stage of filter can overflow if the
>>>input is an arbitrary non-harmonic waveform. How could we optimize the
>>>filter for this case?
>>>
>> I _think_ that if the transfer function from input to each state in
>> the filter is less than unity (or whatever the critical gain is
>> necessary to prevent overflow) for all possible frequencies, you
>> can't overflow.
>> But I don't _know_ -- I'd have to try to prove it, and may end up
>> disproving it instead!
>
> Unfortunately, not. Think of a highpass filter with the gain of 1 and
> the data range is +/-1. Let the input -1,-1,-1....-1, +1, so here is
> overflow.
>
> Vladimir Vassilevsky
> DSP and Mixed Signal Design Consultant
> http://www.abvolt.com
>

So if you're talking about a stage with *any* poles p_k, then if you
apply an input at z=p_k, you will get infinite output. A special case of
that is your HPF example, where you can apply this patholgical input
with finite amplitude input since the pole is on the unit circle. In
that case, you're hosed.

For other poles *inside* the unit circle, could you not try to work
backwards? You know that in that case, you need to apply an
exponentially increasing input (s=exp(a+jw)) envelope but your input
will necessarily saturate on the number of input bits. Could you bound
the gain due to the pole as you reach clipping by computing the impulse
response to the saturated exponential input at z=p_k? Not elegant, not
proved, but it might work.

- Kenn

From: Tim Wescott on
On Tue, 22 Dec 2009 17:35:26 -0600, Vladimir Vassilevsky wrote:

> Tim Wescott wrote:
>> On Tue, 22 Dec 2009 13:59:28 -0600, Vladimir Vassilevsky wrote:
>>
>>
>>>Let's say we need to implement H(z) = P(z)/Q(z) in the fixed point. The
>>>typical implementation would be a cascade of biquads. So we factor P(z)
>>>and Q(z) and distribute poles and zeroes between the stages.
>>>
>>>The dynamic range of a filter is limited by overflow at the top, and by
>>>quantization artifacts at the bottom. We can try all variants of
>>>assignment of poles and zeroes to different stages to maximize the
>>>dynamic range from rms quantization noise to full scale sine wave at
>>>the "worst" frequency. So far so good.
>>>
>>>However, this doesn't tell if some stage of filter can overflow if the
>>>input is an arbitrary non-harmonic waveform. How could we optimize the
>>>filter for this case?
>>>
>> I _think_ that if the transfer function from input to each state in the
>> filter is less than unity (or whatever the critical gain is necessary
>> to prevent overflow) for all possible frequencies, you can't overflow.
>> But I don't _know_ -- I'd have to try to prove it, and may end up
>> disproving it instead!
>
> Unfortunately, not. Think of a highpass filter with the gain of 1 and
> the data range is +/-1. Let the input -1,-1,-1....-1, +1, so here is
> overflow.
>
> Vladimir Vassilevsky
> DSP and Mixed Signal Design Consultant http://www.abvolt.com

Oh _fine_.

I thought "oh just find the transfer function from input to state for
each state, then try the inverse of that transfer function as an input"
-- so you'd get an impulse.

But I hardly think that's going to get you where you want to go, either.

--
www.wescottdesign.com