Getting artefacts on my first DSP usage. Any help would be welcome!

Hello,

I’m doing my first plugin that uses a pre-made DSP from juce, and I’m getting some artifacts.

I’m just putting a hipass filter to an audio signal.

Thanks what I’m doing:

in the Main Audio Processor class, I’ve added this field:

IIRFilter hi_pass;

Then, in the PrepareToPlay method, I’ve done this:

void HardcoreLimiter_Processor::prepareToPlay (double sampleRate, int samplesPerBlock)
{
    // Use this method as the place to do any pre-playback
    // initialisation that you need..
    hi_pass.reset();
    auto coefficients = IIRCoefficients::makeHighPass(sampleRate, 1000);
    hi_pass.setCoefficients(coefficients);

}

And in the ProcessBlock method, I’ve done this:

void HardcoreLimiter_Processor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages)
{
    ScopedNoDenormals noDenormals;
    auto totalNumInputChannels  = getTotalNumInputChannels();
    auto totalNumOutputChannels = getTotalNumOutputChannels();

    for (auto channel = 0; channel < totalNumInputChannels; ++channel)
    {
        auto* channelData = buffer.getWritePointer (channel);

        hi_pass.processSamples(&channelData[0], buffer.getNumSamples());

    }
}

The hi pass filter, seems to be filtering the audio, but I’m getting lots of artifacts, so I’m sure this is not meant to be done like I thought it should.

Any idea of what I’m doing wrong?

Thanks!

You need separate filter instances for all the audio channels you are processing. (So, 2 for stereo processing.)

1 Like

Thanks @Xenakios