From 8d28ed8832afec67fde13e0a05c77ac7387da7dd Mon Sep 17 00:00:00 2001 From: hhhzzzsss Date: Tue, 4 Jun 2024 18:59:30 -0500 Subject: [PATCH] Fix midi velocity range --- .../github/hhhzzzsss/songplayer/conversion/MidiConverter.java | 1 + 1 file changed, 1 insertion(+) 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 5e996fd..2816e2c 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/conversion/MidiConverter.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/conversion/MidiConverter.java @@ -93,6 +93,7 @@ public class MidiConverter { int pitch = sm.getData1(); int velocity = sm.getData2(); if (velocity == 0) continue; // Just ignore notes with velocity 0 + velocity = (velocity * 100) / 127; // Midi velocity goes from 0-127 long deltaTick = event.getTick() - prevTick; prevTick = event.getTick(); microTime += (mpq/tpq) * deltaTick;