This is the second forum post i’ve made about some strange behaviour ive envountered with the MPESynthesiser class:
I started testing with a sinewave today and found something very odd.
edit:^ this picture has a highpass filter on it, in reality the click is all 0 samples.
When i trigger a note off, there is a disconinuity in the waveform that results in a very nasty click. To my knowledge, I have not done anything to cause this.
I have not modified MPESynthesiser::noteReleased(), the expected voice triggers the note off, and in my voice’s noteStopped(), I do nothing (i,e. im not reseting the sample position or anything). This is because the sample must finish playing even after the note has been released.
void MyVoice::noteStopped(bool allowTailOff) {
}
void MyVoice::renderNextBlock(juce::AudioBuffer<float> &outputBuffer, int startSample, int numSamples){
//update pitch still gets the correct pitch value after the note has stopped
updatePitch();
//i have tried disabling the envelope, no luck
envelope.update(fadeIn, fadeOut, sample->sampleLength, smoothedPitch.getCurrentValue());
for (int32_t i = startSample; i < numSamples; i++) {
//process...
//and then update sample position
sourceSamplePosition += smoothedPitch.getNextValue();
//sample has finished playing, so now stop
if(sourceSamplePosition >= endIndex)
{
sourceSamplePosition = 0;
sampleIsPlaying = false;
clearCurrentNote();
break;
}
}
}
I have tried removing multiple moving parts of code in order to figure out why this is happening but have come up emty handed.
what am I missing?