hilbert~ (or freqshift~) in Gen?
Hi all,
I am trying to add a frequency shifter to the effect chain I'm working on within gen~. Unlike MSP, I couldn't find a dedicated operator. Looking at the reference for freqshift~ [https://cycling74.com/docs/max5/refpages/msp-ref/freqshift~.html] a DIY frequency shifter seems pretty feasible, except for the hilbert~ part. My knowledge of DSP is pretty rudimentary, what would be a solution to recreate the Hilbert transform within gen~? Using a codebox?
Any help/hints/suggestions/best practices would be much appreciated!
Cheers,
Alessio
hi.
i did all this in GenExpr quite a while ago, so cannot vouch for it being any good, but maybe it will be useful to you as a start.
i put it in a demo patch for you (patch based on the [hilbert~] helpfile), attached.
hth.
Thanks for your help! I'll check it out as soon as I have some time, it's definitely great to have a starting point.
this one is better
Stkr (or anyone knowledgeable), I'm wondering: Are these biquad coefficient non-dependant on sampling rate? I've never seen that before but I'm filter-stupid.
very nice stkr. Any thought on how to filter out the frequencies that bounce back up from 0Hz. If I have a sine with 50Hz and I set the modulation frequency to -100Hz I get a bounce back to 50Hz. Is there a way to avoid this?
so apparently this behaviour is called "through zero shifting" in the modular world which results in the negativ frequency. It's a cool effect, but I'd rather have a Shifter without through zero capabilities.
Any hints on how to modify this example?
aha. i should check my posts at less than 8 year intervals, sorry.
@audiomatt, you are absolutely right. these should be samplerate dependent. the funny thing i found out on my travels is that in hilberts the difference is quite small so that everyone (see Max, CSound, Reaktor, etc) seems to ignore this, as it would add so much expense, but i think that is bad so i have since made a better version with coefficients depending on samplerate - i'll see if i can dig it out. the coeffs are done in javascript if i remember so not so useful for gen~only usage.
@beardedclumsybear, i guess i always felt the through zero was the whole point :-) . i must admit, i'd really have to think about this, so no help here right now i am sorry. if anyone has any ideas i'd be very interested.
no problem and thanks for replying.
Yeah, after reading up more it seems that through zero shifting is a desirable effect. Anyway, for my use case it would not work. Others suggested to filter the signal that will bounce back (negative frequency) before the shifting takes place to avoid it.
I tried that, but with no success. just filtering the signal before it gets shifted did not get rid of the negative frequency.
Any help or suggestion would be welcome :)