# midi.sendSysex question, multiple parameterNumbers

**URL:** <https://forum.electra.one/t/midi-sendsysex-question-multiple-parameternumbers/2654>\
**Category:** General discussion\
**Created:** [January 28, 2024, 4:45am UTC](https://forum.electra.one/t/midi-sendsysex-question-multiple-parameternumbers/2654 "2024-01-28T04:45:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![javelin276](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/javelin276/32/2625_2.png) [@javelin276](https://forum.electra.one/u/javelin276)\
**Post date:** [January 28, 2024, 4:45am UTC](https://forum.electra.one/t/midi-sendsysex-question-multiple-parameternumbers/2654/1 "2024-01-28T04:45:12Z")

</div>

Hi Guys, can the midi.sendSysex command send out multiple parameterNumbers like the JSON code can take as arguments?

In LUA, midi.sendSysex (PORT\_1, { 0x43, 0x10, 0x5E, 0x60, 0x00, 0x03, 0x00, value })

Can the ‘value’ LUA piece above be crafted to splice two parameterNumbers together like I can in JSON:  
“data”: [  
“F0”,  
“43”,  
“10”,  
“5E”,  
“60”,  
“00”,  
“29”,  
“00”,  
{  
“type”: “value”,  
“rules”: [  
{  
“parameterNumber”: 94,  
“type”: “sysex”,  
“parameterBitPosition”: 0,  
“byteBitPosition”: 3,  
“bitWidth”: 3  
},  
{  
“type”: “sysex”,  
“parameterNumber”: 95,  
“parameterBitPosition”: 0,  
“byteBitPosition”: 0,  
“bitWidth”: 3  
}  
]  
},  
“F7”  
],

---

<div class="post-metadata">

**Author:** ![NewIgnis](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/newignis/32/767_2.png) [@NewIgnis](https://forum.electra.one/u/NewIgnis)\
**Post date:** [January 28, 2024, 9:21am UTC](https://forum.electra.one/t/midi-sendsysex-question-multiple-parameternumbers/2654/2 "2024-01-28T09:21:19Z")

</div>

Yes it can. As you see, the payload in the sendSysex statement is a table where each element represents the value of a byte pair (the value does not need to be in hex format, by the way). You can use any constant or function in here. Also the value belonging to a parameter.

Some sysex commands require you for instance to add a device ID, a MIDI channel or a checksum to a sysex. These too are just set up as elements in the payload table.

---

<div class="post-metadata">

**Author:** ![oldgearguy](https://avatars.discourse-cdn.com/v4/letter/o/f4b2a3/32.png) [@oldgearguy](https://forum.electra.one/u/oldgearguy)\
**Post date:** [January 28, 2024, 12:14pm UTC](https://forum.electra.one/t/midi-sendsysex-question-multiple-parameternumbers/2654/3 "2024-01-28T12:14:13Z")

</div>

Just note that the data you supply to the midi.sendSysex() _should not_ include the F0 and  
F7 bytes.

---

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [January 28, 2024, 4:24pm UTC](https://forum.electra.one/t/midi-sendsysex-question-multiple-parameternumbers/2654/4 "2024-01-28T16:24:16Z")

</div>

> [@javelin276](#):
>
> Hi Guys, can the midi.sendSysex command send out multiple parameterNumbers like the JSON code can take as arguments?
> 
> In LUA, midi.sendSysex (PORT\_1, { 0x43, 0x10, 0x5E, 0x60, 0x00, 0x03, 0x00, value })

as you are in Lua you can assemble array of the bytes as you wish. see the example below. It is just important to keep bytes in 7bit number range.

```auto
    -- you need to know what device to use
    local yourDeviceId = 1

    -- get values of the parameters
    local parameter94 = parameterMap.get(yourDeviceId, PT_SYSEX, 94)
    local parameter95 = parameterMap.get(yourDeviceId, PT_SYSEX, 95)

    -- perform bitwise operations to compose the byte value
    -- note, this replicates your JSON example
    local byteValue = ((parameter94 & 0x07) << 3) | (parameter95 & 0x07)

    -- you can optionally check if the byteValue is in 7bit range
    assert(byteValue == (byteValue & 0x7F))

    -- you can optionally just trim it to 7bit range
    byteValue = byteValue & 0x7F

    -- send the message out
    midi.sendSysex (PORT_1, { 0x43, 0x10, 0x5E, 0x60, 0x00, 0x03, 0x00, byteValue })

```

---

<div class="post-metadata">

**Author:** ![javelin276](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/javelin276/32/2625_2.png) [@javelin276](https://forum.electra.one/u/javelin276)\
**Post date:** [January 28, 2024, 6:29pm UTC](https://forum.electra.one/t/midi-sendsysex-question-multiple-parameternumbers/2654/5 "2024-01-28T18:29:39Z")

</div>

Thanks for the example Martin, I haven’t ever used any of the bitwise operations and an example teaches me better than anything else!  
NewIgnus, I can see now that I’m going to have to go at it differently than the JSON code, I was hoping there was a shortcut. I need parameterMap.get’s to snag the values first.  
Oldgearguy, thanks. I do know not to include the F0 and F7 bytes, they’re excluded from my midi-sendSysex example.
