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

Invitation: FIR + IIR equalizer in the need of collaboration

For general discussion related FlowStone

The issue with direct form biquad filters

Postby martinvicanek » Thu Mar 17, 2022 8:24 pm

Direct form biquad filters may be the simplest to comprehend, but they have issues in a real world scenario. One weakness is their numerical (in)accuracy at low frequencies. The example shows the step responses of four lowpass filter implementations. The responses should be identical in theory. However, for cutoffs in the low Hz regime, the three direct forms behave rather erratically, whereas the filter labeled "ZDF" remains steady and predictable.

The acronym stands for "zero delay feedback", perhaps not a very fortunate term to characterize the filter. In essence, it is a trapezoid integration of a state variable filter, aka SVF (not very catchy either, I know). The point is that the SVF has the same theoretical response as a biquad has if you choose the coefficients accordingly, however the SVF is more reliable in practice. The SVF is also superior in terms of fast modulation.
Attachments
IssueWithDirectForms.fsm
(178.3 KiB) Downloaded 391 times
User avatar
martinvicanek
 
Posts: 1319
Joined: Sat Jun 22, 2013 8:28 pm

A selection of switches, selectors,and alternatives

Postby martinvicanek » Thu Mar 17, 2022 9:38 pm

A few alternatives for switches and selectors.

The first group will interrupt audio and recompile the schematic. That may not always be desirable. However, there are some advantages as well:
1. Universal, will work with any signal type.
2. No extra CPU cost. In fact, saves CPU by disabeling computation for the inactive branch.

The second group variants will not interrupt audio, however they will not stop the switched-off signal path from being evaluated nonetheless. Works for most but not all signal types. There is a negligible CPU overhead for the stream variants.

The third column provides soft switching e.g. to avoid clicks and the like. Might be useful in some cases. Still very little overhead.
Attachments
SwitchesAndSelectors.fsm
(5.24 KiB) Downloaded 394 times
User avatar
martinvicanek
 
Posts: 1319
Joined: Sat Jun 22, 2013 8:28 pm

Re: Invitation: FIR + IIR equalizer in the need of collabora

Postby martinvicanek » Thu Mar 17, 2022 10:22 pm

chjan wrote:5. Today I would definitely use a longer FFT than 1024, preferrably make it user selectable as you suggest.

That's why I made the tap-slider and ms delay indicator. Brick walling at lower frequencies requires larger nof taps. I have java code for producing FIR filters in whatever tap dimension, but nothing for Flowstone. There are a few other things you have that is also very interesting. One is the ability to automatically reproduce/mimic an arbitrary SPL response, only, it could be used the other way around; to create the reciprocal (inverse curve) of such a response. That would be a great tool to check how your speakers are sounding when flattened in its response. One could then add a simple "house curve" as it is called, e.g. the Harman Kardon "default", and incorporate that response to the SPL response and therefore create a "flat" and(or hourse curve response for a speaker system.

Another interesting feature would be to use the same principle to rectify a systems measured phase response. The reading in of SPL and Phase response should be easy peasy, for example as produced as results from the use of REW, a free tool used by the whole world. REW can export as txt, convolution or other formats. Same with impulse response, it can also easily be retrieved from REW.

I have added options for IR sizes 1024, 2048, 4096, 8192, and 16384. ;)
chjan wrote:6. One could use partitioned convolution to reduce latency in FIR filtering.

Please explain in more detail.

https://cse.hkust.edu.hk/mjg_lib/bibs/D ... s/Ga95.PDF
Basically you do blockwise convolutions with blocks of increasing size. You divide the IR in partitions (of incresing size). You apply a direct convolution to the first partition. That buys you some time so you can afford a blockwise convolution (exploiting FFT) of the second partition and so on. The result is zero extra latency but with a more efficient algo than would be direct convolution.
I have added partitioned convolution as an option. ;)
chjan wrote:I use 3.09 B2. Unaware of alpha versions. Should I swap to a newer version (or older)? Please advice

Ouch! viewtopic.php?f=2&t=11635&p=224134
I had assumed you were using the (latest) alpha, so I have been adding those features in that version. There is no backward compatibility, and I have taken advantage of some very handy new features, so I will probably post it in the Examples channel over at slack.
User avatar
martinvicanek
 
Posts: 1319
Joined: Sat Jun 22, 2013 8:28 pm

Re: Invitation: FIR + IIR equalizer in the need of collabora

Postby chjan » Sat Mar 19, 2022 3:50 pm

Martin

