Bidirectional IIR filter

Post any examples or modules that you want to share here
Tronic
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Bidirectional IIR filter

Post by Tronic »

Just out of curiosity, have you tried also using modulated signals?
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Bidirectional IIR filter

Post by KG_is_back »

Tronic wrote:Just out of curiosity, have you tried also using modulated signals?


I have tried real tracks too.... to make the long story short - THE FILTER WORKS! If you meet the previously mentioned limitations (about the IR length) the filter is linear phase, has no artifacts (at least not more than usual filter). Works for any type of signal input.
Tronic
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Bidirectional IIR filter

Post by Tronic »

I'm sorry, I did not insinuate that does not work, but I have not got to try it in depth, so I asked.
steph_tsf
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Re: Bidirectional IIR filter

Post by steph_tsf »

Me to, I can testimony that the bidirectional IIR filter works! When the buffersize is bigger than 256 samples, the 1 kHz distortion spectrum falls under the -120 dB line. See attached screenshot. The weak distorsion peaks that you see, are already in the test signal, coming from Flowstone built-in Sine component.

bidir IIR LR xover distortion (500).png
bidir IIR LR xover distortion (500).png (55.1 KiB) Viewed 25913 times

I did a 2-way Linkwitz-Riley 4th-order crossover. One Butterworth 2nd-order in the forward direction, plus the same Butterworth 2nd-order in the reverse direction. It makes a 4th-order filter in total.
The knob defines the crossover frequency.
IMO, the buffersize should be set to 256.

The lowpass and highpass magnitudes are plain normal, just as expected.
What makes the bidirectional IIR filter so remarkable, is the linear phase it delivers.
See the lowpass and highpass impulse responses (green curves).

bidir IIR LR xover lowpass (500).png
bidir IIR LR xover lowpass (500).png (59.85 KiB) Viewed 25913 times

bidir IIR LR xover highpass (500).png
bidir IIR LR xover highpass (500).png (58.92 KiB) Viewed 25913 times

This is truly fantastic.
Oh, and CPU load remains light.

Thanks kohugaly and MyCo a million for pointing the bidirectional IIR technique on Synthmaker forum!
http://www.synthmaker.co.uk/forum/viewtopic.php?f=10&t=11866

Thanks KG_is_back (= kohugaly ?) for bringing it here, on Flowstone forum!
Last edited by steph_tsf on Mon May 12, 2014 5:05 pm, edited 3 times in total.
steph_tsf
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Re: Bidirectional IIR filter

Post by steph_tsf »

Here attached is the .fsm I'm talking about.
bidir LR xover (500).png
bidir LR xover (500).png (71.76 KiB) Viewed 25913 times
Attachments
bidirectional_IIR_xover.fsm
(9.51 KiB) Downloaded 1288 times
Last edited by steph_tsf on Mon May 12, 2014 5:07 am, edited 1 time in total.
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: Bidirectional IIR filter

Post by martinvicanek »

That's some cool stuff there! 8-)
steph_tsf wrote:IMO, the buffersize should be set to 256.
Obviously that depends on the filter ringing duration, which is inversely proportional to the crossover frequency. buffer=256 works well for Fc > 600 Hz. For Fc down to 300 Hz I found buffer=512 necessary to avoid artifacts.
Thanks a million for pointing this!
You're welcome. Actually you had the idea some time ago, see earlier in this thread, so you can thank yourself. :lol:
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Bidirectional IIR filter

Post by KG_is_back »

If the filters should be complementary, there's no need to compute both of them. Calculate the lowpass and the highpass = input - lowpass ...You save almost 50%cpu (don't forget about the latency when subtracting form input).
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Bidirectional IIR filter

Post by tester »

KG_is_back wrote:If the filters should be complementary, there's no need to compute both of them. Calculate the lowpass and the highpass = input - lowpass ...You save almost 50%cpu (don't forget about the latency when subtracting form input).


Yep, I was always curious about that approach.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
steph_tsf
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Re: Bidirectional IIR filter

Post by steph_tsf »

KG_is_back wrote:If the filters should be complementary, there's no need to compute both of them. Calculate the lowpass and the highpass = input - lowpass ...You save almost 50%cpu (don't forget about the latency when subtracting form input).
Good point. However, it's not that esay to precalculate the required delay. It depends Fc. The dumb "lowpass" and "highpass" calculation allows using a single knob for modifying Fc.

I remain truly astonished by the fact that no windowing is required in the forward/reverse patchwork. We observe boundary artifact natural cancellation. This is worth investigating, IMO.
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Bidirectional IIR filter

Post by KG_is_back »

steph_tsf wrote:Good point. However, it's not that esay to precalculate the required delay. It depends Fc. The dumb "lowpass" and "highpass" calculation allows using a single knob for modifying Fc.


False! The latency delay is simply the buffersize ;-)
steph_tsf wrote:I remain truly astonished by the fact that no windowing is required in the forward/reverse patchwork. We observe boundary artifact natural cancellation. This is worth investigating, IMO.


it is simple actually... signal is divided int two windowed signals that can be added and recreate original signal. Filtering is linear, therefore if you apply the same filtering to both before adding it is the same as applying the filtering to original:
B+C=A
(B+C) x f = A x f
B x f + C x f = A x f

The filtering is applied to reverse windows, but the windows are rectacular and they (almost) ring out before they reach end, so they behave like if full non-windowed signal was reversed and filtered.
Post Reply