# Higher order & slope filters in Juce Framework

**URL:** <https://forum.juce.com/t/higher-order-slope-filters-in-juce-framework/56625>\
**Category:** General JUCE discussion\
**Created:** [June 13, 2023, 9:17am UTC](https://forum.juce.com/t/higher-order-slope-filters-in-juce-framework/56625 "2023-06-13T09:17:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![yetkin](https://avatars.discourse-cdn.com/v4/letter/y/97f17d/32.png) [@yetkin](https://forum.juce.com/u/yetkin)\
**Post date:** [June 13, 2023, 9:17am UTC](https://forum.juce.com/t/higher-order-slope-filters-in-juce-framework/56625/1 "2023-06-13T09:17:34Z")

</div>

I want to create a -96 dB/octave LowCut filter for juce plugin application. However, the Riley Filter and Ladder Filter have a maximum of -24 dB/octave. How can I achieve -96 dB/octave?

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 13, 2023, 10:00am UTC](https://forum.juce.com/t/higher-order-slope-filters-in-juce-framework/56625/2 "2023-06-13T10:00:41Z")

</div>

The easy answer is just to chain filters, i.e. three 24 dB/oct filters in series will result in a 96 dB/oct roll-off.

---

<div class="post-metadata">

**Author:** ![ImJimmi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/imjimmi/32/10843_2.png) [@ImJimmi](https://forum.juce.com/u/ImJimmi)\
**Post date:** [June 13, 2023, 10:15am UTC](https://forum.juce.com/t/higher-order-slope-filters-in-juce-framework/56625/3 "2023-06-13T10:15:29Z")

</div>

You need to be careful to choose the correct Q values when cascading filters like this: [Cascading filters | EarLevel Engineering](https://www.earlevel.com/main/2016/09/29/cascading-filters/)

---

<div class="post-metadata">

**Author:** ![Nitsuj70](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nitsuj70/32/12754_2.png) [@Nitsuj70](https://forum.juce.com/u/Nitsuj70)\
**Post date:** [June 13, 2023, 12:59pm UTC](https://forum.juce.com/t/higher-order-slope-filters-in-juce-framework/56625/4 "2023-06-13T12:59:33Z")

</div>

You usually don’t want a ladder filter unless you’re programming something like a synthesiser, that is, they’re usually coloured using drive and saturation. The Linkwitz-Riley filter is generally used for cross overs so depending on what you’re doing you _might_ want one of those.

If you’re just wanting a filter that’s relatively steep then a Butterworth filter might do. You can get it by cascading 12dB IIR filters with specific Q settings - I think another responder here gave the Earlevel site link that goes into some detail what those Q settings are and how to calculate them. Just be aware that the steeper the filter is, the more you may get artefacts around the corner frequency.

On the other hand, if you’re wanting to do half-band limiting to get rid of aliasing as part of an oversampling set up then the JUCE oversampling library code manages all that in a reasonable way using polyphase filters.

---

<div class="post-metadata">

**Author:** ![yetkin](https://avatars.discourse-cdn.com/v4/letter/y/97f17d/32.png) [@yetkin](https://forum.juce.com/u/yetkin)\
**Post date:** [June 13, 2023, 1:08pm UTC](https://forum.juce.com/t/higher-order-slope-filters-in-juce-framework/56625/5 "2023-06-13T13:08:40Z")

</div>

Really thanks for this beautiful suggestion. I was looking for such a link to help with understanding the essentials and calculations

---

<div class="post-metadata">

**Author:** ![yetkin](https://avatars.discourse-cdn.com/v4/letter/y/97f17d/32.png) [@yetkin](https://forum.juce.com/u/yetkin)\
**Post date:** [June 13, 2023, 2:40pm UTC](https://forum.juce.com/t/higher-order-slope-filters-in-juce-framework/56625/6 "2023-06-13T14:40:25Z")

</div>

I want to set the ORDER number to 16th order in the Butterworth filter to achieve -96db/octave CUTOFF, but the ORDER number doesn’t have the slightest effect; there’s not even a 1db difference between order 1 and order 10 (I checked with a spectrum analyzer in Cubase and by ear). Did I use the ORDER incorrectly in this code? Why is it ineffective?

```auto

using StereoFilter = juce::dsp::ProcessorDuplicator<juce::dsp::IIR::Filter<float>,
        juce::dsp::IIR::Coefficients<float>>;
    juce::dsp::ProcessorChain<StereoFilter> processChain;
    enum ChainIndex { HPF };

//set filter order and cutoff frequency 
void NewProjectAudioProcessor::setHPF(float frequency, int slope)
{   
    *processChain.get<ChainIndex::HPF>().state =
        *juce::dsp::FilterDesign<float>::designIIRHighpassHighOrderButterworthMethod(
            frequency, spec.sampleRate, 2 * (slope+1))[0];
}

```

---

<div class="post-metadata">

**Author:** ![yetkin](https://avatars.discourse-cdn.com/v4/letter/y/97f17d/32.png) [@yetkin](https://forum.juce.com/u/yetkin)\
**Post date:** [June 14, 2023, 11:28am UTC](https://forum.juce.com/t/higher-order-slope-filters-in-juce-framework/56625/7 "2023-06-14T11:28:27Z")

</div>

I searched the examples and all the examples I could find use chained dsp::IIRFilters. I wonder if there’s any way to get a higher ordered filter with creating a single instance of dsp::IIRFilter.

Or is the dsp::IIRFilter is fixed at 12db/oct? Sorry for this begginner question but I’ll be very pleased if someone help with understanding this.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 14, 2023, 11:50am UTC](https://forum.juce.com/t/higher-order-slope-filters-in-juce-framework/56625/8 "2023-06-14T11:50:04Z")

</div>

Although it’s possible to create a single high-order IIR filter, in practice such filters are not very robust. They are very sensitive to small changes in their coefficients, and such changes are frequently introduced when quantising the coefficients to represent them as doubles/floats. Quantisation error in the coefficients can result in the filter becoming unstable.

Low-order filters such as biquad filters are normally less susceptible to instability due to coefficient quantisation, which is one reason why filter designers will often choose to implement a high-order filter as a series of low-order filters.

---

<div class="post-metadata">

**Author:** ![yetkin](https://avatars.discourse-cdn.com/v4/letter/y/97f17d/32.png) [@yetkin](https://forum.juce.com/u/yetkin)\
**Post date:** [June 14, 2023, 12:19pm UTC](https://forum.juce.com/t/higher-order-slope-filters-in-juce-framework/56625/9 "2023-06-14T12:19:01Z")

</div>

Thank you so much. I understand now why it’s preferred to use chained low ordered filters instead using a single one. So it’s possible to get a single high ordered juce::IIRFilter. Is there any juce documentation or any source which you can suggest if I’d like to achieve this in this way? Thanks again
