NoteOff is late

I’m making an arpegiator type thing. Sometimes I want new notes to cutoff old notes,
So I send the old note’s


noteoff at the same sample as the new noteon
But looking at the DAW the noteoffs are coming in a bit late.

Here is my debug output:

BLOCK : 1  PLAY note 89  noteon at sample : 0
BLOCK : 102   note 89 CUTOFF noteoff at sample : 31
BLOCK : 102  PLAY note 101  noteon at sample : 31

but in the DAW we see the noteOFF of midi note 89 appearing later than the noteON of midi note 101

Where exactly does that debug output come from? Is that the process call from audioprocessor?

It is just telling when the midimessages get scheduled
via DBG messages

cutoff noteoffs:

                        DBG("BLOCK : " << blockCount  << "   note " << otherIt->note << " CUTOFF noteoff at sample : " << beepSample);
                        auto message = juce::MidiMessage::noteOff(1, otherIt->note);                         
                        processedBuffer.addEvent(message, beepSample );

noteons:

                        auto message = juce::MidiMessage::noteOn(1, note, (juce::uint8)currentVelocity);
                        DBG("BLOCK : " << blockCount << "  PLAY note " << note << "  noteon at sample : " << beepSample);                                              
                        processedBuffer.addEvent(message, beepSample);

This is all happening in processBlock()

DAW had record quantize enabled.
Operator error.

That was my next suggestion :smiley: