Multiple IIRFilters


#1

Complete Juce/C++ noob here, so apologies in advance for asking what I am sure must be very basic question.

I am trying to wrap my head around IIRFilters in Juce in order to build a basic 3 band EQ. So far I managed to get a single filter working, but I am seeking advise about how to proceed with adding additional bands/filters.

Do I need to create 3 instances of IIRFilter, one for each band? If so, I assume that each filter is applied to the audio buffer in series. Does the order in which the filters are applied matter?


#2

[quote=“jnicol, post:1, topic:20331”]
Do I need to create 3 instances of IIRFilter, one for each band?[/quote]Yes[quote=“jnicol, post:1, topic:20331”]If so, I assume that each filter is applied to the audio buffer in series.[/quote]Yes[quote=“jnicol, post:1, topic:20331”]Does the order in which the filters are applied matter?
[/quote]No (barring quantization errors of math) - can be proved through associativity of convolution


#3

Thanks so much for the reply. It is good to know I was on the right track.

I am sure I will have more beginner questions coming shortly!


#4

Bring 'em on, I’m sure people here can help. If you ever want to explore or dive deeper in to filter technicalities, modulate the filter’s center frequencies or want improved precision for low frequencies, you can check the zero-delay state variable filters out as designed here:


They also work out of the box, and are stable for any kind of modulation with less artifacts, contrary to the biquad designs the IIRFilter objects are based upon.


#5

Thanks for the suggestion! Those technical papers go straight over my head, but perhaps they will make more sense to me once I get to grips with the basics of DSP.


#6

A free and well written introduction to the basics can be found here: http://www.dspguide.com/pdfbook.htm


#7

Maybe you already knew this, but in case you didn’t : one for each band for every channel you need to process. (So, for a 3 band EQ that you want to use for stereo audio, you will need 6 filter instances.)


#8

While I was researching how filters work in Juce I stumbled on a forum post which explained that a seperate filter is required per channel, so that’s one newbie pitfall I was able to avoid!


#9

Thanks @t0m, that looks like an excellent place to start


#10

That’s true for fixed filters but when modulating the order of the filters can matter.


#11

Yes, in that case you’re violating the time invariance of the LTI system.

Not sure why it would matter on a parametric equalizer though; I doubt anyone swaps the order of the filters dynamically.


#12

I wasn’t referring to changing the order of the filter, but rather to changing the parameters of those filters whose order is fixed. Anyhow it’s probably not important for the specific task at hand.


#13

I understand, but given any parametric EQ, any filter can assume any parameters. Thus, the order of the filters does not really matter as you can modulate any parameter of any filter in any position in the chain (you can change the high band to a low band). Well, as said, it can matter but the only difference is the position - hence the comment about dynamically changing it, the product of misbehaviour is from the alisaing and violation of the lti system.