Hi, I’m trying to build a preset for changing the keyswitches of the Cinematic Studio Series. I want to do it by keyswitches but I need to specify not only the Note Number but also the velocity number. Can anyone guide me thru a button that sends a specific Note Number with a specific velocity value? I think I need Lua but I never touched the Lua -side of the E1…
I assumed you want to use a pad for this, right?
Normally, you could use a pad with a momentary toggle with message type “Note”, but then you cannot control the velocity.
Therefor, you need to create a toggle of message type Virtual or None, and assign it a LUA function. Let’s assume you want it to use note 60 and velocity 78, you could:
- assign 60 as On Value to the Control toggle
- create a function note78 and add some LUA to it.
The lua comes in two parts: first you set some initialising variables, so you don’t have to redo your code if for instance you change the MIDI channel or the port your preset is used for.
Do this by entering the following in lua :
local deviceId = 1 -- the device ID used in the E1 preset
local device = devices.get(deviceId)
local devPort = device:getPort()
local devChannel = device:getChannel()
Then you create your function note78 that will send the noteOn when you press the toggle (value = On Value, which is > 0) , and noteOff when you stop pressing (value = Off Value, which is 0):
function note78(valueObject, value)
if value> 0 then
midi.sendNoteOn(devPort, devChannel, value, 78)
else
midi.sendNoteOff(devPort, devChannel, value, 78)
end
end
So LUA would look like:
and the toggle could look like:
Try it out