# questions raised by reading and thinking with possibly missing background

Started by December 10, 2005
```
Greg Berchin wrote:

>>Let's take a typical subwoofer LPF with -3dB/100Hz and -24dB/200Hz.
>>The FIR version will look like exp(-x^2) function without any ripples.
>
>
> ... assuming that it was designed as an approximation to a Gaussian
> response.

No. Assumming the reasonable rolloff speed and passband flatness.

> However, consider how many taps a 100Hz FIR Gaussian filter
> will require -- for 48kHz sampling with 24-bit coefficients, it's on the
> order of 3000.

Brute force approach :(

First, for FIR you don't need 24 bit coefficients - a mere 10 bits is
sufficient.

Second, I would do such filter as a part of multirate filterbank. If
your goal is a subwoofer, there is no need to burn at the full speed of
48kHz.

> Design for a flatter passband, and the number of taps
> (and, consequently, the duration of the impulse response) increases.

If the design spec is unreasonable, then the results will be
unreasonable. It does not matter if it is FIR or IIR.

>>The IIR version could be 4th order Butterworth.
>
> Or 4th order Bessel, which would be a pretty good approximation for the
> Gaussian, up to the cutoff frequency.  And it could be implemented with

To have reasonable audio performance, those biquads should use 32x32 =
64 bit multiplications at least, as well as the noise shaping at
truncation of 64 to 32 bits. This relates to the straightforward 48kHz
implementation.

DSP and Mixed Signal Design Consultant

http://www.abvolt.com

```
```Greg Berchin <76145.2455@compuswerve.com> wrote in
news:jfh0q1d2931d8ngbfd2rtu56k9hvf92m99@4ax.com:

> On Wed, 14 Dec 2005 15:19:23 GMT, Al Clark <dsp@danvillesignal.com>
> wrote:
>
>>Imagine someone hits a drum. You can hear the drum before he hits it.
>>If the filters have a fairly regular passband ripple (kind of
>>sinusoidal), such as might be expected from a PM filter, then the pre-
>>echo will be concentrated. You can reduce this effect, by using a
filter
>>with a more "random" like passband ripple. BTW: (I learned all this
from
>>a discussion with rbj).
>
context
> of antialias filters) last year:  "Antialias Filters and System
> Transient Response at High Sample Rates"; Journal of the Audio
> Engineering Society, Volume 52, Number 3, March 2004.
>
> Greg
>

This is an interesting paper. Thanks for the reference.

BTW: I'm not taking a stand on the best method of creating speaker
crossovers. I just remember a few of the issues.

In seems to me, that subwoofer crossovers are not nearly as critical as
the crossover between a tweeter and a midrange driver from an artifacts
point of view.

Obviously, one of the benefits of using a digital crossover is that you
can experiment by jusat changing the software.

--
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
```
```Randy Yates wrote:

...
> >> Consider the filter coefficients determined as
> >>
> >> function y = test(x)
> >> %function y = test(x)
> >> n = [-25 : 25];
> >> Fs = 1;
> >> Ts = 1/Fs;
> >> t = n*Ts;
> >> plot(sinc(t+1/7));
> >>
> >> These are neither symmetric nor antisymmetric in the sense you defined,
> >> and yet this is a linear phase filter, is it not?
> >
> > No, it's not.
>
> True, but this is:
>
>   b[n] = sinc(n + 1/7)

Since Fs = Ts = 1, I don't see a difference between sinc(t+1/7) and
sinc(n+1/7) ?

```
```On Tue, 13 Dec 2005 21:44:58 -0600, Greg Berchin wrote:

> On Tue, 13 Dec 2005 22:29:32 -0500, Jerry Avins <jya@ieee.org> wrote:
>
>>On axis. Their outstanding property is superior (but hardly perfect)
>>performance off axis.
>
> Correct.  For perfect off-axis response, the low frequency driver and
> the high frequency driver would have to be coincident.  I think of that
> not as a limitation of the crossover, but of the loudspeaker.

Although I own several pairs of very nice speakers with coincident drivers
(SEAS, I think), that isn't the only option: a perfect (for whatever
definition of perfect actually works in practice) brick-wall crossover
ought to improve the off-axis behaviour by ensuring that there's no
interference (no frequencies in common to multiple drivers).

I'm afraid that I am yet to get around to experimenting with this in my
own systems, but my coleagues who build speaker controller boxes which
have the ability to do this sort of crossover (amongst others) report that
they can work very well in practice.

--
Andrew

```
```On Wed, 14 Dec 2005 22:22:28 +0100, Andrew Reilly
<andrew-newspost@areilly.bpc-users.org> wrote:

>a perfect (for whatever
>definition of perfect actually works in practice) brick-wall crossover
>ought to improve the off-axis behaviour by ensuring that there's no
>interference (no frequencies in common to multiple drivers).

... which brings us full-circle, back to the original issue of transient
response.  The closer the filters are to true brickwall in the frequency
domain, the closer to sin(x)/x they are in the time domain.

Greg
```
```On Wed, 14 Dec 2005 15:50:46 -0600, Greg Berchin wrote:

> On Wed, 14 Dec 2005 22:22:28 +0100, Andrew Reilly
> <andrew-newspost@areilly.bpc-users.org> wrote:
>
>>a perfect (for whatever
>>definition of perfect actually works in practice) brick-wall crossover
>>ought to improve the off-axis behaviour by ensuring that there's no
>>interference (no frequencies in common to multiple drivers).
>
> ... which brings us full-circle, back to the original issue of transient
[Sorry for missing the opening of the thread.]
> response.  The closer the filters are to true brickwall in the frequency
> domain, the closer to sin(x)/x they are in the time domain.

Surely not!  Show me any linear phase FIR filter (digitally symmetrical
or not) and I'll show you a minimum phase filter with an identical
frequency response.  Got my trusty Hilbert transform here in my back
pocket...

Of course, you don't have to live only at the three usual points:
minimum, linear, maximum phase: life gets more interesting in between.

Cheers,

--
Andrew

```
```Greg Berchin wrote:
> On Wed, 14 Dec 2005 22:22:28 +0100, Andrew Reilly
> <andrew-newspost@areilly.bpc-users.org> wrote:
>
> >a perfect (for whatever
> >definition of perfect actually works in practice) brick-wall crossover
> >ought to improve the off-axis behaviour by ensuring that there's no
> >interference (no frequencies in common to multiple drivers).
>
> ... which brings us full-circle, back to the original issue of transient
> response.  The closer the filters are to true brickwall in the frequency
> domain, the closer to sin(x)/x they are in the time domain.

Not true.  To some degree you can vary the phase, given identical
(flat, brick, or whatever) frequency responses.  Minimum/maximum
phase versus linear-phase for instance, merely by moving some
zeros inside/outside the unit circle (or left/right half plane in the
analog case).

IMHO. YMMV.
--
rhn A.T nicholson d.O.t C-o-M

```
```Greg Berchin wrote:
> On Wed, 14 Dec 2005 22:22:28 +0100, Andrew Reilly
> <andrew-newspost@areilly.bpc-users.org> wrote:
>
> >a perfect (for whatever
> >definition of perfect actually works in practice) brick-wall crossover
> >ought to improve the off-axis behaviour by ensuring that there's no
> >interference (no frequencies in common to multiple drivers).
>
> ... which brings us full-circle, back to the original issue of transient
> response.  The closer the filters are to true brickwall in the frequency
> domain, the closer to sin(x)/x they are in the time domain.
...
and
...
> On 14 Dec 2005 14:47:02 -0800, "Ron N." <rhnlogic@yahoo.com> wrote:
>
> >Not true.  To some degree you can vary the phase, given identical
> >(flat, brick, or whatever) frequency responses.
>
> Gentlemen, while what you say is correct, you miss my point.  My point
> is that the impulse response of a rectangular magnitude response
> (assuming a reasonably "smooth" accompanying phase response) decays at
> rate of roughly 6 dB per doubling of time.  That makes for a lot of
> ringing in the time domain.
>
> Yes, the changes in phase that you mention WILL change specific
> characteristics of the impulse response -- for example, going from zero
> phase to minimum phase will change it from noncausal (starting at
> t=-infinity, peaking at t=0, and extending to t=+infinity) to causal
> (starting at t=0, peaking soon thereafter, and extending to
> t=+infinity).  But Parseval's relation tells us that the integral, over
> all time, of the squared magnitude in the time domain is proportional to
> the integral, over all frequencies, of the squared magnitude in the
> frequency domain.  So changing the phase response does NOT change the
> amount of energy in the impulse response; it just "moves it around".

I see.  So what you are saying is that even if a brick-wall filter
of some sort can keep the frequency bands from interfering, in
trade, the time domain energy can then interfere, since it is split
into the tails of two different impulse responses which then need
to cancel?

So if you don't have perfectly matched co-axial transducers, you are
stuck with either off-axis frequency response or transient response
distortion?

I think this makes sense.  Something about not being able to
reproduce a 2D/3D field from a small finite number of point
sources (unless identical to the original field generators)...

IMHO. YMMV.
--
rhn A.T nicholson d.O.t C-o-M

```
```abariska@student.ethz.ch writes:

> Randy Yates wrote:
>
> ...
>> >> Consider the filter coefficients determined as
>> >>
>> >> function y = test(x)
>> >> %function y = test(x)
>> >> n = [-25 : 25];
>> >> Fs = 1;
>> >> Ts = 1/Fs;
>> >> t = n*Ts;
>> >> plot(sinc(t+1/7));
>> >>
>> >> These are neither symmetric nor antisymmetric in the sense you defined,
>> >> and yet this is a linear phase filter, is it not?
>> >
>> > No, it's not.
>>
>> True, but this is:
>>
>>   b[n] = sinc(n + 1/7)
>
> Since Fs = Ts = 1, I don't see a difference between sinc(t+1/7) and
> sinc(n+1/7) ?

There isn't a difference in that respect. The difference is that n is not
constrained to be between -25 and +25.
--
%  Randy Yates                  % "She's sweet on Wagner-I think she'd die for Beethoven.
%% Fuquay-Varina, NC            %  She love the way Puccini lays down a tune, and
%%% 919-577-9882                %  Verdi's always creepin' from her room."
%%%% <yates@ieee.org>           % "Rockaria", *A New World Record*, ELO
```
```Al Clark wrote:
>
> I think the main criticism with Linear Phase FIR filters is that you can
> often hear pre-echos caused by the fact that the impulse response is
> symmetrical around the center.

but it's not so much the ripples ramping up to the main lobe of the
impulse response, Al.  it's a consequence of using the Parks-McClellan
algorithm to design an "equi-ripple" filter.  those ripples in the
pass-band are like multiplying by a cosine which has the effect of
translation in the other domain.

> Imagine someone hits a drum. You can hear the drum before he hits it.
> If the filters have a fairly regular passband ripple (kind of
> sinusoidal), such as might be expected from a PM filter, then the pre-
> echo will be concentrated. You can reduce this effect, by using a filter
> with a more "random" like passband ripple. BTW: (I learned all this from
> a discussion with rbj).

this is what i meant, Al - you can see a picture of it at:

http://www.circuitcellar.com/library/eq/154/4.htm

below, at bottom, is a simple MATLAB program that will compare a LPF
design using Parks-McClellan (otherwize known as "remez" in MATLAB
land), Least Squares, and a Kaiser-windowed sinc methods.  if the
design method is Parks-McClellan, it is likely that the ripples *will*
look like a cosine with a pretty constant frequency (and P-McC will
make sure the amplitude is constant) over the passband.  this is
equivalent to taking a smoother LPF frequency response and multiplying
it by a small cosine biased up by the constant 1.  multiplying in the
frequency-domain is the same as convoluting in the time-domain.
multiplying by the constant 1 is like convolving with a delta function
(which changes nothing) but multiplying by the small cosine is like
convolving by a pair of offset deltas that are small in amplitude.
that means the main LPF impulse will be translated to the edges before
and after the main impulse (a pre-echo and post-echo).  temporal
masking might hide the post-echo, but not the pre-echo.

run the following MATLAB code if you can to see.  (you will have to fix
the word-wrapping that Google Groups puts in.)  you can visually see
the pre-echo and post-echo that will go away if you use a different
design method.

r b-j

% lpf.m

% Basic Parks-McClellan (or Least Squares or windowed sinc) Low-Pass
Filter Design

if exist('filename') ~= 1,
filename = 'lpfcoefs.txt';        % filename for FIR coefs output
end;

% the input parameters are not changed if they already exist

if exist('SR') ~= 1,
SR = 96;    % sampling rate
end;

if exist('PB') ~= 1,
PB = 20;    % top of passband region (where filter should be flat
and 0 dB)
end;

if exist('PBR') ~= 1,
PBR = 0.5;    % max passband ripple in dB which is twice the max
error in passband
end;

if exist('SB') ~= 1,
%    SB = SR/2 - PB;
SB = 20.5;    % bottom of stopband region (where filter should be
flat and -inf dB)
end;

if exist('SBG') ~= 1,
SBG = -84;    % max stop band gain in dB
end;

R = (PB + SB)/SR;

%   Number of required FIR taps, from a formula in Oppenhiem & Schafer
p. 480
%   the more complex and accurate MATLAB function remlpord() could be
%   for nicety, we always round up to the nearest odd number of FIR
taps.
%   when N is odd, the delay (N-1)/2 is always an integer number of
samples

N = 2*ceil(0.0342416*SR*(-0.5*SBG - 10*log10(10^(0.5*PBR/20)-1) -
13)/(SB-PB) - 0.5) + 1

if 0                    % set this to 1 if you wanna get coefficients
for windowed sinc LPF (for testing)

h = zeros(1, N+1);            % zero the whole thang

t = linspace(-R*(N-1)/2, R*(N-1)/2, N);
h = [0 (R*sinc(t)) .* kaiser(N, 0.1102*(-SBG-8.7))'] ;        %
kaiser windowed sinc()
clear t;

else

W = ( (10^(0.5*PBR/20) - 1) )/( 10^(SBG/20) )    % linear
stopband/passband weighting ratio

f = [0   PB/(0.5*SR)  SB/(0.5*SR)  1];        % Define passband and
stopband regions
m = [1   1            0            0];        % Define passband and
stopband magnitudes
w = [1                W             ];        % Define passband and
stopband error weights

h = zeros(1, N+1);

% h = [0 firls(N-1, f, m, w)];    % Compute impulse response from
Least Squares

h = [0 remez(N-1, f, m, w)];    % Compute impulse response from
Parks-McClellan

end

%   h(1) = 0 and h((N+1)/2) = max
%   symmetry:  h((N+1)/2 + k) = h((N+1)/2 - k)
%   this should result in zero phase
%   in the frequency response.

plot(h/R, '.');            % plot scaled impulse response pause;

H = fft([h([(N+1)/2+1:N+1]) zeros(1, 3*(N+1)) h([1:(N+1)/2])]);    %
fft after zero-padding to extend length by factor of 4

freq = linspace(0, 1-2/(N+1), 2*N+1);            % set of frequencies
from DC to just under Nyquist

plot(freq, 20*log10(abs(H(1:2*N+1))+1.0e-7));        % dB by linear
freq plot
pause;

axis([0 0.5 -1 1]);            % look closely at passband ripple
pause;

semilogx(freq(2:2*N+1), 20*log10(abs(H(2:2*N+1))+1.0e-7), 'g');    % dB
by log freq plot, skip DC
pause;

axis([0.05 0.5 -2 2]);

h = h/R;

outfile=fopen(filename,'wt+');
fprintf(outfile, '%1.8e\n', h(2:N+1));
fclose(outfile);

```