Extracting/Translating Parts of a MIDI Message


    Aug 31 2013 | 10:36 pm
    I'm trying to write a patch that takes MIDI Sysex / MSC commands and tells me what cue list and cue is being fired. I need to somehow extract the [command number] from the following string:
    F0 7F [device_ID] 02 01 [command] [command_number] F7
    Any tips or examples would be much appreciated.

    • Sep 02 2013 | 10:15 am
      You can use [zl nth] if it's single integer of a known list length. If the list length varies or the command number is more than one integer, there are other approaches.
    • Sep 02 2013 | 4:54 pm
      Thanks for this. The command number will likely be more than one integer and the length will vary from scenario to scenario.
    • Sep 02 2013 | 8:23 pm
      Play around with the family of [zl] objects... they are perfect for this sort of thing. You'll need to customize your approach depending on the situation.
    • Sep 03 2013 | 5:39 pm
      the match object can also be useful:
    • Sep 04 2013 | 5:13 pm
      Realizing this is hacked together here's what I have thus far:
      I realize I need to go down the [zl] route as opposed to unpack. The examples have been very helpful thus far but here's what I'm running into. I need to extract the 7th integer through the end of the message which ends with 7F (the message will always vary in length). Furthermore, I need to translate these numbers into simple cue and cuelist numbers. Here's an explanation of what I'll see as my incoming commands:
      In terms of cues, the device can potentially deal with all the available cues, so this gets a bit tricky since hexadecimal doesn't deal with decimals. The numbering scheme then is not hexadecimal. Three simple rules: 1. Place a "3" in front of every digit of the number. 2. Place a "2E" wherever there is a decimal. 3. Place a "00" when separating a cue number from a cue list. This can be represented by: On the device: Cue xy/ab.c In Hexadecimal: 3a 3b 2E 3c 00 3x 3y Cue number examples: On the device: Cue 1/54 In Hexadecimal: 35 34 00 31 On the device: Cue 4/101 In Hexadecimal: 31 30 31 00 34 On the device: Cue 10/55.6 In Hexadecimal: 35 35 2E 36 00 31 30