If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding premade modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
Hilbert Shifter
35 posts
• Page 2 of 4 • 1, 2, 3, 4
Re: Hilbert Shifter
Yes, same structure but higher degree. I'll post a non optimized schematic tomorrow, hopefully easier to understand.
 martinvicanek
 Posts: 664
 Joined: Sat Jun 22, 2013 8:28 pm
Re: Hilbert Shifter
Here you go. Notice that Olli Niemitalo's coefficients enter squared.
 Attachments

 HilbertFilterStructure.fsm
 (3.75 KiB) Downloaded 235 times
 martinvicanek
 Posts: 664
 Joined: Sat Jun 22, 2013 8:28 pm
Re: Hilbert Shifter
Thanks. I'm not sure where I went wrong. I've noticed you get significantly better performance on Olli's version if you square the coefficients before converting to 32 bit. I have a version of his that is close to linear phase (as in all frequencies 90 degrees) using a backwards IIR with one half of the coefficients and normal allpass with the other half. I post it here if I get it working. It could use some optimization.
The backwards filter is something I came up with. It is made by a series of delays spaced at powers of 2. For every power of 2 delay, the coefficient is squared. You can also use a similar method to make lowpass filters with low cutoffs with quite low roundoff error. Here's a version of Olli's coefficients.
The backwards filter is something I came up with. It is made by a series of delays spaced at powers of 2. For every power of 2 delay, the coefficient is squared. You can also use a similar method to make lowpass filters with low cutoffs with quite low roundoff error. Here's a version of Olli's coefficients.
 Attachments

 Hilbert transform with BW filters.fsm
 (8.72 KiB) Downloaded 198 times
 cbbuntz
 Posts: 10
 Joined: Sat May 07, 2011 5:50 pm
Re: Hilbert Shifter
Here are some more examples of stuff with that filter structure. I've got lots of different versions of it (some of them rather old) and I didn't test them before uploading but I think they should work fine. I made a simplified example so that it would be easier to follow what I'm doing.
One advantage of this filter structure is that you can do backwards filters without reversing windows, and since it only contains log 2 n summations, rounding error should be reduced. A disadvantage is that you are limited to 1st order filters (maybe there's a way to do complex poles, but I haven't found anything that works well). I really could use some help optimizing this. A while back I tried making a version with a single array and I never got it to behave right and the code got really messy. It would be simple if there was a way to shift array indices.
One advantage of this filter structure is that you can do backwards filters without reversing windows, and since it only contains log 2 n summations, rounding error should be reduced. A disadvantage is that you are limited to 1st order filters (maybe there's a way to do complex poles, but I haven't found anything that works well). I really could use some help optimizing this. A while back I tried making a version with a single array and I never got it to behave right and the code got really messy. It would be simple if there was a way to shift array indices.
 Attachments

 BW filter.fsm
 (63.29 KiB) Downloaded 190 times
 cbbuntz
 Posts: 10
 Joined: Sat May 07, 2011 5:50 pm
Re: Hilbert Shifter
Hi cbbuntz,
any lecture for your Backwards filter technique?
any lecture for your Backwards filter technique?
 Tronic
 Posts: 553
 Joined: Wed Dec 21, 2011 12:59 pm
Backwards FIlter Structure
Hey cbbuntz,
thanks for sharing your stuff, although I must admit that I have absolutely no clue how your filter works, even after spending quite a while with your schematic. All I can say that your mixed phase crossover does work, the bands split nicely at the correct frequencies and they add up to unity. Very cool!
There is room for optimization, though. Regarding delays check out KohuGaly's post in the Downloads section at Flowstone Guru. tan(x) etc. can be evaluated much faster, check out my Math Functions download at FS Guru.
I am still intrigued by your schematic, it is clear that you have put a lot of brains and effort into it, however I don't even understand the very basic idea behind it. Please could you explain, or point to a reference?
thanks for sharing your stuff, although I must admit that I have absolutely no clue how your filter works, even after spending quite a while with your schematic. All I can say that your mixed phase crossover does work, the bands split nicely at the correct frequencies and they add up to unity. Very cool!
There is room for optimization, though. Regarding delays check out KohuGaly's post in the Downloads section at Flowstone Guru. tan(x) etc. can be evaluated much faster, check out my Math Functions download at FS Guru.
I am still intrigued by your schematic, it is clear that you have put a lot of brains and effort into it, however I don't even understand the very basic idea behind it. Please could you explain, or point to a reference?
 martinvicanek
 Posts: 664
 Joined: Sat Jun 22, 2013 8:28 pm
