Ahoi!
A quick question: Is it possible to send other MIDI message types like SysexMessage, instead of ShortMessage with VM' MIDI Out Jacks?
I'm asking for a friend.
Andreas
MIDI Out Jack: Sending SysexMessage possible?
- AndreasFranke
- Posts: 24
- Joined: Fri Apr 16, 2021 10:27 am
- Location: Germany
- Contact:
- honki-bobo
- Posts: 310
- Joined: Sat Nov 09, 2019 1:18 pm
Re: MIDI Out Jack: Sending SysexMessage possible?
Hey Andreas,
I have no experience with sending MIDI SysEx data in VMD, but from looking at the JavaDoc of MidiMessage, ShortMessage and SysexMessage I think it should be possible to create valid SysEx data and send it as ShortMessage. Both, ShortMessage and SysexMessage inherit the protected method setMessage(byte[] data, int length). I don't have the time to test this right now, but you can try to implement a class that extends ShortMessage and make the setMessage(byte[] data, int length) method public like so:
The byte array would contain your SysEx data, and length is simply the length of the array. You can handle MyMidiMessage exactly like ShortMessage and try to pass it to the MIDI Out Jack. If the compiler is complaining, add a cast to ShortMessage.
I have no experience with sending MIDI SysEx data in VMD, but from looking at the JavaDoc of MidiMessage, ShortMessage and SysexMessage I think it should be possible to create valid SysEx data and send it as ShortMessage. Both, ShortMessage and SysexMessage inherit the protected method setMessage(byte[] data, int length). I don't have the time to test this right now, but you can try to implement a class that extends ShortMessage and make the setMessage(byte[] data, int length) method public like so:
Code: Select all
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.ShortMessage;
public class MyMidiMessage extends ShortMessage {
public void setMessage(byte[] data, int length) {
try {
super.setMessage(data, length);
} catch (InvalidMidiDataException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
- AndreasFranke
- Posts: 24
- Joined: Fri Apr 16, 2021 10:27 am
- Location: Germany
- Contact:
Re: MIDI Out Jack: Sending SysexMessage possible?
Aaah, good hint. I will look at this....honki-bobo wrote: ↑Sun May 30, 2021 1:07 pm Hey Andreas,
I have no experience with sending MIDI SysEx data in VMD, but from looking at the JavaDoc of MidiMessage, ShortMessage and SysexMessage I think it should be possible to create valid SysEx data and send it as ShortMessage. Both, ShortMessage and SysexMessage inherit the protected method setMessage(byte[] data, int length). I don't have the time to test this right now, but you can try to implement a class that extends ShortMessage and make the setMessage(byte[] data, int length) method public like so:
The byte array would contain your SysEx data, and length is simply the length of the array. You can handle MyMidiMessage exactly like ShortMessage and try to pass it to the MIDI Out Jack. If the compiler is complaining, add a cast to ShortMessage.Code: Select all
import javax.sound.midi.InvalidMidiDataException; import javax.sound.midi.ShortMessage; public class MyMidiMessage extends ShortMessage { public void setMessage(byte[] data, int length) { try { super.setMessage(data, length); } catch (InvalidMidiDataException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Thank you so much!
Andreas