I was looking for a way to change a control from another place, and did this with parameterMap.set.
That works beautifully, only… apart from the changed value of the ‘slave’ control, nothing else was occuring: no MIDI messaging was happening, the attached function was not fired.
And now I have discovered the benefits of
parameterMap.send (deviceId, parameterType, parameterNumber)
This one allows you to trigger a control, after you have set its value from somewhere else. And that really opens up a set of possibilities:
For instance, I’m making a preset for a bi-timbral synth, which will allow me to control both timbres together or separately, based on a pad position. In this example, the slave control has a parameter number that is 108 above the master control. The master controls have been given the linkPar function below.
To cope with negative values (due to SysEx values generated with Two’s complement sign mode), I add 128 for any negative value. Works nicely
Be aware however, pad values obtained are always 0 or 1, you don’t get the assigned On /Off values with the code below.
The link variable = when 1 both controls are tied together, when 0 they work independent
function linkPar(valueObject, value)
if link == 0 then
local message = valueObject:getMessage()
local parameterNumber = message:getParameterNumber()
if value < 0 then
value = value + 128
parameterMap.set(deviceId, PT_SYSEX, parameterNumber + 108, value)
parameterMap.send(deviceId, PT_SYSEX, parameterNumber + 108)
If you are into lua, parameterMap.send is a great function to experiment with. Would be happy to hear other ideas to use it.
Nice find. Thanks for posting. I’m not far enough into my lua to make use of it but I appreciate the community spirit.
yes, the parameterMap is the hearth of Electra in terms of handling parameters. It distributes all changes automatically and consistently, allowing the user’s Lua script to be simpler.
If you do a parameterMap.set(), does that trigger a MIDI message for that param, or is MIDI only generated when you do a parameterMap.send() ? Also - .send() only causes the specific MIDI message to be generated or all parameters get sent?
What I’m trying to do (and it may be the fault of the receiving device) is to adjust the start or end point of a sample while it’s being triggered and I want to make sure the start and end values never equal or cross each other.
To do that, I call a LUA function that check the value of whatever is being moved and if it gets close to the other parameter, the other parameter is shifted away. I’m doing this by updating the parameterMap for the value being adjusted and (possibly) for the other parameter using parameterMap.set() and then using parameterMap.send(). But it appears I’m getting multiple MIDI messages for a parameter change or something.
Just confused really and haven’t had any quality time to sit down with a MIDI monitor and see what’s being transmitted. In the past I was using parameterMap.set() to fill in values from a sysex dump and then just allowing the controls to transmit MIDI as they normally do. I think I’m causing headaches by ignoring what the controls are doing and writing/using parameterMap set() and send()
Would this all work if the controls were virtual and I just used parameterMap set() and send()?
A paramerMap.set() does not trigger the MIDI message. You indeed need the parameterMap.send to generate that specific MIDI message. Others aren’t sent.
How are you changing the first value? If you are changing that one already via a control, the control itself will trigger the MIDI message. For that control you do not need to update the parameterMap yourself. You shoud only apply the .set and .send to the control that needs to be changed indirectly…
And yes, I think making all controls virtual could also do the trick, because then none of them would send MIDI messages on their own.
At least that’s my understanding of parameterMap so far. I’m learning every day