Friday, 10 July 2015

Other IIR all-pass Hilbert Transforms on the net

A few months ago I came across a very old post on the Hilbert Transform by +Olli Niemitalo on his blog over at iki.fi/o. At the time I was learning about the transform by reading Katja Vetter's brilliant and highly original audio tutorials on www.katjaas.nl, and she made some reference to Olli's version being superior to the old circa-1982 hilbert~ patch that comes bundled with Pure Data (Olli's is indeed far superior).

So I went over and started reading Olli's blog.

In his Hilbert post he reveals a set of coefficients, discovered by genetic algorithm, for making a parallel all-pass 8th order filter Hilbert Transformer. And actually it's pretty good - I've made a Pd implementation which I still use. I named the patch ollibert~ (sorry).

Figure 1 - Olli's coefficients in Pd


Anyway, that's what got me interested in this whole thing. Olli found his coefficients using some clever recursive let-the-computer-find-the-answer-for-me method, but I wondered if there was a more mathematical way to do it - and that led me to my (admittedly expensive, although I think more accurate) hogbert~ solution. So-named because it's fat, at least for an IIR solution.

Well, once I had Olli's coefficients I could go ahead and do some measurements in Octave and Pure Data to check how good they really are (and to have some point of reference for hogbert~).

Here are the results of that analysis.

Figure 2 - phase difference between ollibert~ outlets
As you can see from figure 2, the phase response is pretty good across a wide band between 0 and pi Hz.

Using the xyscope in Pure Data we can see exactly how wide:

Figure 3 - ollibert~ at 20Hz is ~99% accurate

The phase response is still 100*(0.496/0.5) = 99.2% accurate at 20Hz. But from there it starts to deteriorate:

Figure 4 - ollibert~ at 10Hz: phase difference is now ~0.41 pi

It's a similar story up at the higher frequencies, near Nyquist at 22030Hz (at 44100Hz SR).

Let's see what happens if we transform these coefficients in order to convert the Hilbert Transform into a Pi Transform:

Figure 5 - ollibert~ in Pi formation with pi/2 transition

That looks like a pretty decent phase response as well - you could get a good pair of low/high pass filters from that.

Now let's try to alter the transition frequency:

Figure 6 - ollibert~ in Pi formation with pi/4 transition

Now we see, unfortunately, the near-perfect phase responses beginning to deteriorate.

So we can conclude that these filter coefficients are very good for a reasonably wide-band Hilbert Transform, especially given the relatively low-order of the filters. But this comes at the price of inflexibility under transformation in the complex plane - they are not mathematically perfect.


No comments:

Post a Comment