有谁知道 Java 世界中存在将 midi 音符编号映射到特定音符名称和八度音阶编号的任何东西。例如,参见参考表:
http://www.harmony-central.com/MIDI/Doc/table2.html
我想将 60 号 midi 音符映射到 octave 4 中相应的音符名称 (MiddleC)。我可以为此编写一个实用程序类/枚举,但这会相当乏味。有人知道吗?
我专门用它来用 Java 编写 Tenori-On/Monome 克隆,到目前为止一切都很好......
解决方案
这就是我最终使用的:
String[] noteString = new String[] { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };
int octave = (initialNote / 12) - 1;
int noteIndex = (initialNote % 12);
String note = noteString[noteIndex];