Page 2 of 3

Re: Bidirectional IIR filter

Posted: Mon Jan 27, 2014 9:32 pm
by Tronic
Just out of curiosity, have you tried also using modulated signals?

Re: Bidirectional IIR filter

Posted: Mon Jan 27, 2014 10:34 pm
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.

Re: Bidirectional IIR filter

Posted: Tue Jan 28, 2014 3:20 am
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.

Re: Bidirectional IIR filter

Posted: Sun May 11, 2014 8:59 am
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 25930 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 25930 times

bidir IIR LR xover highpass (500).png
bidir IIR LR xover highpass (500).png (58.92 KiB) Viewed 25930 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!

Re: Bidirectional IIR filter

Posted: Sun May 11, 2014 9:04 am
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 25930 times

Re: Bidirectional IIR filter

Posted: Sun May 11, 2014 4:10 pm
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:

Re: Bidirectional IIR filter

Posted: Sun May 11, 2014 4:26 pm
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).

Re: Bidirectional IIR filter

Posted: Sun May 11, 2014 4:38 pm
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.

Re: Bidirectional IIR filter

Posted: Sun May 11, 2014 8:26 pm
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.

Re: Bidirectional IIR filter

Posted: Mon May 12, 2014 5:36 am
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.