diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/conversion/MidiConverter.java b/src/main/java/com/github/hhhzzzsss/songplayer/conversion/MidiConverter.java index f36b74a..89fb227 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/conversion/MidiConverter.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/conversion/MidiConverter.java @@ -126,6 +126,17 @@ public class MidiConverter { } song.sort(); + + // Shift to beginning if delay is too long + if (!song.notes.isEmpty()) { + long shift = song.notes.get(0).time - 1000; + if (song.notes.get(0).time > 1000) { + for (Note note : song.notes) { + note.time -= shift; + } + } + song.length -= shift; + } return song; }