I have been trying to implement Juce convolution from the DSP module in an audio plug-in. I know there are some example code, both at this forum as well as an Juce tutorial, but I can’t make it work in the Juce plug-in template. As a newbie, this may be easy to most of you and I really would appreciate it if anyone could help me.
void JConvAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages)
{
ScopedNoDenormals noDenormals;
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
buffer.clear (i, 0, buffer.getNumSamples());
dsp::AudioBlock<float> block (buffer);
dsp::ProcessContextReplacing<float> context (block);
conv.process(context);
}
Variables are implemented in the header file. The only thing that happens is that the volume is decreased, but not if I comment away the conv.process(context); line. Then, as expected, the audio just passes through.
Thank you for reaching out but I have already tried that order. I have also tried to load the impulse in the constructor. But it is likely that I am doing something wrong in the loadImpulseResponse function.
You basically mixed both of them: you are calling the first one with a string, which is then converted to (or interpreted as) audio data (floats), representing your impulse response.
To make it work: drop 245984 and put a File() around your path
Btw: it’s a funny mistake, I am wondering what my name sounds like
Perfect, thank you so much for the help! I have been trying for a while to interpret that part of the convolution class and to figure out which of the load methods I was supposed to use. This made my day
Don’t know if you solved this but I call Convolution’s prepare() method before its loadImpulseResponse() method. You can also load your .wav in as a binary and use that as the sourceData parameter for the implementation of the loadImpulseResponse() method that requires sourceData and sourceDataSize like so:
I have this in my code and it gives me an Error for convolution.loadImpulseResponse is there anything I am doing wrong
sorry if something obvious is missing, all this is very new to me.
VisualStudio 2019 is poniting the error just at “loadImpulseResponse” part
( E0304 no instance of overloaded function “juce::dsp::Convolution::loadImpulseResponse” matches the argument list test1_SharedCode C:\Users…\Documents\Juce\test1\Source\PluginProcessor.cpp 107 )
here is the code
void Test1AudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{