In the context of an imagined (it is coming) speakerBuilderFastPrototypeTool, I have extended the IIR module presented above:

1. If approaching a speaker builder community, it is of value (mandatory) to adopt to common terminology. Therefore, I suggest the use of "their" standard terminology in the GUI, i.e. (1.order, 2.order,..) filters instead of the mathematically correct terms; 1 pole, 2 pole, etc. OK?

2. Popular filters are ButterWorth, LinkwitzRiley (= cascaded ButterWorth, hence even order only), Bessel, and perhaps some other later on. Therefore, I added corresponding selector that becomes visible once some filter (LP, HP, BP) is first selected, as well as a selector for the order of the filter. Now any speaker builder will immediately recognize and grasp these GUI selectors.

3. I also added "crossover" as an (PFO) option, because it should be possible to define and adjust the crossover frequency between two speaker drivers and the two adjacent LP and HP. It will be of high value to allow for "live tuning" - in best case "dragging a dot" - so as to find the optimal crossover F. This fuel very interesting AB testing etc. It will require some more logic to combine two IIRs, but that is a future problem.

4. The Gain parameter is normally not part of a LP, HP, BP equation, but for speaker builders it is mandatory, to enable volume levelling of each driver. For e.g. a midrange with LP +HP, there will in the current design be two Gain adjusters. Those could be subject to "last value wins" type of logic. Gain is therefore very convenient also for LP,HP,BP.

Here is a proper tutorial on these "speaker builder" filter types: [url]bcae1.com/xoorder.htm[/url]

Questions:

1. Would it be possible to extend your filters schematics above with a N order input? 3.order Butterworth and 4.order LR are VERY common and should be directly available in the GUI.
2. Can "the second order filters use the SVF topology with trapezoidal integration" be tuned into the various filter types (LR, Butterworth...), just as this is done by manipulating a and b parameters for the (I assume) "transposed direct form 2" ? Because it will be of value to translate the active IIR into a passive ditto with RLC values. The user of this tool might go off the standard values, and such a result should also be possible to convert to corresponding non-standard RLC values. (However, some will not translate into passive filters, various usages can be foreseen)
3. Can you grant a short explanation (for layman reader) regarding some of your terminology, like "matched biquad", "static" vs "modulateable", etc. What does this mean? What is the difference with your filter designs, compared to the standard Flowstone modules? In a few sentences, please.

I am working on the general or should we say "generic" EQ gui. I have today added one-push-preset buttons for convenience in AB testing. (Modification of Ernst's present manager). And some more.

newIIR_example.fsm
(18.37 KiB) Downloaded 383 times
chjan
 
Posts: 30
Joined: Wed Oct 22, 2008 3:15 pm

Re: Invitation: FIR + IIR equalizer in the need of collabora

Postby martinvicanek » Sat Mar 19, 2022 9:52 pm

chjan wrote:1. If approaching a speaker builder community, it is of value (mandatory) to adopt to common terminology. Therefore, I suggest the use of "their" standard terminology in the GUI, i.e. (1.order, 2.order,..) filters instead of the mathematically correct terms; 1 pole, 2 pole, etc. OK?

No problem, 1st and 2nd order is also mathematically correct. :)

2. Popular filters are ButterWorth, LinkwitzRiley (= cascaded ButterWorth, hence even order only), Bessel, and perhaps some other later on. Therefore, I added corresponding selector that becomes visible once some filter (LP, HP, BP) is first selected, as well as a selector for the order of the filter. Now any speaker builder will immediately recognize and grasp these GUI selectors.

Cool! 8-)

[...]Questions:

1. Would it be possible to extend your filters schematics above with a N order input? 3.order Butterworth and 4.order LR are VERY common and should be directly available in the GUI.

It can be done for ordinary BLT-mapped filters. For matched filters without cramping near Nyquist it would be very tricky. Yes, you can cascade matched filters to build higher order filters, but the errors will accumulate.

The whole matched filter business becomes kind of oblolete as we can create literaly any filter using the FIR approach. This includes all analog filters, both magnitude and phase. ;)
I have posted an updated schematic on slack.
https://flowstone-support.slack.com/arc ... =CAUPKDZ16
It is compiled with FS alpha. I suggest you register and get the latest FS alpha instead of using the very buggy beta.

2. Can "the second order filters use the SVF topology with trapezoidal integration" be tuned into the various filter types (LR, Butterworth...), just as this is done by manipulating a and b parameters for the (I assume) "transposed direct form 2" ? Because it will be of value to translate the active IIR into a passive ditto with RLC values. The user of this tool might go off the standard values, and such a result should also be possible to convert to corresponding non-standard RLC values. (However, some will not translate into passive filters, various usages can be foreseen)

