Hey Jean, I have a feature request. I noticed that you implemented the Keyboard to work in a similar way to the Kontakt Keyboard and velocity changes as you press on different parts of each key. That's great. However, I was wondering if you could extend that functionality with buttons.
Here's the start of a Harp. It uses a fader to control Velocity. However, doing this just makes things unrealistic as nobody would ever play a Harp (or any other instrument you could use with this). So I started thinking, "What if the buttons acted like the Kontakt keyboard and when you run you finger over the buttons, you could go higher on the buttons and it would transmit higher velocities and when running your finger lower on the buttons, they would transmit lower velocities. It would truly make this harp a dynamic instrument. Having an option to use both Velocity and CC would be even better as Virtual Instruments use CCs to go through dynamic layers (and some have both options).
Here's a screen shot and if you can imagine when running you finger over it, the buttons respond from low to high. It would be killer!
This seems very nice!
But unfortunatly I'm very new with open stage control and coding (like very very new...)
Could you explain how to achieve this? (where to write what...?)
First you'll need to install the latest v1.14.3, because I broke that feature in v1.14.0 :). Then the idea is to use the button's onValue scripting property to send custom messages when it's touched:
var y = locals.touchCoords[1] // between 0 (bottom) and 1 (top)
// you could do some maths with y here
send('127.0.0.1:5555', '/address', y)
Thank you so much for replying!
But sorry for my lack of understanding, after I wrote your script in "onValue" property of the button, the velocity is still following the ones in button's on and off values (0 when off, 127 when off), wherever I touch the button...
What am I missing here?
Ok so if set bypass to true, the button doesn't send any midi message right? So I have to send it via script, a channel, a note (or cc), a target? And make the velocity correspond to y?
Sorry I am really a noob... Am I correct here? How could I do that?
Ok thank you, I'm making progress...
So I tried this :
var y = locals.touchCoords[1]
send('midi:OSC', '/note', 1, 60, y)
And now the button is sending a note, but only with velocity 0 or 1 (0 bottom, 1 top), and it doesn't act like a push button as I want. It is sending a note when on and the when off...
y is between 0 and 1, you probably want to multiply that number by 127 to get a proper velocity out of it.
it doesn't act like a push button as I want. It is sending a note when on and the when off...
Then you'll need some more code
var velocity
if (value == getProp('this', 'on')) { // the actual value of the widget is still defined with the on/off properties
velocity = locals.touchCoords[1] * 127
} else {
velocity = 0 // velocity 0 == note off
}
send('midi:OSC', '/note', 1, 60, velocity)