fix required offset when reading MIDI data near loop end/start