From 44db9f75b0db74362a00ec06774e09b2c9eb254d Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Mon, 28 Aug 2023 17:12:33 +0700 Subject: [PATCH] fix "Invalid song format" on some NBS songs with the pitch --- .../github/hhhzzzsss/songplayer/conversion/NBSConverter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/conversion/NBSConverter.java b/src/main/java/com/github/hhhzzzsss/songplayer/conversion/NBSConverter.java index 26a1776..add90cb 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/conversion/NBSConverter.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/conversion/NBSConverter.java @@ -153,13 +153,13 @@ public class NBSConverter { layerVolume = nbsLayers.get(note.layer).volume; } - int key = note.key; + int key = note.key + SongHandler.getInstance().pitch; while (key < 33) key += 12; while (key > 57) key -= 12; int pitch = key-33; - int noteId = (pitch + instrument.instrumentId*25) + SongHandler.getInstance().pitch; + int noteId = pitch + instrument.instrumentId*25; song.add(new Note(noteId, getMilliTime(note.tick, tempo))); }