Juce Synthesiser Problem: popping sound accompanies midi on/off messages

You’re incrementing startSample on each iteration of the loop per sample. You might find it easier to reason about what’s going on if your for loop is

for (int i = 0; i < numSamples; ++i)

Then just offset i every time you use it to write the output e.g.,

outputBuffer.setSample (channel, i + startSample, sum);

Ah! Works perfectly, thank you.

1 Like

Great, — glad to help!

1 Like