# Designing IIR hilbert transform pair

Started by November 18, 2004
```I'm looking at designing a pair of all-pass filters whose outputs are 90 degrees
phase shifted from each other.  The purpose is to create an analytic signal but
avoid the processing required for the true FIR-based Hilbert filter, which is
quite large for wide-band audio signals (e.g. 20-20kHz, 48kHz sample rate).
I've read a few descriptions of the process, but am still a bit fuzzy on how to
actually go about it.  There usually is a step about rotating the poles/zeros in
the z-planes that confuses me.

I think the procedure goes something like this:

1. Design an approximate IIR low-pass filter.  (What cut-off?  What criteria
makes a "good" filter?)

2. Transform this into a complex band-pass filter. (How?)

3. Convert into a pair of real band-pass filters such that the phase difference
is 90 degrees. (How?)

Can anyone provide a clear explanation of this?  Matlab code would be ideal.  Or
pre-cooked filter values/coefficients.  I've seen Olli's version
http://www.biochem.oulu.fi/~oniemita/dsp/hilbert/, but would ideally like to
have better results, and can spare the computation for additional all-pass
sections.

Also, I'm curious as to what effect the imperfect phase offset has the overall
algorithm (e.g. Olli's filter has a +/-0.7 degree deviation from the ideal of
90).  The eventual goal is to create a frequency shifter.

-Jon

```
```in article 304ho6F2rc983U1@uni-berlin.de, Jon Harris at
goldentully@hotmail.com wrote on 11/18/2004 16:15:

> I'm looking at designing a pair of all-pass filters whose outputs are 90
> degrees
> phase shifted from each other.  The purpose is to create an analytic signal
> but
> avoid the processing required for the true FIR-based Hilbert filter, which is
> quite large for wide-band audio signals (e.g. 20-20kHz, 48kHz sample rate).
> I've read a few descriptions of the process, but am still a bit fuzzy on how
> to
> actually go about it.  There usually is a step about rotating the poles/zeros
> in
> the z-planes that confuses me.
>
> I think the procedure goes something like this:
>
> 1. Design an approximate IIR low-pass filter.  (What cut-off?  What criteria
> makes a "good" filter?)
>
> 2. Transform this into a complex band-pass filter. (How?)
>
> 3. Convert into a pair of real band-pass filters such that the phase
> difference
> is 90 degrees. (How?)
>
> Can anyone provide a clear explanation of this?  Matlab code would be ideal.
> Or
> pre-cooked filter values/coefficients.  I've seen Olli's version
> http://www.biochem.oulu.fi/~oniemita/dsp/hilbert/, but would ideally like to
> have better results, and can spare the computation for additional all-pass
> sections.
>
> Also, I'm curious as to what effect the imperfect phase offset has the overall
> algorithm (e.g. Olli's filter has a +/-0.7 degree deviation from the ideal of
> 90).  The eventual goal is to create a frequency shifter.

i don't think you can do what you wanna do with IIR all-pass filters.  not
for a broad range of frequencies, anyway.

--

r b-j                  rbj@audioimagination.com

"Imagination is more important than knowledge."

```
```"robert bristow-johnson" <rbj@audioimagination.com> wrote in message
news:BDC2B3AC.200F%rbj@audioimagination.com...
> in article 304ho6F2rc983U1@uni-berlin.de, Jon Harris at
> goldentully@hotmail.com wrote on 11/18/2004 16:15:
>
> > I'm looking at designing a pair of all-pass filters whose outputs are 90
> > degrees
> > phase shifted from each other.  The purpose is to create an analytic signal
> > but
> > avoid the processing required for the true FIR-based Hilbert filter, which
is
> > quite large for wide-band audio signals (e.g. 20-20kHz, 48kHz sample rate).
> > I've read a few descriptions of the process, but am still a bit fuzzy on how
> > to
> > actually go about it.  There usually is a step about rotating the
poles/zeros
> > in
> > the z-planes that confuses me.
> >
> > I think the procedure goes something like this:
> >
> > 1. Design an approximate IIR low-pass filter.  (What cut-off?  What criteria
> > makes a "good" filter?)
> >
> > 2. Transform this into a complex band-pass filter. (How?)
> >
> > 3. Convert into a pair of real band-pass filters such that the phase
> > difference
> > is 90 degrees. (How?)
> >
> > Can anyone provide a clear explanation of this?  Matlab code would be ideal.
> > Or
> > pre-cooked filter values/coefficients.  I've seen Olli's version
> > http://www.biochem.oulu.fi/~oniemita/dsp/hilbert/, but would ideally like to
> > have better results, and can spare the computation for additional all-pass
> > sections.
> >
> > Also, I'm curious as to what effect the imperfect phase offset has the
overall
> > algorithm (e.g. Olli's filter has a +/-0.7 degree deviation from the ideal
of
> > 90).  The eventual goal is to create a frequency shifter.
>
> i don't think you can do what you wanna do with IIR all-pass filters.  not
> for a broad range of frequencies, anyway.

Actually, using Olli's filters, it seems to be working quite well in the audio
band.  Suppression at some frequencies is only 30dB or so due to (I think) the
imperfect 90 degree phase shift, but except for listening to pure tones, this is
not really audible.  It's not a true Hilbert transform, in that neither the I or
Q components have the same phase as the original, but instead the 2 outputs are
90 degrees shifted from each other.  In other words, it's not linear phase.

```
```in article 3052nrF2qisqnU1@uni-berlin.de, Jon Harris at
goldentully@hotmail.com wrote on 11/18/2004 21:05:

> "robert bristow-johnson" <rbj@audioimagination.com> wrote in message
> news:BDC2B3AC.200F%rbj@audioimagination.com...
>>
>> i don't think you can do what you wanna do with IIR all-pass filters.  not
>> for a broad range of frequencies, anyway.
>
> Actually, using Olli's filters, it seems to be working quite well in the audio
> band.  Suppression at some frequencies is only 30dB or so due to (I think) the
> imperfect 90 degree phase shift, but except for listening to pure tones, this
> is
> not really audible.  It's not a true Hilbert transform, in that neither the I
> or
> Q components have the same phase as the original, but instead the 2 outputs
> are
> 90 degrees shifted from each other.  In other words, it's not linear phase.

i guess i shoulda looked at Olli's webpage first.  i've used APFs to
approximate a constant delay, i just didn't think i could use them to
approximate constant phase over any broad band (they have to start at 0 and
end at -pi/2 * order).  thanks for making me trade some ignorance (as face)
for integrity.

still skeptical, but i'll read the damn thing first.

r b-j

```
```"robert bristow-johnson" <rbj@audioimagination.com> wrote in message
news:BDC2E093.2021%rbj@audioimagination.com...
> in article 3052nrF2qisqnU1@uni-berlin.de, Jon Harris at
> goldentully@hotmail.com wrote on 11/18/2004 21:05:
>
> > "robert bristow-johnson" <rbj@audioimagination.com> wrote in message
> > news:BDC2B3AC.200F%rbj@audioimagination.com...
> >>
> >> i don't think you can do what you wanna do with IIR all-pass filters.  not
> >> for a broad range of frequencies, anyway.
> >
> > Actually, using Olli's filters, it seems to be working quite well in the
audio
> > band.  Suppression at some frequencies is only 30dB or so due to (I think)
the
> > imperfect 90 degree phase shift, but except for listening to pure tones,
this
> > is
> > not really audible.  It's not a true Hilbert transform, in that neither the
I
> > or
> > Q components have the same phase as the original, but instead the 2 outputs
> > are
> > 90 degrees shifted from each other.  In other words, it's not linear phase.
>
> i guess i shoulda looked at Olli's webpage first.  i've used APFs to
> approximate a constant delay, i just didn't think i could use them to
> approximate constant phase over any broad band (they have to start at 0 and
> end at -pi/2 * order).  thanks for making me trade some ignorance (as face)
> for integrity.
>
> still skeptical, but i'll read the damn thing first.

You probably already know this, but just to clarify, the APFs don't generate a
constant phase shift.  Rather, the pair of APFs generate a constant phase
_difference_, i.e. phase(filter 1) - phase(filter 2) ~= 90 degrees across a wide
band.

```
```robert bristow-johnson wrote:

...

> still skeptical, but i'll read the damn thing first.

I wouldn't be skeptical. I've designed cascaded analog all-passes that,
with 3 turnovers per chain provide quadrature relative shifts better
than a quarter degree over about a decade. To make them work, time
constants need to be accurate and stable to three significant digits, so
a greater bandwidth isn't practically obtainable. It wouldn't surprise
me if a digital implementation turned out to benefit greatly from a
higher sampling rate than the system otherwise needs, but audio seems to

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```Jerry Avins <jya@ieee.org> wrote in message news:<306soqF2the67U1@uni-berlin.de>...
> robert bristow-johnson wrote:
>
>   ...
>
> > still skeptical, but i'll read the damn thing first.
>
> I wouldn't be skeptical. I've designed cascaded analog all-passes that,
> with 3 turnovers per chain provide quadrature relative shifts better
> than a quarter degree over about a decade. To make them work, time
> constants need to be accurate and stable to three significant digits, so
> a greater bandwidth isn't practically obtainable. It wouldn't surprise
> me if a digital implementation turned out to benefit greatly from a
> higher sampling rate than the system otherwise needs, but audio seems to
> be heading that way anyhow.
>
> Jerry

I've gone through this a few times in the past. I always end up using
an optimizer that wiggles the APF frequencies of the two parallel
filter-banks to get the minumum amount of error. Here's a cute trick;
if your optimizer only can deal with trying to match a target
frequency response (which is common), add the outputs of the two
filter chains together. If they are truly 90-degrees out of phase over
a broad frequency range, then they will sum to +3dB over this
frequency range. The phase errors then show up as frequency-response
wiggles, so you can just set the target frequency response of your
optimizer to +3dB, and you will get the right answer. Of course you
need to start the optimization with something that isn't too far off,
which usually means interleaving the zero locations.