# High Pass IIR example

**URL:** <https://forum.juce.com/t/high-pass-iir-example/22632>\
**Category:** General JUCE discussion\
**Created:** [May 27, 2017, 3:41pm UTC](https://forum.juce.com/t/high-pass-iir-example/22632 "2017-05-27T15:41:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MIA-LABORATORIES](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@MIA-LABORATORIES](https://forum.juce.com/u/MIA-LABORATORIES)\
**Post date:** [May 27, 2017, 3:41pm UTC](https://forum.juce.com/t/high-pass-iir-example/22632/1 "2017-05-27T15:41:08Z")

</div>

Hello world of Jucers !!  
is there any Juicer example of a HighPass IIR implementation that you are willing to share ???  
Maximum respect to one and all  
dealing with such things !  
Blessings!

---

<div class="post-metadata">

**Author:** ![jimc](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jimc/32/16067_2.png) [@jimc](https://forum.juce.com/u/jimc)\
**Post date:** [May 27, 2017, 4:39pm UTC](https://forum.juce.com/t/high-pass-iir-example/22632/2 "2017-05-27T16:39:05Z")

</div>

There’s one built into JUCE?

I implemented one from here separately:

[http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt](http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt)

Also good reference:

[http://www.musicdsp.org/archive.php?classid=3](http://www.musicdsp.org/archive.php?classid=3)

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [May 27, 2017, 4:39pm UTC](https://forum.juce.com/t/high-pass-iir-example/22632/3 "2017-05-27T16:39:15Z")

</div>

JUCE has an IIR filter class available, see [IIRAudioFilterSource](https://juce.com/doc/classIIRFilterAudioSource) or [IIRFilter](https://juce.com/doc/classIIRFilter)  
Set the coefficients using: [IIRCoefficients::makeHighPass()](https://juce.com/doc/classIIRCoefficients#a19027ed08d1483e83aafc7aa287cdcb0)

```
// private member
IIRFilter monoFilter;

// in prepareToPlay
double freq = 5000;
double q = 1.0;

monoFilter (IIRCoefficients::makeHighPass (sampleRate, freq, q));

// in processBlock
monoFilter.processSamples (buffer.getWritePointer (0), buffer.getNumSamples());

```

Just make sure to use a filter instance for each channel, because it changes the state of the filter.  
If your signal is interrupted or changed, call monoFilter.reset() to initialise the state.

Is this what you were looking for?

HTH

---

<div class="post-metadata">

**Author:** ![matthieu-brucher](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@matthieu-brucher](https://forum.juce.com/u/matthieu-brucher)\
**Post date:** [May 27, 2017, 8:15pm UTC](https://forum.juce.com/t/high-pass-iir-example/22632/4 "2017-05-27T20:15:18Z")

</div>

There are a dozen different implementations in Audio ToolKit as well ([https://github.com/mbrucher/AudioTK/tree/master/ATK/EQ](https://github.com/mbrucher/AudioTK/tree/master/ATK/EQ))

---

<div class="post-metadata">

**Author:** ![khanshauk](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@khanshauk](https://forum.juce.com/u/khanshauk)\
**Post date:** [August 18, 2017, 7:56am UTC](https://forum.juce.com/t/high-pass-iir-example/22632/5 "2017-08-18T07:56:40Z")

</div>

Hallo Daniel

I was trying this example.  
In the PluginProcessor.h file i have added the line  
// private member  
IIRFilter monoFilter;

and the rest in the PluginProcessor.cpp as you suggested

on the line  
monoFilter (IIRCoefficients::makeHighPass (sampleRate, freq, q));

i get the error " Type juce:: IIRFilter does not provide a call operator "  
what is the solution to this error? and how if i want to use the filter for stereo operation how i do i set it for two channels?

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [August 18, 2017, 8:01am UTC](https://forum.juce.com/t/high-pass-iir-example/22632/6 "2017-08-18T08:01:55Z")

</div>

> [@khanshauk](#):
>
> on the line
> 
> monoFilter (IIRCoefficients::makeHighPass (sampleRate, freq, q));
> 
> i get the error " Type juce:: IIRFilter does not provide a call operator "

Sorry, I was not paying full attention, it should read:

```
monoFilter.setCoefficients (IIRCoefficients::makeHighPass (sampleRate, freq, q));

```

> [@khanshauk](#):
>
> and how if i want to use the filter for stereo operation how i do i set it for two channels?

You will have to create a filter instance per channel and put them into an `Array<IIRFilter>` or `OwnedArray<IIRFilter>`, depending which one you like better.

HTH
