teknoradio.nl channel 3 by ravers for ravers

Shopping Cart

Friends

Java SysEx programming

I’m taking my first steps into the world of JavaSound programming. The first thing I learned is that the Snow Leopard default javax.sound.midi.spi implementation is buggy when it comes to SysEx message transmission. For the time being I’m sticking with the MMJ library instead.

As an example, I’ve been trying to send a “SID Skip Patch” command to my SID station. The SysEx message for this command is F0 00 20 3C 01 00 03 F7.

The following code shows how to construct this message in Java (example based on SendSysex.java at jsresources.org):

The next step is to send the resulting byte array to a MIDI output. The following code works fine (tested with MIDI monitor and on a real SID station through an ESI MIDI Mate):
String[] outputs = de.humatic.mmj.MidiSystem.getOutputs();
int index = 0;

I’ve left out the code to determine the correct index as it is irrelevant. This could be a dropdown list in a GUI or some substring search or whatever. The following code tries to do the same thing using Snow Leopard libraries, but sends nothing at all:
javax.sound.midi.SysexMessage sysexMsg;
javax.sound.midi.Receiver receiver;
javax.sound.midi.MidiDevice.Info[] dev;
int index;
javax.sound.midi.MidiDevice myOutPort;

Related Posts:

One comment to Java SysEx programming

thanks for the MMJ code. i too have been struggling with Snow Leopard’s buggy Sys Ex code. @swingler says they want to fix the problems, but i’ve not seen any evidence so far. any idea whether the issues were addressed in later SL versions?