Support

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 pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

time-domain FIR filter (Convolver)

Post any examples or modules that you want to share here

time-domain FIR filter (Convolver)

Postby steph_tsf » Thu May 08, 2014 3:53 pm

Oct 22, 2013 KG_is_back published a FIR filter for Sythmaker
http://www.synthmaker.co.uk/forum/viewt ... =7&t=12218

Jun 11, 2013 MyCo published a FIR filter for Flowstone
viewtopic.php?f=3&t=1487

Jul 21, 2013 martinvicanek published a FIR filter toolbox for Flowstone
viewtopic.php?f=3&t=1487&start=10

Aug 04, 2013 steph_tsf published another FIR toolbox for Flowstone (Speaker Lab), aiming at designing 2-way speaker crossovers, by specifying a target acoustic curve, by measuring the bare unfiltered speaker module and phase, and by automatically and interactively computing the FIR filter coefficients - in realtime.
viewtopic.php?f=3&t=1607

Those last weeks I've been reading about "Frequency Warped" filters that could be implemented on Flowstone, using DSP code or ASM code.

Those "Frequency Warped" filters base on the IEEE publication "Discrete Representation of Signals" by Oppenheim and Johnson, dating back from 1972.
In 1999, Paul Beckmann working for Bose, published "Frequency Warping in the Design and Implementation of Fixed-Point Audio Equalizers" at the IEEE.
In 2009, Ramos published "Cascaded warped-FIR and FIR filter structure for loudspeaker" at the AES.

In a nutshell, Warped-FIR filters borrow the topology of FIR filters, but instead of relying on delay cells, they use 1st-order all-pass phase shifters producing a time-domain smear, with a parameter (lambda) inside defining the amount of phase shift, hence the amount of "Frequency Warp". Due to the use of phase shifters inside, this is not anymore a "Finite Impulse Response" filter.

Is it possible to experiment Warped-FIR filters using Flowstone ?
What "lambda" shall we specify for a 128-tap Warped-FIR lowpass filter with Fc = 300 Hz when Fs = 44.1 kHz?
Can the highpass be complementary?
Can they exhibit a linear phase, natively, or do we need extra-filters for restoring a linear phase?

The objective is to have Speaker Lab automatically and interactively computing the Warped-FIR filter coefficients in realtime. It is expected that this way, the FIR length can be kept between 64 and 256, for materializing excellent speaker crossovers operating in the Fc = 100 Hz to 1000 Hz range, when Fs = 44.1 kHz.

Most publications remain silent about the phase. There seems to be a catch, like the Warped-FIR filter enabling a drastic filter order reduction (when Fc is very small compared to Fs), at the expense of losing the linear phase. So, if we succeed in implementing Warped-FIR filters for Flowstone, we could need specialized IIR filters for restoring a linear phase. Kind of joke! But, after all, anyway, I'd like to experiment this using Flowstone. And you?

Steph
Attachments
Warped-FIR filter (650).png
Warped-FIR filter (650).png (50 KiB) Viewed 27344 times
Last edited by steph_tsf on Sat May 10, 2014 6:58 am, edited 1 time in total.
steph_tsf
 
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Re: time-domain FIR filter (Convolver)

Postby tester » Thu May 08, 2014 4:33 pm

Everything that is oriented towards sound quality and efficiency in DSP processing - is always welcome.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: time-domain FIR filter (Convolver)

Postby martinvicanek » Thu May 08, 2014 10:40 pm

steph_tsf wrote:Is it possible to experiment Warped-FIR filters using Flowstone ?

Yes, absolutely. For instance in the LPC project I used a warped filter although that was not a warped FIR but rather an all pole. It may be somewhat tricky to implement a long warped FIR filter in a CPU-efficient way, but then again it does not have to be very long if it is warped. ;)
What "lambda" shall we specify for a 128-tap Warped-FIR lowpass filter with Fc = 300 Hz when Fs = 44.1 kHz?

