Keyboard widget velocity, TOPIC 2: [key 1 = velocity 10], [key 2 = velocity 20]

I was wondering if it’s possible to make, say, key 1 output a different velocity than the one specified in the ON field (in the widget’s keyboard section).

I use Bome MIDI Translator Pro which, unlike Cubase’s Generic Remote, it lets you filter the incoming MIDI note velocity. I’d find changing the keys velocity very useful (keyboard widget with keys having different velocity)…

You could use the keyboards script property to send custom messages depending on which note is pressed:

var velocities = [127, 127, 100, 80] // velocity map
var index = getIndex(id) // which key is pressed (starting with 0)
var keyValue = value[index] // retreive keys state (pressed or not, on or off)
var transformedValue = keyValue ? velocities[index] : 0 // if key is on, retrieve new velocity, otherwise 0

send("midi:myport", "/note", 1, index,  transformedValue)
2 Likes

I finally understood how to use the script, but the functionality of it is not quite what I’ve imagined.
To put it more clearly, I’m looking for a way of setting up the keyboard widget so that every key emits the same MIDI note, but not the same velocity.

Example:
→ Keyboard widget (with 127 keys): all keys emit MIDI note 81, channel 2
→ Velocity map: 1, 2, 3, 4, 5, 6, 7, 8, 9 … 127.

The above only needs a tiny adjustment to do that:

send("midi:myport", "/note", 1, FIXED_NOTE_NUMBER,  transformedValue)

1 Like

This is my final script:

// velocity map
var velocities = [1,2,3,4,5,6,7,8,9,10,11,
12,13,14,15,16,17,18,19,20,21,22,23]

// which key is pressed (starting with 0)
var index = getIndex(id)

// retreive keys state (pressed or not, on or off)
var keyValue = value[index]

// if key is on, retrieve new velocity, otherwise 0
var transformedValue = keyValue ? velocities[index] : 0

send("midi:SessionKiano", "/note", 2, 81,  transformedValue)

And this is the keyboard that awaits new applescript presets:

:innocent:

If your velocity map is linear you can simplify your script and get rid of the velocity map (index + 1 would give the same result as velocities[index]). Also, if you don’t need the note off events (velocity = 0), your script could be reduced to only these lines:

var index = getIndex(id)
var keyValue = value[index]
if (keyValue) send("midi:SessionKiano", "/note", 2, 81,  index + 1)
1 Like