I think I got something.
System event config link: grid-editor://?config-link=qlikj4hIixmivgj9MS1v
I implemented couple helper functions, which should give a starting point to work with sysex messages on Grid. The “init” event’s function scope is maxed out in this case, so refactoration might be needed to add more complex calculations. On midi rx itself, there are plenty of characters left.
Init:
buffer = {}
function len(arr)
local c = 1;
while arr[c] do
c = c + 1
end;
return c - 1
end;
function ins(x)
local l = len(buffer)
buffer[l + 1] = x;
return
end;
function rs(arr)
local c = 1;
while arr[c] do
c = c + 1;
if arr[c] == 240 then
elseif arr[c] == 247 then
print("stop")
log()
buffer = {}
break
end
end;
return
end;
function log()
local x = ""
for i = 1, len(buffer), 1 do
x = x .. " " .. buffer[i]
end;
print(x)
return
end
midi rx:
local ch, cmd, p1, p2 = midi.ch, midi.cmd, midi.p1, midi.p2
ins(midi.ch)
ins(midi.cmd)
ins(midi.p1)
ins(midi.p2)
rs(buffer)
I have written the instructions into the preset on Profile Cloud, copying it here:
Implemented helper functions to process incoming SysEx messages. SysEx received by Grid come in decimal values, 240 marks message start, 247 message end.
Global buffer
variable holds the sysex messages. On midi rx the data is passed into the ins()
insert function, that’s how the bits are collected. After every midi rx trigger, rs()
function checks if the stop value is received. the log()
is used to print the sysex in the debug window.
Functions:
- len: calculates the length of the input array
- ins: puts the input value to the end of the buffer array
- rs: checks for reset, the start and stop value
- log: debug print
This is how debug looks like if I send a test sysex command to Grid, using SysEx Librarian on MacOS:
A special function should be needed to get the correct indexes of the buffer to set the LED color of the LEDs, happy to help if you can send me the .syx file for demo data coming out of cubase.