electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » Clavia Nord Modular » G2 Building Blocks
Hilbert FIR filter
Post new topic   Reply to topic Moderators: Nord Modular Editors
Page 1 of 1 [16 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Fozzie



Joined: Jun 04, 2004
Posts: 875
Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49

PostPosted: Sun Jul 02, 2006 6:17 am    Post subject: Hilbert FIR filter
Subject description: with leslie patch as example
Reply with quote  Mark this post and the followings unread

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 Embarassed

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 Laughing ). 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 Laughing

Enjoy.


HilbertLeslie_PV.pch2
 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:  1762 Time(s)

Back to top
View user's profile Send private message
Fozzie



Joined: Jun 04, 2004
Posts: 875
Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49

PostPosted: Sun Jul 02, 2006 6:50 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Sun Jul 02, 2006 7:26 am    Post subject: Reply with quote  Mark this post and the followings unread

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.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Fozzie



Joined: Jun 04, 2004
Posts: 875
Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49

PostPosted: Sun Jul 02, 2006 7:52 am    Post subject: Reply with quote  Mark this post and the followings unread

Sure, but I have also done a lot of googling on music-dsp archives and other pages of which I didn't keep track. So here's a selection:

http://en.wikipedia.org/wiki/Hilbert_transform the obvious
http://www.techonline.com/pdf/pavillions/icspat/1999/w236.pdf I think I had to register for that one
Chick here
and I had seen it before but couldn't find anything other than a PS file, but here's a pdf (I just found it and haven't read yet): Click here

[editor's note: made long links short so the pages aren't too wide. --mosc]
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Sun Jul 02, 2006 7:54 am    Post subject: Reply with quote  Mark this post and the followings unread

Thanks !
_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Fozzie



Joined: Jun 04, 2004
Posts: 875
Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49

PostPosted: Sun Jul 02, 2006 8:09 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Fozzie



Joined: Jun 04, 2004
Posts: 875
Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49

PostPosted: Sun Jul 02, 2006 2:05 pm    Post subject: Reply with quote  Mark this post and the followings unread

Only the sad & lowly post many times in their own thread Laughing

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 Shocked
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Sun Jul 02, 2006 4:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

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 Very Happy

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Fozzie



Joined: Jun 04, 2004
Posts: 875
Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49

PostPosted: Tue Jul 04, 2006 2:23 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Tue Jul 04, 2006 2:53 am    Post subject: Reply with quote  Mark this post and the followings unread

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.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Fozzie



Joined: Jun 04, 2004
Posts: 875
Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49

PostPosted: Tue Jul 04, 2006 3:01 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Fozzie



Joined: Jun 04, 2004
Posts: 875
Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49

PostPosted: Tue Jul 04, 2006 3:07 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Fozzie



Joined: Jun 04, 2004
Posts: 875
Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49

PostPosted: Tue Jul 04, 2006 10:15 am    Post subject: Reply with quote  Mark this post and the followings unread

I don't get it; I have tried to get the quadratic oscillators (90 degrees difference) right using the PLL circuit and using my triangle trick, but it still doesn't work.
I've checked that the PLL circuit works by putting two of them in line, and the third osc cancels the first one out, confirming a 90 degree phase shift per PLL circuit. Using it in the weaver method, it works fine with 0 frequency shift (original signal comes through), but as soon as I start to modulate any frequency (in any way) to get a frequency shift, I get just wobbling/beating and sort-of ring modulation.
I stripped the patch to the essentials; maybe someone can have a look to see whether I did something stupid.

BTW: this patch seems particularly sensitive to the 'add a module and your sound changes drastically' syndrome. I've included a sync button for all quadratic oscs, but it doesn't go away. Strange.


WeaverSSB_RH_G2implementationIII[1].pch2
 Description:
Weaver won't work and I wouldn't know why

Download
 Filename:  WeaverSSB_RH_G2implementationIII[1].pch2
 Filesize:  1.78 KB
 Downloaded:  1440 Time(s)

Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Tue Jul 04, 2006 12:37 pm    Post subject: Reply with quote  Mark this post and the followings unread

I tried it with PM oscillators and tracking filters, this seems to sort of work to me.

I tried your PLL quadrture as well, but it seemed to be unstable somehow. I tried an XOR as well as the phase comparator, which seemed slightly better. But I did not really try the frequency shifter with it.

Weaver SSB frequency shifting, see http://www.cim.mcgill.ca/~clark/nordmodularbook/nm_spectrum_shift.html


wvr SSB F shift.pch2
 Description:
Weaver SSB frequency shifting, see URL posted in forum topic

Download
 Filename:  wvr SSB F shift.pch2
 Filesize:  2.02 KB
 Downloaded:  2328 Time(s)


_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Fozzie



Joined: Jun 04, 2004
Posts: 875
Location: Near Wageningen, the Netherlands
Audio files: 8
G2 patch files: 49

PostPosted: Tue Jul 04, 2006 2:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Tue Jul 04, 2006 3:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

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 Very Happy

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.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Nord Modular Editors
Page 1 of 1 [16 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » Clavia Nord Modular » G2 Building Blocks
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use