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.
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.
-- 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 })
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.