It seems to be working for me. Can you post the function code you’ve got?
Here is the output FOR ALL 37 VALUES from the following function using the sysex string
- f0 01 05 2c 00 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0a f7
>> 37
f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff af
—————
right shift OSC COARSE FREQUENCY by 0
[1] n=48
—————
right shift LFO FREQ by 1
[2] n=15
—————
right shift LFO AMOUNT by 5
left shift LFO AMOUNT by 3
[3] n=31
—————
right shift OSC SAW by 2
[4] n=1
—————
right shift OSC PULSE by 4
[5] n=1
—————
right shift MIXER by 2
[6] n=15
—————
right shift FIL ENV RELEASE by 4
[7] n=15
—————
right shift FIL ENV DECAY by 4
[8] n=15
—————
right shift OSC TRI AMOUNT by 0
[9] n=63
—————
right shift FIL ENV AMOUNT by 4
[10] n=15
—————
right shift FIL ENV ATTACK by 0
[11] n=15
—————
right shift OSC TRI by 3
[12] n=1
—————
right shift VOICE VOLUME by 6
left shift VOICE VOLUME by 2
[13] n=15
—————
right shift OSC ENV ATTACK by 3
[14] n=15
—————
right shift UNISON by 7
[15] n=1
—————
right shift GLIDE RATE by 3
[16] n=15
—————
right shift LFO SHAPE by 0
[17] n=1
—————
right shift OSC ENV RELEASE by 0
[18] n=7
—————
right shift OSC FINE FREQUENCY by 6
left shift OSC FINE FREQUENCY by 2
[19] n=31
—————
right shift OSC ENV DECAY by 7
left shift OSC ENV DECAY by 3
[20] n=57
—————
right shift PULSE WIDTH by 3
left shift PULSE WIDTH by 5
[21] n=63
—————
right shift OSC ENV SUSTAIN by 3
[22] n=15
—————
right shift OSC ENV INVERT by 5
[23] n=1
—————
right shift FIL ENV INVERT by 6
[24] n=1
—————
right shift FIL FULL by 5
[25] n=1
—————
right shift FIL HALF by 4
[26] n=0
—————
right shift LFO FILTER by 3
[27] n=1
—————
right shift OSC ENV AMOUNT by 7
left shift OSC ENV AMOUNT by 1
[28] n=15
—————
right shift LFO PULSE by 2
[29] n=1
—————
right shift FIL ENV SUSTAIN by 0
[30] n=15
—————
right shift RESONANCE by 6
left shift RESONANCE by 2
[31] n=63
—————
right shift LFO OSC by 1
[32] n=1
—————
right shift FILTER CUTOFF by 7
left shift FILTER CUTOFF by 1
[33] n=127
—————
right shift AMP ENV RELEASE by 6
left shift AMP ENV RELEASE by 2
[34] n=15
—————
right shift AMP ENV SUSTAIN by 2
[35] n=15
—————
right shift AMP ENV DECAY by 6
left shift AMP ENV DECAY by 2
[36] n=15
—————
right shift AMP ENV ATTACK by 2
[37] n=15
—————
function run(m)
local t={}
mbTemp32Byte=MemoryBlock()
mbTemp32Byte:append(m:getData():getRange(4, 32))
m16=MemoryBlock()
if mbTemp32Byte:getSize()==32 then
--assert(mbTemp32Byte:getSize()==32) -- development code can be deleted
for n=0,mbTemp32Byte:getSize()-1,2 do
local msb=bit.lshift(mbTemp32Byte:getByte(n+1),4)
local lsb=mbTemp32Byte:getByte(n)
table.insert(t,msb+lsb)
end
m16:createFromTable(t)
console(String(m16:toHexString(1))) -- let's see what we got
panel:getLabel("debug"):setText(m16:toHexString(1))
modulators={
["OSC COARSE FREQUENCY"]={byte={0},position={0x3f},lShift={0},rShift={0}},--A
["OSC FINE FREQUENCY"]={byte={0,1},position={0xC0,0x07},lShift={0,2},rShift={6,0}},--B
["GLIDE RATE"]={byte={0x01},position={0x78},lShift={0},rShift={3}}, --C
["OSC ENV AMOUNT"]={byte={0x01,0x02},position={0x80,0x07},lShift={0,1},rShift={7,0}}, --D
["OSC ENV ATTACK"]={byte={0x02},position={0X78},lShift={0},rShift={3}}, --E
["OSC ENV DECAY"]={byte={0x02,0x03},position={0X80,0X07},lShift={0,3},rShift={7,0}},--F
["OSC ENV SUSTAIN"]={byte={0x03},position={0x78},lShift={0},rShift={3}},--G
["OSC ENV RELEASE"]={byte={0x04},position={0x07},lShift={0},rShift={0}},--H
["PULSE WIDTH"]={byte={0x04,0x05},position={0xF8,0x01},lShift={0,5},rShift={3,0}},--I
["LFO FREQ"]={byte={0x05},position={0x1E},lShift={0},rShift={1}},--J
["LFO AMOUNT"]={byte={0x05,0x06},position={0xE0,0x03},lShift={0,3},rShift={5,0}},--K
MIXER={byte={0x06},position={0X3C},lShift={0},rShift={2}},--L
["FILTER CUTOFF"]={byte={0x06,0x07},position={0x80,0x3F},lShift={0,1},rShift={7,0}},--M
RESONANCE={byte={0x07,0x08},position={0xC0,0x0F},lShift={0,2},rShift={6,0}},--N
["FIL ENV AMOUNT"]={byte={0x08},position={0xF0},lShift={0},rShift={4}},--O
["FIL ENV ATTACK"]={byte={0x09},position={0x0F},lShift={0},rShift={0}},--P
["FIL ENV DECAY"]={byte={0x09},position={0xF0},lShift={0},rShift={4}},--Q
["FIL ENV SUSTAIN"]={byte={0x0A},position={0x0F},lShift={0},rShift={0}},--R
["FIL ENV RELEASE"]={byte={0x0A},position={0xF0},lShift={0},rShift={4}},--S
["OSC TRI AMOUNT"]={byte={0x0B},position={0x3F},lShift={0},rShift={0}},--T
["VOICE VOLUME"]={byte={0x0B,0x0C},position={0xC0,0x03},lShift={0,2},rShift={6,0}},--U
["AMP ENV ATTACK"]={byte={0x0C},position={0x3C},lShift={0},rShift={2}},--V
["AMP ENV DECAY"]={byte={0x0C,0x0D},position={0xC0,0x03},lShift={0,2},rShift={6,0}},--W
["AMP ENV SUSTAIN"]={byte={0x0D},position={0x3C},lShift={0},rShift={2}},--X
["AMP ENV RELEASE"]={byte={0x0D,0x0E},position={0xC0,0x03},lShift={0,2},rShift={6,0}},--Y
["OSC SAW"]={byte={0x0E},position={0x04},lShift={0},rShift={2}},--Z0
["OSC TRI"]={byte={0x0E},position={0x08},lShift={0},rShift={3}},--Z1
["OSC PULSE"]={byte={0x0E},position={0x10},lShift={0},rShift={4}},--Z2
["OSC ENV INVERT"]={byte={0x0E},position={0x20},lShift={0},rShift={5}},--Z3
["FIL ENV INVERT"]={byte={0x0E},position={0x40},lShift={0},rShift={6}},--Z4
UNISON={byte={0x0E},position={0x80},lShift={0},rShift={7}},--Z5
["LFO SHAPE"]={byte={0x0F},position={0x01},lShift={0},rShift={0}},--Z6 (1=TRI)
["LFO OSC"]={byte={0x0F},position={0x02},lShift={0},rShift={1}},--Z7
["LFO PULSE"]={byte={0x0F},position={0x04},lShift={0},rShift={2}},--Z8
["LFO FILTER"]={byte={0x0F},position={0x08},lShift={0},rShift={3}},--Z9
["FIL HALF"]={byte={0x0F},position={0x10},lShift={0},rShift={4}},--ZA
["FIL FULL"]={byte={0x0F},position={0x20},lShift={0},rShift={5}},--ZB
}
console('---------------')
counter=1
for k in pairs (modulators) do
n=0
for j,v in ipairs (modulators[k].byte) do
if j == 1 then
n=n+bit.rshift(bit.band(m16:getByte(v),modulators[k].position[j]),modulators[k].rShift[j])
console("right shift "..k.." by "..modulators[k].rShift[j])
else
console("left shift "..k.." by "..modulators[k].lShift[j])
n=n+bit.lshift(bit.band(m16:getByte(v),modulators[k].position[j]),modulators[k].lShift[j])
end
end
console(String(string.format("[%d] n=%d",counter,n)))
console('---------------')
counter=counter+1
--panel:getModulatorByName(k)getComponent():setValue(n,true)
end
end -- is 32 bytes coming in
end -- method