MIDI Out Jack: Sending SysexMessage possible?

Post Reply
User avatar
AndreasFranke
Posts: 24
Joined: Fri Apr 16, 2021 10:27 am
Location: Germany
Contact:

MIDI Out Jack: Sending SysexMessage possible?

Post by AndreasFranke »

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. :lol:

Andreas
User avatar
honki-bobo
Posts: 305
Joined: Sat Nov 09, 2019 1:18 pm

Re: MIDI Out Jack: Sending SysexMessage possible?

Post by honki-bobo »

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:

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();
		}
	}
}
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.
Image
Monkey Business Audio
Modules - Music - Twitter - YouTube
User avatar
AndreasFranke
Posts: 24
Joined: Fri Apr 16, 2021 10:27 am
Location: Germany
Contact:

Re: MIDI Out Jack: Sending SysexMessage possible?

Post by AndreasFranke »

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:

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();
		}
	}
}
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.
Aaah, good hint. I will look at this....
Thank you so much!

Andreas
Post Reply

Return to “Module Designer”