Re: Hilbert Shifter
I made a new one with your 16th order coefficients and I optimized the filter with asm. The impulse response looks very "correct" with your coefficients and the CPU hit is nearly 1/4th of what it was! I modified the code from one of the optimized delay code generators.
I'm glad you like the crossover. I found it pretty cool that a 3rd order Butterworth with the 1st order section backwards behaves like a 1st order filter in terms of phase response, so you can get complimentary hp/lp sections my simply subtracting the input from the filter.
I realized my simplified example was wrong after I uploaded it. Each delay needs to be summed before the next delay is applied. My filter takes advantage of the fact that in an exponential decay, the decay is squared. Let's say the decay is 0.5, and I use the forward version to keep things from being confusing.
a1 = 0.5
a2 = a1 * a1
a3 = a2 * a2
a4 = a3 * a3
y1 = in + delay1 * a1
(then delay y1 by 2)
y2 = y1 + delay2 * a2
(then delay y2 by 4)
y3 = y2 + delay4 * a3
(then delay y3 by 8)
y4 = y3 + delay8 * a3
etc...
If you want to reverse the filter, you simply swap where the coefficients go
y1 = in * a1 + delay1
y2 = y1 * a2 + delay2
y3 = y2 * a3 + delay4
y4 = y3 * a3 + delay8
etc...
I've tried reversing buffers and filtering those but I hate the the impulse response changes as the windows "fade" in and out.
I'm glad you like the crossover. I found it pretty cool that a 3rd order Butterworth with the 1st order section backwards behaves like a 1st order filter in terms of phase response, so you can get complimentary hp/lp sections my simply subtracting the input from the filter.
I realized my simplified example was wrong after I uploaded it. Each delay needs to be summed before the next delay is applied. My filter takes advantage of the fact that in an exponential decay, the decay is squared. Let's say the decay is 0.5, and I use the forward version to keep things from being confusing.
a1 = 0.5
a2 = a1 * a1
a3 = a2 * a2
a4 = a3 * a3
y1 = in + delay1 * a1
(then delay y1 by 2)
y2 = y1 + delay2 * a2
(then delay y2 by 4)
y3 = y2 + delay4 * a3
(then delay y3 by 8)
y4 = y3 + delay8 * a3
etc...
If you want to reverse the filter, you simply swap where the coefficients go
y1 = in * a1 + delay1
y2 = y1 * a2 + delay2
y3 = y2 * a3 + delay4
y4 = y3 * a3 + delay8
etc...
I've tried reversing buffers and filtering those but I hate the the impulse response changes as the windows "fade" in and out.
 Attachments

 Hilbert transform with BW filters.fsm
 (10 KiB) Downloaded 185 times
 cbbuntz
 Posts: 10
 Joined: Sat May 07, 2011 5:50 pm
Re: Hilbert Shifter
OK thanks. I undertand the exponetial decay example. That would explain how to implement a leaky integrator (just one single real pole). How do you go about multiple poles or complex conjugate poles as in biquads?
 martinvicanek
 Posts: 664
 Joined: Sat Jun 22, 2013 8:28 pm
Re: Hilbert Shifter
cbbuntz, I realized that your filter is actually a true Hilbert transformer, as opposed to my original allpass network!
KG, that's what you had asked for!
So I took the oportunity to optimize some more and managed to reduce CPU load by another factor 3 or so. It is still more CPU hungry than my allpass network, but certainly much lighter than an equivalent FIR filter would be. Good job, cbbuntz!
KG, that's what you had asked for!
So I took the oportunity to optimize some more and managed to reduce CPU load by another factor 3 or so. It is still more CPU hungry than my allpass network, but certainly much lighter than an equivalent FIR filter would be. Good job, cbbuntz!
 Attachments

 Hilbert transform with BW filters_2.fsm
 (5.72 KiB) Downloaded 176 times

 Impulse response of Hilbert transformer
 Hilbert.png (27.94 KiB) Viewed 2770 times
 martinvicanek
 Posts: 664
 Joined: Sat Jun 22, 2013 8:28 pm
Re: Hilbert Shifter
This is truly very interesting. Still trying to understand how it works, but obviously it does. exactly what I was looking for!
 KG_is_back
 Posts: 1121
 Joined: Tue Oct 22, 2013 5:43 pm
 Location: Slovakia
35 posts
• Page 2 of 4 • 1, 2, 3, 4
Who is online
Users browsing this forum: No registered users and 4 guests