Hard to say, it will depend on further specs like stopband rejection, transition bandwidth etc.
Can the highpass be complementary?

I suppose it can, but must admit I haven't checked that.
Can they exhibit a linear phase, natively, or do we need extra-filters for restoring a linear phase?

No, certainly not linear phase per se. For linear phase you'd need extra filters. Why is linear phase so desirable? I like minimum phase because it has no pre-ringing.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: time-domain FIR filter (Convolver)

Postby martinvicanek » Fri May 09, 2014 6:07 am

steph_tsf wrote:What "lambda" shall we specify for a 128-tap Warped-FIR lowpass filter with Fc = 300 Hz when Fs = 44.1 kHz?

Hm, I think you would probably want to map Fc somewhere near Nyquist/2 in the warped domain, so that would suggest lambda = 0.958. :geek: Does that make sense?
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: time-domain FIR filter (Convolver)

Postby steph_tsf » Fri May 09, 2014 6:20 pm

Warped-FIR warping effect for lambda.png
Warped-FIR warping effect for lambda.png (80.1 KiB) Viewed 27286 times
steph_tsf
 
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Re: time-domain FIR filter (Convolver)

Postby martinvicanek » Fri May 09, 2014 6:39 pm

Here is a very basic warped FIR filter (32 taps) for Fc = 300 Hz. It is designed for illustration, not for efficiency. Both lowpass and highpass, which are complementary ;) . You can see from the impulse response in the time domain that the warped filter is not linear phase, even though the unwarped (lambda=0) filter is.
Attachments
warpedFIR.fsm
fixed
(18.76 KiB) Downloaded 1183 times
Last edited by martinvicanek on Sat May 10, 2014 3:32 pm, edited 1 time in total.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: time-domain FIR filter (Convolver)

Postby steph_tsf » Sat May 10, 2014 6:07 am

warpedFIR filter.png
warpedFIR filter.png (67.41 KiB) Viewed 27275 times

I defined lambda = 0.86 for getting a lowpass Fc = 1 kHz when Fs = 44.1 kHz

the lowpass selectivity look outstanding (blue curve)
the complementary highpass asymptot is 1st-order (20dB / decade) - that's quite poor

I'd like to try a lowpass prototype delivering complementary symmetric slopes, like a 3rd-order for the lowpass and a 3rd-order for the highpass - then see how it looks after the frequency warp
would be nice to have the coefficients externally defined

and yes indeed, phase is not linear
the lowpass impulse response looks tortured (green curve)
any idea how to restore a linear phase at a decent computing cost, say 16 or 32 IIR Biquads or so ?
steph_tsf
 
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Re: time-domain FIR filter (Convolver)

Postby steph_tsf » Sat May 10, 2014 6:48 am

prototype 31-tap FIR lowpass filter I'd like to warp
it's a 3rd-order lowpass having Fc = 3 kHz when Fs = 44.1 kHz
as you can see the complementary highpass exhibits the same 3rd-order slope

this is working very well, as speaker crossover :
no preshoot
no ringing
decent slopes (3rd-order)
symmetric slopes
no relative phase shift between woofer and tweeter
no phase distortion (lowpass + highpass = unity function, magnitude and phase)
ARM Cortex-M4 cores (STM32F4 168 MHz) and the newest-revised MIPS32 core (Microchip PIC32MZ 200 MHz) handle 31-tap FIR filters beautifully
Flowstone and Gigahertz-class x86 processors handle 256-tap FIR filters beautifully

Complementary Symmetric 3rd order 3000Hz (500).png
Complementary Symmetric 3rd order 3000Hz (500).png (102.45 KiB) Viewed 27274 times

the FIR coefficients are : (you may need to replace the commas with dots over there)

