Page 3 of 4

Re: Hilbert Shifter

PostPosted: Tue Jan 06, 2015 9:20 pm
by adamszabo
so what can you use that for? :)

Re: Hilbert Shifter

PostPosted: Tue Jan 06, 2015 9:49 pm
by KG_is_back
adamszabo wrote:so what can you use that for? :)

For example phase alignment of two microphones/pickups put on same source. Naturally, when you have two sounds, you expect the sum of them to be the "sum" of their volumes at all the frequencies. That is the case only if their phases are properly aligned - and that is not just a matter of time alignment. For example dynamic and condenser microphones are generally 90° out of phase, simply because they generate signal by different principle.

With phase alignment tool that has 360° radius (and not just simple 0/180°phase flipping) you can put them in phase much closer. The summing of such sources will then sound much more natural.

Another use is exact opposite - creating stereo imagery. I have used this before - you can create false stereo effect by shifting the phase of one channel of mono signal (that is converted to stereo). Because the phase shift is identical across the spectrum, the sum of the two channels sounds identical to original. So it sounds similar to Haas effect (delaying one channel by <40ms), but without the nasty comb filtering when converted to mono.

Re: Hilbert Shifter

PostPosted: Wed Jan 07, 2015 12:34 am
by adamszabo
Ah interesting makes sense! Thanks for the info

Re: Hilbert Shifter

PostPosted: Fri Jan 09, 2015 10:44 pm
by cbbuntz
Martin - Yes, that's what I meant when I said the impulse response looked very good! Pretty cool, huh?! It still looks pretty good with Olli's coefficients, but it has much better symmetry with yours.

I'm not sure of a good way to make complex poles out of this structure. I've been trying to figure that out. Stanford has a paper on making efficient linear phase truncated IIR filters, but I don't understand all the heavy math notation. Let me know if you understand any of this paper.

https://ccrma.stanford.edu/~jos/pdf/tiir.pdf

There's one thing I've found that sort of works. You can multiply the input signal by a complex oscillator, then filter it and complex multiply it again after the filter and this give you control of the cutoff frequency and the resonant frequency. It doesn't behave quite like complex poles. Essentially your cutoff controls the DFT window size/shape and the oscillator controls the frequency of interest. In practice, it behaves a bit like a moog style ladder filter but the standard math for complex poles doesn't work. It's pretty cool if you want to compute a DFT at a specific frequency though. You can use this method with any type of lowpass filter.

I used this method to make a harmonic analyzer for helping somebody test guitar pedals. It would generate a sine at a specific frequency and analyze the first 16 harmonics. I used regular lowpass filters (I think I chained a few for a quasi gaussian window). It worked great!

Since we are on the topic of HIlbert transforms, I stumbled on something cool. You can use it to generate harmonics without DC offset for even polynomials and you can auto-normalize the harmonics.

Let's call the outputs a and b.

pow = a*a+b*b
rms = sqrt(pow)

x1 = a
a2 = a*a-b*b
b2 = a*b+a*b
x2 = a2 / rms

a3 = a2*a-b2*b
b3 = a2*b+b2*a
x3 = a3 / pow

Since the denominator is always 1 power less, the polynomial has the same volume as the input (e.g. x^3/x^2 = x). You can blend the harmonics organ style! I think it's much better for simple harmonic generation than using Chebyshev polynomials. Since the hilbert shifter you made has such good performance, the harmonics are very pure. Also notice that inputting two frequencies a fifth apart into the second harmonic, the intermodulation generates a sub octave of the root. This happens normally with 2nd harmonic distortion, but it's very pronounced using this. You could also shift the phase of the harmonics if you wanted to for some reason.

Re: Hilbert Shifter

PostPosted: Sat Jan 10, 2015 8:36 am
by cbbuntz
I fixed up the harmonic generator a bit and I realized something. A complex square root is a subharmonic! You have to tell it to flip polarity every 180 degrees because the low harmonic is full wave rectified. I also made a 1.5 harmonic from it too! This complex waveform harmonic generation is really cool.

The subharmonic generator actually is working really well on mixes too! It's not too different from the way Waves LoAir sounds. You need to lowpass the signal to prevent intermodulation. I stuck an 8 pole ladder filter in the schematic to prevent odd behaviors, but I threw the filter together without much thought (the res control is not "correct"). I actually compared it to Waves LoAir and it's hard to tell the difference with the right settings. I'm not sure what method they use.

Anyway, this one has harmonics 1-6 in addition to 0.5 and 1.5. 1.5 sounds...interesting. Oddly, it's 3/2 power curve that is responsible for a lot of triode harmonics (something like x * sqrt(1 + x) will get you in the ballpark), but it sounds VERY different with complex polynomials. x^(3/2) has monotonically decaying harmonics while this one produces the fifth of the fundamental.

There are a lot of max/min functions in there to prevent div by 0 and NaNs from negative square roots etc. It could probably be cleaned up a lot, but it works as a proof of concept. There's probably a more correct way to un-rectify the subharmonic (perhaps using atan(im/re) to keep up with phase?) There's probably some weird code in there from me trying things out of the fly.

Re: Hilbert Shifter

PostPosted: Sun Jan 11, 2015 5:13 am
by cbbuntz
Here's an endless / Shepard tone phaser I made with the hilbert transform. I added an "insanity" mode which self oscillates with tanh saturation in the feedback and a "spaceship" mode that adds a delay to the feedback.

Re: Hilbert Shifter

PostPosted: Wed Jan 14, 2015 8:59 pm
by mHz
That's what they are for, right? Endless Hilbert transform phaser sounds nice, should make it into a vst.

Re: Hilbert Shifter

PostPosted: Mon Jul 13, 2015 12:59 pm
by borodadada
Guys, in this example - endless phaser stereo.fsm great phase shift, but i dont understand how it work, code in assambler. Where is i find example 16 order Hilbert shift on Flowstone code? I have example 8 order, but 16 real better.

Re: Hilbert Shifter

PostPosted: Mon Jul 13, 2015 6:54 pm
by martinvicanek
The Hilbert shifter in the example does have 16 poles (8 for each arm). Here is a schematic to demonstrate the filter structure: download/file.php?id=4093

Re: Hilbert Shifter

PostPosted: Mon Jul 13, 2015 7:18 pm
by borodadada
Big thank you! Work. As I understand it possible any longer? How do you expect the coefficients ?