Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: USB midi : sysex callback name ?

  1. #1
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467

    USB midi : sysex callback name ?

    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 !

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Location
    Boston, MA, USA
    Posts
    1,112
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •