Lua adding patchnumber byte to patchrequest and response

Here is the Lua scripts I got for the Ensonig Mirage.
The oscPairSelect1 and oscPairSelect2 send a osc select sysex message and then stay quite a bit. Without the if contruct the select message would be send directly with the value update and the Mirage would only update the osc select parameters.
I tried to incorporate some kind of sleep/wait and this is the way I got it to work.

Now the getPatchNumberByte function does not work. I can really use some hints here.
What is the numerical id for a sysex message? I checked in the docs and in the schema but cannot find it. tried both 4 and 5.
parameterNumber = 40 is a control for which Patch you want to edit. Named “PATCH SELECT”. And the patch request needs to request this patch.
But when I press the patch select button I get always “00 00 23 01 43 04 00”

mirageSoundProcessDeviceId = 9
incCount = 1

function getPatchNumberByte()
-- parameterNumber 40 is patch select in the json file
local parameterNumber = 40
-- messagetype I am guessing as I cannot find the numerical id of sysex in the docs
patchNumber = parameterMap.get (mirageSoundProcessDeviceId, 4, parameterNumber )


return (patchNumber)

end


function oscPairSelect1()
    device = devices.get (mirageSoundProcessDeviceId)
if incCount == 1 then
 midi.sendSysex (PORT_1, {  0, 0, 35, 1, 67, 60, 1, 0 })
 incCount = incCount + 1
end
if (incCount == 15) then
   incCount = 1
end
if incCount > 1 then
   incCount = incCount + 1
end
end

function oscPairSelect2()
    device = devices.get (mirageSoundProcessDeviceId)
if incCount == 1 then
 midi.sendSysex (PORT_1, {  0, 0, 35, 1, 67, 60, 2, 0 })
 incCount = incCount + 1
end
if (incCount == 15) then
   incCount = 1
end
end

Ensoniq Mirage Soundprocess OS.epr (75.1 KB)

Haven’t had much time to look at the EPR yet, but the LUA documentation defines the various parameter types and for sysex they have the defined constant of PT_SYSEX. If you scan through the doc (in the Globals section) you’ll see the defined types for all the MIDI messages.

Note that I am going to be working on the same thing you are for my preset (how to let the user choose which preset to request/edit), so this discussion will be useful.

1 Like

Oooh I am such a noob :slight_smile:
Ah of course PT_SYSEX is a global variable that holds the ID.
It actually works! thanks a lot!

1 Like