Actually the SVF parameters (cutoff frequency and Q) are much closer to the analog world than are the biquad parameters a_i and b_i. But SVF is only 2nd order.

3. Can you grant a short explanation (for layman reader) regarding some of your terminology, like "matched biquad", "static" vs "modulateable", etc. What does this mean? What is the difference with your filter designs, compared to the standard Flowstone modules? In a few sentences, please.

Analog filters have some nice scaling properties: in a double log representation of the magnitude response, changing the cutoff frequency results in a mere shifting the curve without changing its shape. Digital filters do not have this property per se because the Nyquist frequency poses a fundamental upper limit. There are various possibilities to make digital filters resemble the behavior of their analog counterparts. Perhaps the most popular is the bilinear transform (BLT), which maps the analog frequency (from 0 to infinity) on the Nyquist interval. The famous RBJ Cookbook uses BLT. The formulas for the filter coefficients are simple and explicit. The downside is that the mapping is not perfect near Nyquist, the effect is sometimes called cramping.
Matched filters intend to better reproduce the analog filter response at the expense of more complicated coefficient formulas. I have included a little demo, here is a snapshot:
MatchedLowpassDemo.png
MatchedLowpassDemo.png (19.56 KiB) Viewed 7114 times

MatchedLowpassDemo.fsm
(279.47 KiB) Downloaded 417 times

Static vs. dynamic (i.e. modulateable) filters: Static filters are typically set by user interaction and then left alone. Dynamic filters may be modulated by other sources like envelope generators or LFOs. Here, coefficient updates are frequent, maybe even at audio rate.

I am working on the general or should we say "generic" EQ gui. I have today added one-push-preset buttons for convenience in AB testing. (Modification of Ernst's present manager). And some more.

That is all very exciting. I am happy to contribute some DSP building blocks, but please do not expect me to actually work on your schematic. GUI work is not my strength anyway (That is a gross understatement! :lol: )
User avatar
martinvicanek
 
Posts: 1319
Joined: Sat Jun 22, 2013 8:28 pm

Re: Invitation: FIR + IIR equalizer in the need of collabora

Postby chjan » Sun Mar 20, 2022 9:06 am

Thank you. How do I register for the alpha? I am a paid customer, but I see only beta from 2016?

Two thoughts in head heare, simultaneously, swapping:

1. The filter math. Will return to that in an erratic fashion.
2. Carl trying to get rid of his embarrassing Ruby ignorance. For example, I am trying to polish the background Bode diagram based on your Ruby code. At the moment background turns yellow even if I have explicitly told the module to paint in dark green. So need to pass that hurdle first. Work could also include scaling of axis since sometimes a speaker builder will be studying his subwoofer, and at other times, the whole frequency spectrum. etc. Some days of work piling up.
chjan
 
Posts: 30
Joined: Wed Oct 22, 2008 3:15 pm

Re: Invitation: FIR + IIR equalizer in the need of collabora

Postby martinvicanek » Sun Mar 20, 2022 9:06 pm

chjan wrote:Thank you. How do I register for the alpha? I am a paid customer, but I see only beta from 2016?

The slack flowstone-support has been created with the intention to share information with users who are willing to test Flowstone alpha versions and give feedback. The latest release v3.0.9b2-3484-g7792583 is in a very good shape, though MyCo is currently taking a break so development has paused for the time being.
Here’s the link to join the Slack forum:

https://join.slack.com/t/flowstone-supp ... jU3YjAxNzc

For alpha testing of FS4 you have to post a request in General.
[...] Some days of work piling up.

I told you it was more than one week. :twisted: :)
User avatar
martinvicanek
 
Posts: 1319
Joined: Sat Jun 22, 2013 8:28 pm

Re: Invitation: FIR + IIR equalizer in the need of collabora

Postby chjan » Mon Mar 21, 2022 8:36 am

But those "some days of work" are related to my ruby ignorance. Someone more competent would have used a couple of minutes on what I spend hours to achieve. But I am starting to like and understand Ruby, and I observe myself as speeding up now ;)

But then again, as I work on this, I get head full of crazy ideas and worst case the latest forecast now is SEVERAL MONTHS of hard work! Haha.
chjan
 
Posts: 30
Joined: Wed Oct 22, 2008 3:15 pm

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 55 guests

cron