Hello,
just to be sure, @martin what happened on the E1 when receiving empty bits in a response?
For instance, here is a LUA log of what is received by the E1 when switching the Chorus switch on the Juno 106:
10:21:57.500 lua: ----------------------------------- sysex message received: interface=0
10:21:57.506 lua: byte[1]= f0 >> 0.0 0 0 0 1 1 1 1
10:21:57.509 lua: byte[2]= 41 >> 1.0 0 0 0 0 0 1
10:21:57.510 lua: byte[3]= 32 >> 0.0 1 0 0 1 1
10:21:57.512 lua: byte[4]= 01 >> 1.0
10:21:57.513 lua: byte[5]= 10 >> 0.0 0 0 0 1
10:21:57.515 lua: byte[6]= 19 >> 1.0 0 0 1 1
10:21:57.516 lua: byte[7]= f7 >> 1.0 1 1 0 1 1 1 1
10:21:57.517 lua: ---------------------------------------------------------------------
When filling the empty bits by 0 in my LUA code, it looks like that:
10:25:14.658 lua: ----------------------------------- sysex message received: interface=0
10:25:14.664 lua: byte[1]= f0 >> 0.0 0 0 0 1 1 1 1
10:25:14.667 lua: byte[2]= 41 >> 1.0 0 0 0 0 0 1
10:25:14.669 lua: byte[3]= 32 >> 0.0 1 0 0 1 1 0
10:25:14.671 lua: byte[4]= 01 >> 1.0 0 0 0 0 0 0
10:25:14.673 lua: byte[5]= 10 >> 0.0 0 0 0 1 0 0
10:25:14.675 lua: byte[6]= 19 >> 1.0 0 0 1 1 0 0
10:25:14.677 lua: byte[7]= f7 >> 1.0 1 1 0 1 1 1 1
10:25:14.680 lua: ---------------------------------------------------------------------
I guess empty bits are not converted to 0 when received as a response, right? Would it be safe to make the E1 behaves like that?
Because the Juno 106 do not send all the bits for some parameters (I don’t know why) I suppose it is why the response is not understood by the mapping response recipe… That’s it?
I manage to bypass my issues by script, but it make the preset heavier for no reason. Nonetheless, I’m really happy to have succeeded, it makes me learn a lot. I’ll integrate it to the public Juno 106 preset later, since I want to clean and optimize my code.
Here is my LUA code to test sysex message received for those interested:
-- HELPERS ---------------------
midiInput = {
interface = MIDI_IO,
port = PORT_1
}
-- convert decimal to binary
local function toBits(num, bits)
-- returns a table of bits, LSB first.
local t={} -- will contain the bits
bits = bits or 7
while num>0 do
rest=math.fmod(num,2)
t[#t+1]=rest
num=math.floor((num-rest)/2)
end
for i = #t+1, bits do -- fill empty bits with 0
t[i] = 0
end
return t
end
function midi.onSysex (midiInput, sysexBlock)
print ("----------------------------------- sysex message received: interface=" .. midiInput.interface)
for i = 1, sysexBlock:getLength () do
local stByte = (string.format ("byte[%d]= %x", i, sysexBlock:peek (i))) -- "%d" is for decimal / "%x" is for hexadecimal
local bits = toBits(sysexBlock:peek (i))
local stBits = (table.concat(toBits(sysexBlock:peek (i)), ' ')) --print (table.concat(bits, ' '))
print ((stByte) .. " >> " .. (stBits))
end
print ("---------------------------------------------------------------------")
end