Handling pitch bend with MPESynthesiser in different daws


I am in the process of implementing pitch bend into my MPESynthesiser-based Sampler. A feature which i have decided to implement like this:

class Sampler : MPESynthesiser
Sampler() {
class Voice : MPESynthesiserVoice
void updatePitch()
    pitchBendRatio = std::pow(2.0, (double)(getCurrentlyPlayingNote().totalPitchbendInSemitones) / 12.0);
    //pitchDelta calculated in noteStarted()
    smoothedPitch.setTargetValue(pitchDelta * pitchBendRatio);

void renderNextBlock(juce::AudioBuffer<float> &outputBuffer, int startSample, int numSamples) override

    for (int32_t i = startSample; i < numSamples; i++) 
        //process and then increment samplePosition
        samplePosition += smoothedPitch.getNextValue()

this works wonderfully when running in the AudioPluginHost but as soon as I bring it to Ableton Live I get lots of strange artefacts. As if the pitch bend is not getting updated enough times per second.
How do other people handle pitch bend in their MPE synths? Are there problems in my approach?


Furthermore, the MPESynthesierVoice seems stops reacting to changes in pitch bend after its been released. Even though I have overriden “noteReleased” and added own behaviour. Is there no way to just get the current state of the pitch bend?

You need to smooth the MPE values and the pitch bend, especially when used for bigger frequency ranges. You can do this in a linear interpolation or with something like a low-pass filter.

Yes, I noticed that too. Someone already reported this in the past. If I remember right this was done this way by design. I think it’s because there has to be a note with a MIDI channel where the modulation can be attached. Modulation while the note releases is not possible. Every new note also starts with the default state if I remember right.

Edit: you could try to handle the master pitchwheel separately from the MPE “Manager Channel”. This way You may have a continuous pitch wheel modulation value that also works after the note release.

From MPE specification (3.3.3 Pitch Bend):

Under MPE, control of a note ceases once Note Off has occurred. As a consequence, any feature which
requires continual transmission of Pitch Bend for the purposes of automation, such as a controller’s
automatic pitch quantization, must be designed to have no effect once a note has been released. …

The behavior of Master Pitch Bend is unaltered. It applies to every note within the Zone that is still sounding:
even those that have passed into their Note Off phase and are sustained only by a pedal or a release envelope.

i am?
smoothedPitch is a juce::SmoothedValue< float > with a ramp length of 0.01 seconds.

I then update it in renderNextBlock

//updates once per sample
        samplePosition += smoothedPitch.getNextValue();

Do you know then a way to get the state of the master pitch bend without using