Skip to content

Commit e86e1e3

Browse files
committed
Pitch tranpose fix
1 parent 48ff27f commit e86e1e3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/main/java/com/xxmicloxx/NoteBlockAPI/utils/NoteUtils.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,15 @@ public static float getPitchTransposed(Note note) {
8484
* @return pitch
8585
*/
8686
public static float getPitchTransposed(byte key, short pitch) {
87-
// Apply pitch to key
88-
key += pitch % 100;
89-
pitch /= 100;
87+
// Apply key to pitch
88+
pitch += key * 100;
9089

91-
while (key < 33) key += 12;
92-
while (key > 57) key -= 12;
90+
while (pitch < 3300) pitch += 1200;
91+
while (pitch > 5700) pitch -= 1200;
9392

94-
key -= 33;
93+
pitch -= 3300;
9594

96-
return pitches[key * 100 + pitch];
95+
return pitches[pitch];
9796
}
9897

9998
/**

0 commit comments

Comments
 (0)