I wired my audio processors like this. You can see that there is an fx processor that processes microphone data and adds effects, and a sampler that plays sample sounds. After all the processed sound, I add a recorder:
void WiringProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiBuffer) {
fx->processBlock(buffer, midiBuffer);
sampler->processBlock(buffer, midiBuffer);
float **inputChannelData = buffer.getArrayOfWritePointers();
simpleRecorder->processInput(const_cast<const float **>(inputChannelData),buffer.getNumChannels(), buffer.getNumSamples());
}
The problem is that the sampler sounds are coming out on the speaker with some echo. Even though fx processes before sampler, the sample sounds come out with an echo. I used headphones to rule out the speaker being captured by the microphone. How is it possible?
When I mute fx
, that is, set its gain to minimum, there’s no echo on the sampler sounds. How can the fx alter the sample sounds if it processes things before them?
Notice that I make fx
and sampler
share the same processBlock
because I want to record both into simpleRecorder
. I could make them both in different processBlock
s but then it’d be hard to join them together again.
Is there a better way to do what I’m doing?