我想创建一个程序来记录我在midi启用的钢琴上播放的音符,该钢琴通过猩红色的2i4连接到我的电脑,并在我播放时在控制台中显示音符。我已经阅读了MIDI部分的Java文档,但是我很困惑数据的位置,以及我如何显示它。这是我到目前为止所写的:
public class Get {
public static void main(String[] args) throws MidiUnavailableException{
javax.sound.midi.MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo();
System.out.println("Select Midi Device Number:");
for(int i=0;i<infos.length;i++){
System.out.println("Device Number " + i + ": " + infos[i].getName() + " - " + infos[i].getDescription());
}
System.out.println("Enter device number then press enter...");
Scanner in = new Scanner(System.in);
int deviceNumber = in.nextInt();
MidiDevice inputDevice = MidiSystem.getMidiDevice(infos[deviceNumber]);
inputDevice.open();
Transmitter trans = inputDevice.getTransmitter();
System.out.println(trans.toString());
}
}