Author |
Message |
Fozzie
Joined: Jun 04, 2004 Posts: 875 Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49
|
Posted: Sun Jul 02, 2006 6:17 am Post subject:
Hilbert FIR filter Subject description: with leslie patch as example |
|
|
Lazy sundays are good! Patching in the shade at 30ish degrees celsius in the garden, can you ask for more?
I have been reading up on the Hilbert transformation, at first because of an interest in DIY envelope followers (I ran across some music-dsp discussions that mention this transform as usefull in env followers; as G2Ian also mentioned in one of the discussion over here about the missing +/- 90 degrees phase outputs on the frequency shifter module after v1.0). I saw that this transform can also be used for frequency shifting (duh) and did some patching to implement that in a DIY way on the G2.
The Hilbert transformation yields a signal that is 90 degrees shifted in phase compared to the input signal. A common way to implement such a filter in discreet (digital) signals is to use a FIR filter of uneven length, in which all even taps have a coefficient of 0 (they are not used) and all odd taps have non-zero coefficients that are symmetrical around the middle tap of the filter, and that should be in theory 2/pi, 2/3pi, 2/5pi, 2/7pi etc for taps +1, +3, +5, +7 etc from the middle tap and the inverse of these gains at taps -1, -3, -5, -7 etc. I have scaled the gains in this patch as good as possible using a few gain stages to get more precision. My version of this filter is quite long, to get the best musical fidelity, but of course this takes a lot of dsp. Shorter versions can also be made, but as this type of FIR filter is effectively a band-pass filter it should be as long as possible for best results.
The inverse halfs of the FIR filter are combined and mixed with the original signal; using an LFO with cosine and sine modulation of both signals through a VCA. Using this setup, the LFO speed determines the frequency shift. BTW, don't ask me to explain why this is so, I just copied the strategy from an online article
Of course, I don't have all this wisdom from myself, so if I made a mistake somewhere please correct me. I know that for correctness actually the filter should begin with a zero-tap, but in my patch it starts with a non-zero tap. However, I couldn't hear a difference on my laptop so I left it like this.
As I was testing and messing around with this stuff, I noticed the spaciousness of the sound just coming from my crappy laptop speakers when implementing a leslie-kind of application from this Hilbert stuff. The concept is really simple, just take the up- and down-shifted parts and hard-pan the signals. Added some simple controls to it.
Feel free to take the Hilbert part and make a spiffy envelope follower (G2ian?) and/or make a nice DIY compressor patch (otherwise it'll take me even more free time to do those experiments myself ). For pure frequency shifting the ready-to-use module is probably better and certainly more efficient, but you can't mess around in the inner mechanics. This patch allows a lot of destructive creativity
Enjoy.
Description: |
The amazing FozzieLeslie :). Patch to demonstrate the DIY Hilbert transformation on the G2 and Leslie-like effect in its own right. |
|
Download |
Filename: |
HilbertLeslie_PV.pch2 |
Filesize: |
3.38 KB |
Downloaded: |
1763 Time(s) |
|
|
Back to top
|
|
|
Fozzie
Joined: Jun 04, 2004 Posts: 875 Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49
|
Posted: Sun Jul 02, 2006 6:50 am Post subject:
|
|
|
Regarding envelope following: I found somewhere that the magnitude of the signal (=envelope?) is the output of the square root of (HilbertFIR^2 + output of the middle tap^2). However, that doesn't seem to work well if I try to do ^2 by putting the signal into both vca ins and use a square root device designed by Michael Estlick on the NM and ported by Blue Hell http://www.electro-music.com/forum/topic-5153.html&highlight=square+root
Any ideas?
edit: it might have been a clipping problem in the squaring.....I'll report back after more testing.... |
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Sun Jul 02, 2006 7:26 am Post subject:
|
|
|
Intereresting !
Do you have some URL's for me to read up a bit on this ?
No garden here, but shade nevertheless, and I'm glad there is some wind to cool me down. _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
Fozzie
Joined: Jun 04, 2004 Posts: 875 Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49
|
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Sun Jul 02, 2006 7:54 am Post subject:
|
|
|
Thanks ! _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
Fozzie
Joined: Jun 04, 2004 Posts: 875 Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49
|
Posted: Sun Jul 02, 2006 8:09 am Post subject:
|
|
|
Another digital Hilbert implementation is a construction which uses two parallel 6th-order allpass filters. Problem is, I have no clue yet how to design those. |
|
Back to top
|
|
|
Fozzie
Joined: Jun 04, 2004 Posts: 875 Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49
|
Posted: Sun Jul 02, 2006 2:05 pm Post subject:
|
|
|
Only the sad & lowly post many times in their own thread
I should be reading my classics more:
http://www.cim.mcgill.ca/~clark/nordmodularbook/nm_spectrum_shift.html
Of course Rob has already written an extensive chapter about this issue. I'll be testing a few of the details and ideas that are given there, and post even more here |
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Sun Jul 02, 2006 4:33 pm Post subject:
|
|
|
Maybe this will make you feel less lowly, I had totally forgoten about the James Clark book as well, and yet on reading chapter 13 I realised I had been there before, probably I had missed the "Hilbert" word on that occasion (and it's in it only once, while it really should be a key word).
Tried to read up a bit on the math, pretty complex, should have done that when I was 20 or so I guess, preferably with some external pressure like exams, and not on a hot summer's day while nearing 50.
Still, it's interesting to read how Fourier and Hilbert transformas are related and what role convolution has in that. But don't ask me to explain it please _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
Fozzie
Joined: Jun 04, 2004 Posts: 875 Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49
|
Posted: Tue Jul 04, 2006 2:23 am Post subject:
|
|
|
Well, I've tried a few things but found no improvement. Rob describes a Weaver SSB technique in the nord modular book, but that didn't seem to work good with my G2-translation skills.
In this Weaver technique, two x two very fast sine/cosine generators are needed, in which each pair has a precise 90 degree phase shift (hence sine/cosine; aka quadratic sine generators). I tried to implement this on the G2 by using the syncpoint of a squarewave and of a trianglewave fed into the sync-in of two sinus oscillators, all with the same frequency. To my limited knowledge the sync point of a triangle osc is at 1/4 of the duty cycle and the square at the beginning of course, yielding a 90 degrees difference hence making it a sine/cosine pair (G2 osc have no precise phase control, lfo's only go to ~400Hz; kHz range is needed). I also synced the triangle from the square osc, so all phase-relations should be fixed properly.
To be brief: it didn't work at all, I mainly got distorted/fluctuating ring mod effects.
I also tried to make two identical chains of allpass filters, by using the idea that the phaseshift of an allpass is 90 degrees at cutoff, and using the second chain of allpasses to give another 90 degrees shift. Probably the difference in time delays messed everything up, or this method is too imprecise. Anyway, it didn't work. Same with adding delay lines at 1/4 length of the cutoff frequency of the allpasses (analogous to Rob's bandpass approach in the NM book); nothing good.
My math abitilies do not allow me to properly design allpass networks with the right coefficients, and my intuitive approaches as mentioned above didn't work either. Anyone have a better ideas? |
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Tue Jul 04, 2006 2:53 am Post subject:
|
|
|
Didn't the same article speak about a Phase Locked Loop technique to make the quadrature oscillator. The idea being that you multiply the sine and cosine oscillator's outputs to do FM on one of them ?
Maybe I saw it somewhere else.
The sync points for the oscs are always at the start of the waveform I think. _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
Fozzie
Joined: Jun 04, 2004 Posts: 875 Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49
|
Posted: Tue Jul 04, 2006 3:01 am Post subject:
|
|
|
I experimented with that PLL system shortly, but I also didn't get it to work. I haven't tested it thoroughly, however. It could very well be that my PLL circuit wasn't PLL after all.
The sync input reacts on a 'negative or zero value' to 'any positive value', doesn't it? It is an input with an upward arrow next to it. As an triangle rises from -64 to +64 in half a period, it should arrive at the syncpoint at 1/4 of the duty cycle if my assumptions are correct. Therefore, I thought that if I sync a triangle to a square, they both start at 0 degrees (in phase). Now take the square to sync a sine osc (also at 0 degrees) and use the triangle to sync at 90 degrees. That's what I thought anyway. |
|
Back to top
|
|
|
Fozzie
Joined: Jun 04, 2004 Posts: 875 Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49
|
Posted: Tue Jul 04, 2006 3:07 am Post subject:
|
|
|
Jan, you were right. The waveform syncs at it's zero point, so the triangle doesn't start at it's lowest value as the waveform image suggests.
Quote: | The oscillator will restart whenever the syncing signal on this input goes from a negative to a positive amplitude value. Waveforms with a flank, like the sawtooth or pulse waveforms, will restart at a flank, while waveforms without a flank like the sine and triangle waveforms will restart at a zero value.
|
Edit / followup: I'll make another patch when I get home this afternoon in which I use a similar syncing strategy, but unstead of using the triangle osc as a direct sync signal, use a valuedetect module on it with value=64, and use the logic out as a +90 degrees sync signal. Should work. |
|
Back to top
|
|
|
Fozzie
Joined: Jun 04, 2004 Posts: 875 Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49
|
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
|
Back to top
|
|
|
Fozzie
Joined: Jun 04, 2004 Posts: 875 Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49
|
Posted: Tue Jul 04, 2006 2:53 pm Post subject:
|
|
|
Thanks, Jan, for the patch. I tried it and it is indeed smoother than my patch. Still, if you put a sawtooth into it, there is no proper frequency shift. You can hear things going up an down at the same time, which probably means that sideband suppression of the unwanted sideband doesn't work 100%.
Strange things happen to oscillators however, in my original pll patch the pll seemed to be pretty stable UNTIL you put a cable into either of the pitch inputs. Even when the cable was 'empty' (0 value), it messed things up. Weird, isn't it? |
|
Back to top
|
|
|
blue hell
Site Admin
Joined: Apr 03, 2004 Posts: 24079 Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320
|
Posted: Tue Jul 04, 2006 3:16 pm Post subject:
|
|
|
Fozzie wrote: | Even when the cable was 'empty' (0 value), it messed things up. Weird, isn't it? |
I noticed similar things ... pretty weird indeed and don't know what to make from it. bug or feature ?
Maybe the sawtooth has too many harmonics, it seems to work better with closing the filters (the ones in the shifter circuit). I just made a patch that does frequency jumps on a percussion oscillator, that is sort of nice to listen to.
Also the PLL filtering and the feedback amount needs carefull tuning, the whole thing easily breaks up into noise. Quite interesting noise sometimes with bifurcation like features
Think it would be useful to watch some signals on a scope to see what is going on. _________________ Jan
also .. could someone please turn down the thermostat a bit.
|
|
Back to top
|
|
|
|