High Pass IIR example


#1

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!


#2

There’s one built into JUCE?

I implemented one from here separately:

http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

Also good reference:

http://www.musicdsp.org/archive.php?classid=3


#3

JUCE has an IIR filter class available, see IIRAudioFilterSource or IIRFilter
Set the coefficients using: IIRCoefficients::makeHighPass()

// 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


#4

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


#5

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?


#6

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

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

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