good evening,
i just want to display the keys i played from my oxygen keyboard.
I understand the keyboard widget keys won't get on until the same velocity is received when i press a key on my oxygen
i have searched on this forum but can't find a solution.
by the way, what event is sent by the keyboard widget when a key is pressed ?
thanks for your help
A script widget with address
to /note
, preArgs
to 1
, target
to midi:oxygen
, and onValue
to
if (value.length != 2) return
var note = value[0],
vel = value[1]
set('keyboard_1/' + note, vel > 0 ? 1 : 0)
Merci pour ta réponse,
good idea but it doesn't work
oxygen.json (4.1 KB)
There was a a mistake in my code, set() should pass 1
instead of 127
.
actually i have changed the value in the keyboard_1 on property to match to 127
So here is the keyboard_1
then the script widget
So i guess it's about the set function but can't figure out why...
oxygen-1403.json (4.0 KB)
No, you have to pass 1 regardless of the on
property, internally the note buttons are configured like this.
nope...
sorry to bother you again but could you post here a working example like a simple button that light on the keyboard_1 using the set function.
keyboard_test.json (3.1 KB)
You made a mistake in the onValue script, you wrote
var note = value[1],
vel = value[2]
instead of
var note = value[0],
vel = value[1]
Argh... because i have tried to include the midi channel... very very sorry.
Merci
Could we have used the send
function for the same result ?
if i understand correctly, the keyboard_1 will turn on if it received the same note on the same address on the same target with the same on value ?
how do you translate this with send function ?
Thanks
send
would be used to send a message to another software, no to set a widget's value.
ok
just a little question of syntax
i put a keyboard_2 that is a mirror of the keyboard_1 just to train myself on (so many) syntaxes
You see i have code the 48 value in 'hard'. What syntax to get the keyboard start property value ?
RTFM @greenman
console.log("keyboard 2")
const n = getIndex(id) + getProp(this,'start')
if(value[getIndex(id)]==127)
set('keyboard_1/'+ n,1)
else
set('keyboard_1/'+ n,0)
By the way, is there a mean to increase the editor text size (except using [ctrl] + [+]) ?
Try fiddling with the .ace_editor
class in your theme file.
in french sorry
Pour qu'OSC actualise l'état d'une widget il faut que le message midi respecte la target les preargs et la forme du message.
Donc ici la vélocité a besoin d'être forcée à 127 pour que les conditions soient satisfaites et que les touches s'allument. Tu m'as proposé la solution avec SET qui ne tient pas compte de ses régles.
Mais on aurait pu envoyer à osc lui-même le message bien formé ? non ?
C'était mon idée première mais puisque send ne peut pas envoyer de messages depuis une widget script sans interaction de l'utilisateur, quelle est la solution ? il faut utiliser un custom module pour que la fonction send fonctionne sans interaction ?
Merci pour tes lumières.
Oui, mais c'est une pratique à éviter, il n'y a pas d'interêt à utilser send plutôt que set.
il faut utiliser un custom module pour que la fonction send fonctionne sans interaction ?
Oui.
1 Like