MIDI: Why controllers 72-73 dont work?
publicclass MIDITest
{
publicstaticvoid main(String[] args)throws MidiUnavailableException, InvalidMidiDataException, IOException
{
Synthesizer synth =null;
Soundbank soundbank;
MidiDevice device =null;
try
{
MidiDevice.Info[] devices = MidiSystem.getMidiDeviceInfo();
for(int i = 0; i < devices.length; i++)
{
if((MidiSystem.getMidiDevice(devices[i])instanceof Synthesizer) && devices[i].getName().contains("Java"))
{
System.out.println("Synthesizer: " + devices[i].getName());
device = MidiSystem.getMidiDevice(MidiSystem.getMidiDeviceInfo()[i]);
if(!device.isOpen())
{
device.open();
}
synth = (Synthesizer) device;
synth.open();
}
}
// load soundbank
File file =new File("./Symb_tourtle_4.rmf");
soundbank = MidiSystem.getSoundbank(file);
// get instruments
synth.loadAllInstruments(soundbank);
System.out.println("Default soundbank: " + synth.getDefaultSoundbank());
// choose channel
MidiChannel channel = synth.getChannels()[3];//10 - procedural
// set bank & program
channel.programChange(2, 0);
System.out.println("Local control is supported: " + channel.localControl(false));
channel.controlChange(91, 3);
channel.controlChange(72, 2);
channel.controlChange(73, 1);
System.out.println("91(reverb): " + channel.getController(91));
System.out.println("72( Sound Release Time): " + channel.getController(72));
System.out.println("73( Sound Attack Time): " + channel.getController(73));
channel.noteOn(57, 127);//Attack Time
for (int i = 127; i > 0; i--)
{
Thread.sleep(127);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

