USB midi : sysex callback name ?

Status
Not open for further replies.

nlecaude

Well-known member
Hello,
I'm planning on using the teensy 3 to read sysex data from a computer.

Is the setHandleRealTimeSystem callback the one I need for sysex or is it another type of message ?

Thanks !
 
The Teensyduino documentation on USB MIDI is a little imprecise in it's terminology, which can be misleading. It says
The easiest way to receive MIDI messages is with functions that are automatically called when each type of message is received.

The official list of MIDI messages may be helpful.

A more precise statement would be
The easiest way to receive MIDI channel voice messages is with functions that are automatically called when each type of message is received.
which means there are callbacks for channel voice messages but not for channel mode, system common or real-time messages.

System exclusive is a system common message. However, scrolling down the Teensyduino documentation a little (sorry, there are no ids on headings so I can't point directly to it) you will find a section on Read & Query Functions. You can inspect messages with
Code:
  usbMIDI.getType()

This still doesn't cover all message types, but does cover sysex, which is what you want.
The supported types are: 0 = Note Off, 1 = Note On, 2 = Velocity Change, 3 = Control Change, 4 = Program Change, 5 = After Touch, 6 = Pitch Bend, 7 = System Exclusive
(It seems that 'velocity change' means polyphonic aftertouch and 'after touch' means channel aftertouch).

To get at the sysex date you need two more functions:
Code:
usbMIDI.getSysExArray()
usbMIDI.getData1()

For system exclusive messages, the message data is available as an array. Use getData1 to find the number of bytes stored in the array.
 
Status
Not open for further replies.
Back
Top