I am trying to parse the input from a midi device connected to my laptop. So I want to locate the device, connect to it and receive the input from it.
I started with select midi device in java, but I am having some trouble getting my way around this one.
I considered jFugue that offers a way to access the java sound API but since I don’t have their book, there was no resource.
Also, jMusic offers some functionality but it’s mostly for midi file IO and not a midi device IO.
So a do you know of any practical tutorial on the subject(probably using directly the Java sound API).
As always,
any help more than appreciated!
Have look at Java Sound tutorial: http://docs.oracle.com/javase/tutorial/sound/accessing-MIDI.html It contains nice explanation of Java MIDI API and also contains example source code on how to enumerate devices.
There is following sample source code:
When you acquire MIDI device, you can (in previous source code)
infos[i].getNameinfos[i].getVendor()device.getMaxReceivers()anddevice.getMaxTransmitters().For more details, see API docs:
– http://docs.oracle.com/javase/1.5.0/docs/api/javax/sound/midi/MidiDevice.html
– http://docs.oracle.com/javase/1.5.0/docs/api/javax/sound/midi/MidiDevice.Info.html