Dear community,
I am experiencing artifacts when updating the IR of a dsp::Convolution, used to design a room reverb VST under OSX 10.12 with JUCE 5.3.2. A full version of the debug project along with an audio recording of the artefacts is available there.
All there is to it is a slightly modified JUCE template VST, adding wave format reader and dsp::Convolution in the PluginProcessor.h, a timer triggered updateIR() method in PluginProcessor.cpp:
void DebugDspConvAudioProcessor::updateIr()
{
// auto update IR file name
auto irFileName = "";
if( irCount % 2 == 0 )
irFileName = "Studio_5_A0_01_BF_W_withoutDirect.wav";
else
irFileName = "Studio_5_A1_01_BF_W_withoutDirect.wav";
irCount += 1;
auto irFile = getResourceFile (irFileName);
// read data into buffer and load IR to convolution
std::unique_ptr<AudioFormatReader> reader (wavFormat.createReaderFor (irFile.createInputStream(), false));
if (reader.get() != nullptr)
{
reader->read(&tmpBuffer, 0, (int)maxSize, 0, true, true);
convolution.copyAndLoadImpulseResponseFromBuffer(tmpBuffer, localSampleRate, false, true, true, maxSize);
}
}
and the convolution itself at the end of PluginProcessor.cpp processBlock:
monoBuffer.copyFrom(0, 0, buffer, 0, 0, buffer.getNumSamples());
dsp::AudioBlock<float> block (monoBuffer);
convolution.process (dsp::ProcessContextReplacing<float> ( block ));
for (auto i = 0; i < totalNumInputChannels; ++i)
buffer.copyFrom(i, 0, monoBuffer, 0, 0, buffer.getNumSamples());
If anyone has an idea of what I am doing wrong here, I’ll sure take it!
Thanks for your attention,
David PQ