DSPRelated.com
Forums

Hilbert transform FIR size

Started by jungledmnc August 6, 2010
On 8/8/2010 2:56 AM, Erik de Castro Lopo wrote:
> jungledmnc wrote: > >> I want to create a frequency shifter for audio. > > Are you sure you want a frequency shifter and not a pitch shifter? > Pitch shifers are much more commonly used for audio than frequency > shifters. > > Pitch shifters do: > > for all Fin : Fout = Fin * a > > which preserves the relationship between harmonics of a single note. > > Frequency shifters do: > > for all Fin : Fout = Fin + a > > which might be useful when used subtly for an audio effect, but will > not give you what you want if what you want is a pitch shifter.
In the 1950s, pitch shifting seemed out of the question. Frequency shifting by less than 5 Hz doesn't mess up voice much. Try bringing in a SSB signal using the BFO. There's a wide range that sounds "natural" if you're not familiar with the speaker's true voice. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
>On Aug 7, 8:24=A0pm, "jungledmnc" <jungledmnc@n_o_s_p_a_m.gmail.com> >wrote: >> I take it there is no simple way to compute the >> allpass coefficients, except for brute-force search. So I did it. > >exactly what? how did you search for your optimal coefs and what did >you get? > >> I wrote a >> simple app, which searches for requested number of allpass sections >> evaluating results like this: >> >> H1 =3D Hallpass_A1(z) * Hallpass_A2(z) * .. >> H2 =3D Hallpass_B1(z) * Hallpass_B2(z) * .. >> where everything is complex. |H1| =3D |H2| =3D 1 as expected. >> >> Finally phase1 =3D atan2(H1.R, H1.I) + PI/2, phase2 =3D atan2(H2.R,
H2.I)
>> Difference =3D phase1 - phase2, and some wrapping. >> Difference should be as close to 0 as possible. > >difference should be close to 0 or close to pi/2?
The PI/2 was added to phase 1 (above). I did it simply by random walk :) - random parameters repeately until it finds some "a little good" solution, then moving the parameters randomly a little searching for better solution. The question is more like, if I multiply the H(z) of each stage and take it's phase, should it represent the resulting phase shift? Or could there be a problem with the measurement by taking an impulse and FFTing the output?
Damn it, sorry for my last post, it was a bug, I accidentally added a 1
sample delay to one channel... Such a stupid mistake...

jungledmnc wrote:
> Damn it, sorry for my last post, it was a bug, I accidentally added a 1 > sample delay to one channel... Such a stupid mistake...
Jungledmnc, It is pleasure to see a person who is able to understand the problem and solve this problem, although not in a very elegant way, but quickly, efficiently and entirely by himself. Good luck with your audio work. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
On Aug 6, 5:33&#4294967295;pm, "jungledmnc" <jungledmnc@n_o_s_p_a_m.gmail.com>
wrote:
> Hi, > I want to create a frequency shifter for audio. First I need to get an > analytical signal via a hilbert transformer. I started by checking out how > long the Hilbert FIR would be. Unfortunately I ended with 20ms, which seems > to be related to -3dB at 50Hz (1/0.02). Isn't there another way to do that? > I mean 20ms is a relatively long delay for realtime processing and also 800 > taps would need relatively lots of CPU power. > > Thanks.
A detailed description of the pole-zero rotation approach to analytic signal generation using IIR described by Dr. Brackett in this thread http://groups.google.com/group/comp.dsp/msg/08d2545fde320d54?dmode=source is published in Vanbeylen, L. Schoukens, J. "Comparison of Filter Design Methods to generate Analytic Signals" Instrumentation and Measurement Technology Conference, 2006. IMTC 2006. Proceedings of the IEEE 24-27 April 2006 pp. 883 - 887
On 8/8/2010 9:22 AM, jungledmnc wrote:
> Damn it, sorry for my last post, it was a bug, I accidentally added a 1 > sample delay to one channel... Such a stupid mistake...
Congratulations on a job well done. Now that you have an answer, to the symmetries become apparent? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;

Angelito Hamm wrote:

> On Aug 6, 5:33 pm, "jungledmnc" <jungledmnc@n_o_s_p_a_m.gmail.com> > wrote: > >>Hi, >>I want to create a frequency shifter for audio. First I need to get an >>analytical signal via a hilbert transformer. I started by checking out how >>long the Hilbert FIR would be. Unfortunately I ended with 20ms, which seems >>to be related to -3dB at 50Hz (1/0.02). Isn't there another way to do that? >>I mean 20ms is a relatively long delay for realtime processing and also 800 >>taps would need relatively lots of CPU power. >> >>Thanks. > > > A detailed description of the pole-zero rotation approach to analytic > signal generation using IIR described by Dr. Brackett in this thread > > http://groups.google.com/group/comp.dsp/msg/08d2545fde320d54?dmode=source > > is published in > > Vanbeylen, L. Schoukens, J. > "Comparison of Filter Design Methods to generate Analytic Signals" > Instrumentation and Measurement Technology Conference, 2006. IMTC > 2006. Proceedings of the IEEE > 24-27 April 2006 > pp. 883 - 887
It is possible to make a Hilbert filter approximation by Greg Berchin's FDLS method as well. The result of FDLS could be further optimized numerically; this allows for making very efficient filters with non-standard structure. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Thank you people for your help. My "numerical" method is quite "simple"
indeed :), but it seems working well, and that's important!

Cheers!
On Aug 8, 9:02&#4294967295;am, "jungledmnc" <jungledmnc@n_o_s_p_a_m.gmail.com>
wrote:
> >On Aug 7, 8:24=A0pm, "jungledmnc" <jungledmnc@n_o_s_p_a_m.gmail.com> > >wrote: > >> I take it there is no simple way to compute the > >> allpass coefficients, except for brute-force search. So I did it. > > >exactly what? &#4294967295;how did you search for your optimal coefs and what did > >you get? > > >> I wrote a simple app, which searches for requested number of allpass > >> sections evaluating results like this: > > >> H1 = Hallpass_A1(z) * Hallpass_A2(z) * .. > >> H2 = Hallpass_B1(z) * Hallpass_B2(z) * .. > >> where everything is complex. |H1| = |H2| = 1 as expected. > > >> Finally phase1 = atan2(H1.R,H1.I) + PI/2, phase2 = atan2(H2.R,H2.I) > >> Difference = phase1 - phase2, and some wrapping. > >> Difference should be as close to 0 as possible. > > >difference should be close to 0 or close to pi/2? > > The PI/2 was added to phase 1 (above).
okay, i see that now. so then, is phase2 reasonably close to linear phase (a constant delay) or does that not matter? maybe a better question is if arg{H1} + pi/4 arg{H2} - pi/4 are sufficiently phase linear? just getting them to differ by pi/2 over a wide range of frequencies is an accomplishment (i would still like to see the APF coefficients) and will work for a frequency shifter, but if the residual phase is not very linear, it's like you passed the signal through an all-pass filter that is not a simple delay line before shifting the frequency.
> I did it simply by random walk :) - random parameters repeatedly until it > finds some "a little good" solution, then moving the parameters randomly a > little searching for better solution. > > The question is more like, if I multiply the H(z) of each stage and take > its phase, should it represent the resulting phase shift? Or could there > be a problem with the measurement by taking an impulse and FFTing the > output?
you should be able to do both and get comparable results.