I vote yes! Please lets see your midi-scripting-thing.
I got what i was looking for with ModScript, but for now, all I wanted was for some knobs to control NRPN’s and CC’s for 8, 10 and 14 bit MIDI controls out of rack.
ModScript script
config.frameDivider = 32
config.bufferSize = 1
lastvalue = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
function NewPatchMaster(id)
mod = Module(id)
mod.params = {
["U1"] = {index = 0, min = 0.000000, max = 1.000000, default = 0.000000},
["U2"] = {index = 1, min = 0.000000, max = 1.000000, default = 0.000000},
["U3"] = {index = 2, min = 0.000000, max = 1.000000, default = 0.000000},
["U4"] = {index = 3, min = 0.000000, max = 1.000000, default = 0.000000},
["U5"] = {index = 4, min = 0.000000, max = 1.000000, default = 0.000000},
["U6"] = {index = 5, min = 0.000000, max = 1.000000, default = 0.000000},
["No name"] = {index = 6, min = 0.000000, max = 1.000000, default = 0.000000},
["No name"] = {index = 7, min = 0.000000, max = 1.000000, default = 0.000000},
}
mod.inputs = {
}
mod.outputs = {
}
mod.lights = {
{index = 0},
{index = 1},
{index = 2},
{index = 3},
{index = 4},
{index = 5},
{index = 6},
{index = 7},
{index = 8},
{index = 9},
{index = 10},
{index = 11},
{index = 12},
{index = 13},
{index = 14},
{index = 15},
{index = 16},
{index = 17},
{index = 18},
{index = 19},
{index = 20},
{index = 21},
{index = 22},
{index = 23},
{index = 24},
{index = 25},
{index = 26},
{index = 27},
{index = 28},
{index = 29},
{index = 30},
{index = 31},
{index = 32},
{index = 33},
{index = 34},
{index = 35},
{index = 36},
{index = 37},
{index = 38},
{index = 39},
{index = 40},
{index = 41},
{index = 42},
{index = 43},
{index = 44},
{index = 45},
{index = 46},
{index = 47},
{index = 48},
{index = 49},
{index = 50},
{index = 51},
{index = 52},
{index = 53},
{index = 54},
{index = 55},
{index = 56},
{index = 57},
{index = 58},
{index = 59},
{index = 60},
{index = 61},
{index = 62},
{index = 63},
{index = 64},
{index = 65},
{index = 66},
{index = 67},
{index = 68},
{index = 69},
{index = 70},
{index = 71},
}
return mod
end
myPM = NewPatchMaster(0x6775c924dc493)
myVPM = NewPatchMaster(0xf53a3a11ee620)
function process(block)
value = myPM:getParam("U1")
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[0]) then
lastvalue[0] = value
scaled = value * 100
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x48) --NRPN 48h
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
value = myPM:getParam("U2")
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[1]) then
lastvalue[1] = value
scaled = value * 100
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x49) --NRPN 49h
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
value = myPM:getParam("U3")
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[2]) then
lastvalue[2] = value
scaled = value * 100
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x4A) --NRPN 4Ah
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
value = myPM:getParam("U4")
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[3]) then
lastvalue[3] = value
scaled = value * 100
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x4B) --NRPN 4Bh
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
value = myPM:getParam("U5")
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[4]) then
lastvalue[4] = value
scaled = value * 100
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x4C) --NRPN 4Ch
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
value = myPM:getParam("U6")
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[5]) then
lastvalue[5] = value
scaled = value * 100
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x4D) --NRPN 4Dh
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
value = myVPM:getParam(0)
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[6]) then
lastvalue[6] = value
scaled = value * 200
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x40) --NRPN 40h
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
value = myVPM:getParam(1)
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[7]) then
lastvalue[7] = value
scaled = value * 200
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x41) --NRPN 41h
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
value = myVPM:getParam(2)
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[8]) then
lastvalue[8] = value
scaled = value * 200
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x42) --NRPN 42h
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
value = myVPM:getParam(3)
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[9]) then
lastvalue[9] = value
scaled = value * 200
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x43) --NRPN 43h
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
value = myVPM:getParam(4)
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[10]) then
lastvalue[10] = value
scaled = value * 200
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x44) --NRPN 40h
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
value = myVPM:getParam(5)
if value <= 0.01 then
value = 0
end
if (value ~= lastvalue[11]) then
lastvalue[11] = value
scaled = value * 200
upper = math.floor(scaled / 8)
lower = scaled % 8
sendMidiMessage(CC, 98, 0x45) --NRPN 40h
sendMidiMessage(CC, 63, lower) --Lower 3 bits of 8 bit value to CC#63
sendMidiMessage(CC, 6, upper) --Upper 5 bits of 8 bit value to CC#6
end
end
I’m working on optimizing my naive code, but there are many different kinds of controllers on the device.
grouping controls
for i = 0, 5 do
local value = myVPM:getParam(i)
if value <= 0.01 then
value = 0
end
if value ~= lastvalue[i + 12] then
lastvalue[i + 12] = value
scaled = value * 200
upper, lower = ??????????
sendMidiMessage(CC, 98, 0x40 + i)
sendMidiMessage(CC, 63, lower)
sendMidiMessage(CC, 6, upper)
end
end