addEvent problem

                auto message = juce::MidiMessage::noteOn (1, note, (juce::uint8) 100);
                processedBuffer.addEvent(message, beepSample);
                message = juce::MidiMessage::noteOff(1, note);
                processedBuffer.addEvent(message, beepSample+1);

I get no sound when beepSample = 0
or 62, or 63 (with buffer size of 64 samples)

If I put in this snippet

        if (beepSample == 0) ++beepSample;
        if (beepSample == blockSize) --beepSample;
        if (beepSample == (blockSize-1)) --beepSample;

then it works every time.
but I’m confused why I should need to do this…\