From 7fcd8923fb38929825e231ab3bc7ced66c6f16e9 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Mon, 28 Aug 2023 20:56:20 +0700 Subject: [PATCH] midi pitchy thingy --- .../hhhzzzsss/songplayer/conversion/MidiConverter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 cf97b2a..764967d 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/conversion/MidiConverter.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/conversion/MidiConverter.java @@ -147,8 +147,12 @@ public class MidiConverter { return null; } - int pitch = (midiPitch-instrument.offset) + SongHandler.getInstance().pitch; - int noteId = pitch + instrument.instrumentId*25; + int pitch = ((midiPitch-instrument.offset) + SongHandler.getInstance().pitch) + 33; + + while (pitch < 33) pitch += 12; + while (pitch > 57) pitch -= 12; + + int noteId = (pitch - 33) + instrument.instrumentId*25; long time = microTime / 1000L; return new Note(noteId, time);