I have a set of hpf and lpfs, they do filter the audio as expected but lots of crackling happens. I think I must be missing something or not be using the filters correctly in the processBlock but I’m not sure what I’m doing wrong
In processor’s private: ([2], one for each channel)
IIRFilter highpassFilter[2];
IIRFilter lowpassFilter[2];
I then set initial values in the constructor. highpassFilter[0].setCoefficients(IIRCoefficients::makeHighPass(iSampleRate, hpfFreq)); highpassFilter[1].setCoefficients(IIRCoefficients::makeHighPass(iSampleRate, hpfFreq)); lowpassFilter[0].setCoefficients(IIRCoefficients::makeLowPass(iSampleRate, lpfFreq)); lowpassFilter[1].setCoefficients(IIRCoefficients::makeLowPass(iSampleRate, lpfFreq));
I also use .setCoefficients
at the top of processBlock so they’re updated once each buffer. hpfFreq
and lpfFreq
are changed with parameters.
and then later in processBlock, outside of any loop I use these
highpassFilter[0].processSamples(buffer.getWritePointer(0), buffer.getNumSamples()); highpassFilter[1].processSamples(buffer.getWritePointer(1), buffer.getNumSamples()); lowpassFilter[0].processSamples(buffer.getWritePointer(0), buffer.getNumSamples()); lowpassFilter[1].processSamples(buffer.getWritePointer(1), buffer.getNumSamples());