QWERTY Keyboard Octave - setKeyPressBaseOctave - Feature Request
-
@CyberGen Bumpbidibumpbump. :person_raising_hand_light_skin_tone:
-
@CyberGen What's stopping you from rolling your own functionality for the computer keyboard?
Admittedly, playNoteFromUI doesn't work as expected (all notes are velocity 127), but I believe that's a quick fix for Chris once he's back from vaykay.
-
@aaronventure hmm... ignorance mostly.
Do you mean with: setConsumedKeyPresses(); and setKeyPressCallback(function(obj) ?
I hadn't thought about it.... would this override it's default functionality? -
@CyberGen if you use these methods (which are for controls), a control will need to be in focus before it can consume the key presses (I think).
So use the Content.setKeyPressCallback to do it globally.
Do it for each key individually, and just use a var that refers to whatever your current octave setting is.
-
@aaronventure uhm.. sorta got it to work like this:
const var key = "a"; const var qwertyOctave = 0; Content.setKeyPressCallback(key, function(key) { if (key == "a") { Synth.playNote(60 + (qwertyOctave * 12), 100); } });
Now how do I get the note to stop playing? what is the onNoteOf version of the keyPressCallback?
-
@CyberGen ah fuck, you're right, you need a key release callback. Nevermind.
I don't whether that could be added to the keypresscallback (like isFocusChange, the super useful property that's secretly tucked into the keypresscallback). If it's simpler than adding the octave things, it solves not only your custom computer keyboard issue but also enables a bunch of other functionality.
We'll see what Chris says in a few days/weeks.
-
@aaronventure I don't know if
isFocusChange
could be of any help in this case. But when printing the CB object we see there's no call for a key up. So in the end it might just be good to gonoteOffDelayedByEventId
. Not an issue for percussive sound, but for longer notes...
At least until a key up property can be addedBTW, I reckonplayNote
is deprecated.addNoteOn
should be preferred -
@ustk said in QWERTY Keyboard Octave - setKeyPressBaseOctave - Feature Request:
I reckon playNote is deprecated. addNoteOn should be preferred
Why?
-
@d-healey Mmm... Strangely I was certain it was written in the API help but not anymore... Is it me or it has been removed? or another playNote function that is now removed maybe... Or perhaps I had my brain removed :man_shrugging:
-
@ustk I think you're experiencing a personal Mandela effect
-
@d-healey said in QWERTY Keyboard Octave - setKeyPressBaseOctave - Feature Request:
@ustk I think you're experiencing a personal Mandela effect
It's not what you think... We are sure! :zany_face:
-
@ustk I believe it's Synth.noteOff() that's deprecated. If you use it, the console throws a message to use noteOffByEventId. Anway, I only used playNote hoping somehow it wouldn't require a noteOff callback as I was testing @aaronventure suggestion.
I think it would be better to just add the octave control to the existing qwerty keyboard function. :crossed_fingers: