I think the original sysex message posted did not take into account some of the Electra One specifics.
From the X32 guide (or another tech reference):
Setting channel 01, EQ 2 frequency to 1kHz (actually 1020Hz, due to known discrete values)
OSC: /ch/01/eq/2/f~~~,f~~[0.57]
<OSCtext>: /ch/01/eq/2/f 1020
Sysex: F0 00 20 32 32 2F 63 68 2F 30 31 2F 65 71 2F 32 2F 66 20 31 30 32 30 F7
So you can see that the actual sysex bytes that need to be sent are the ASCII codes for the text characters. Please take a moment to verify you understand this part because it is key to adding more commands.
you can always leave this part the same: F0 00 20 32 32 (see later for a tweak to this)
This part: 2F 63 68 is the codes for /ch and so on.
Now for the Electra One specific stuff:
using the midi.sendSysex() command, you need to specify a port on the Electra One. Think of this as which physical connection you are using. If you have a MIDI DIN cable connected to port 1, then use PORT_1 and if connected to port 2, use PORT_2.
The second thing you need is a series of MIDI bytes that is the sysex message. The Electra One function expects this to be a series of numbers separated by commas.
In addition, I always specify the values as hexadecimal because it ends up matching what companies document (that’s why every value has 0x in front of it).
Finally, the Electra One automatically adds the F0 to the beginning and the F7 to the end, so you do not need to specify those bytes.
Putting this together to start a message would now look like this:
local sysexMessage = {0x00, 0x20, 0x32, 0x32, 0x2f, 0x63, 0x68, 0x2f, chHi, chLow, 0x2F, 0x65. 0x71, 0x2f, eqNum, 0x2f, 0x66, 0x20}
This way, you can use this comand and easily change the channel number and the EQ number and then append the frequency from the control being turned.
I’ll try to put it all into one function with values set for the EQ and channel. Hopefully it gets you something happening.
function OnX32EqPotTwist(valueObject, value)
-- Create the message string
local divisor = 10000
local nonzero = false
local chHi = 0 + 0x30
local chLow = 1 + 0x30
local eqNum = 2 + 0x30
local sysexMessage = {0x00, 0x20, 0x32, 0x32, 0x2f, 0x63, 0x68, 0x2f, chHi, chLow, 0x2F, 0x65, 0x71, 0x2f, eqNum, 0x2f, 0x66, 0x20}
while divisor >= 1 do
local nxt = math.floor(value / divisor)
if (nonzero == false) and (nxt > 0) then
nonzero = true
end
if (nonzero == true) then
sysexMessage[#sysexMessage+1] = (0x30+nxt)
end
value = value - (nxt * divisor)
divisor = divisor / 10
end
-- Send out message, you can use any port here of the E1 you wish
midi.sendSysex(PORT_1, sysexMessage)
end
The slightly obtuse syntax: sysexMessage[#sysexMessage+1] = (0x30+nxt) is:
the length (number of values) in the sysexMessage array is given by #sysexMessage
so, in the last position + 1, insert the next EQ value
every time through the loop, the size is 1 bigger, so the characters get added to the end.
The local variables chHi, chLow, eqNum are writeen the way they are to help remember that in the OSC world, they need to be ASCII numbers.