0
-0,000117142341436168
-0,000645842376139766
-0,0016935094978849
-0,00305633464843259
-0,00419047343784671
-0,00416759246774707
-0,00181896328942991
0,00421002458152975
0,0151069014951839
0,0317919371157238
0,0543251022525246
0,0819080370821168
0,111792163261164
0,139611334121276
0,153888712601451
0,13961087530637
0,111793061152123
0,0819067387576274
0,0543267450993716
0,031790020560657
0,0151090090376209
0,0042078171792403
-0,00181675170572841
-0,00416971205180095
-0,00418853846754454
-0,00305799987648977
-0,00169218805302173
-0,000646760217212997
-0,000116671173264689
0

I'm very curious to see what's happening after frequency-warping it, for Fc = 300 Hz instead of 3 kHz
steph_tsf
 
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Re: time-domain FIR filter (Convolver)

Postby martinvicanek » Sat May 10, 2014 4:04 pm

steph_tsf wrote:the complementary highpass asymptot is 1st-order (20dB / decade) - that's quite poor
Oops, sorry, I had the coefficients wrong. :oops: Now fixed in the original post. Lowpass and highpass slopes are symmetric.
steph_tsf wrote:and yes indeed, phase is not linear
any idea how to restore a linear phase at a decent computing cost, say 16 or 32 IIR Biquads or so ?
I think for lambda = 0.958 you'd need quite a few biquad allpass sections to restore linear phase. In that case the warped FIR filter offers no advantage over a IIR crossover in the first place. :(
steph_tsf wrote:I'd like to try a lowpass prototype delivering complementary symmetric slopes, like a 3rd-order for the lowpass and a 3rd-order for the highpass - then see how it looks after the frequency warp
would be nice to have the coefficients externally defined
Yep, read on...
steph_tsf wrote:prototype 31-tap FIR lowpass filter I'd like to warp
it's a 3rd-order lowpass having Fc = 3 kHz when Fs = 44.1 kHz
as you can see the complementary highpass exhibits the same 3rd-order slope
this is working very well, as speaker crossover :
no preshoot
no ringing
decent slopes (3rd-order)
symmetric slopes
no relative phase shift between woofer and tweeter
no phase distortion (lowpass + highpass = unity function, magnitude and phase)
the FIR coefficients are : (you may need to replace the commas with dots over there)

0
-0,000117142341436168
-0,000645842376139766
-0,0016935094978849
-0,00305633464843259
-0,00419047343784671
-0,00416759246774707
-0,00181896328942991
0,00421002458152975
0,0151069014951839
0,0317919371157238
0,0543251022525246
0,0819080370821168
0,111792163261164
0,139611334121276
0,153888712601451
0,13961087530637
0,111793061152123
0,0819067387576274
0,0543267450993716
0,031790020560657
0,0151090090376209
0,0042078171792403
-0,00181675170572841
-0,00416971205180095
-0,00418853846754454
-0,00305799987648977
-0,00169218805302173
-0,000646760217212997
-0,000116671173264689
0

I'm very curious to see what's happening after frequency-warping it, for Fc = 300 Hz instead of 3 kHz
Refer to attached schematic. Warping with lambda = 0.8 brings Fc down to about 300 Hz, at the cost of losing phase linearity. Also the lowpass stopband falloff is somewhat worse but that could be fixed with some smart coefficients tweaking.

If linear phase is your goal you might consider this bidirectional IIR filter design. Would make a nice Linkwitz-Riley crossover (one Butterworth filter in each direction), don't you think? ;)
Attachments
warpedFIR_2.fsm
(13.08 KiB) Downloaded 1214 times
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: time-domain FIR filter (Convolver)

Postby steph_tsf » Sun May 11, 2014 2:35 am

The coefficients inside need to be defined using dots.
Attached is the Warped FIR built on the complementary symmetrical Fc 3 kHz crossover, featuring a 3nd-order lowpass and a 3nd-order highpass.
Attachments
warpedFIR3.fsm
(6.54 KiB) Downloaded 1284 times
steph_tsf
 
Posts: 249
Joined: Sun Aug 15, 2010 10:26 pm

Next

Return to User Examples

Who is online

Users browsing this forum: No registered users and 137 guests