I'm getting stuck notes on the Kontakt virtual keyboard. No audible stuck notes or glitches. The notes ARE shutting off, it's just the annoyance of seeing stuck notes on the virtual keyboard.
This only happens when I combine the legato part of the script with the tone-shift option.
The legato portion is pretty ordinary, where I use the variable $poly to keep track of polyphony. If $poly is more than one, then I cut off the previously played note, so that it will play monophonically. (There's obviously much more going on than that in my real script, but I want to keep this example simple.)
The tone-shift part is basically a chipmunk/Darth Vader effect. If "shift' is set to -3, for instance, then when the user plays F5, the script tells Kontakt to ignore F5 and instead play D5 (3 semitones lower) and pitch shift that D5 back up 3 semitones so that it still sounds like F5. It's a cheap way to get a double.
Here's the stripped down code:
As I said, this plays perfectly. Notes shut off as they should and everything is cool. It's only the virtual Kontakt keyboard that displays stuck notes, and that only happens when $shift # 0. (The virtual keyboard is fine if there is no shift.)
If I make the $oldnoteid variable polyphonic, I stop getting stuck notes,but then the note_off command ceases to work, most likely because $oldnoteid is no longer the "old note."
Any thoughts on how to get that virtual keyboard to behave?
This only happens when I combine the legato part of the script with the tone-shift option.
The legato portion is pretty ordinary, where I use the variable $poly to keep track of polyphony. If $poly is more than one, then I cut off the previously played note, so that it will play monophonically. (There's obviously much more going on than that in my real script, but I want to keep this example simple.)
The tone-shift part is basically a chipmunk/Darth Vader effect. If "shift' is set to -3, for instance, then when the user plays F5, the script tells Kontakt to ignore F5 and instead play D5 (3 semitones lower) and pitch shift that D5 back up 3 semitones so that it still sounds like F5. It's a cheap way to get a double.
Here's the stripped down code:
Code:
on init
declare ui_menu ($shift)
declare $oldnote
declare $oldnoteid
declare $noteplayed
declare $oldnoteplayed
declare $poly := 0
end on
on note
$noteplayed := $EVENT_NOTE
change_note ($EVENT_ID,$EVENT_NOTE + $shift)
change_tune ($EVENT_ID,-$shift * 100000,1)
$poly := $poly + 1
if ($poly > 1)
ignore_event ($EVENT_ID)
note_off ($oldnoteid)
$newdelayednote_id := play_note ($noteplayed,127,0,-1)
change_note ($newdelayednote_id,$noteplayed + $shift)
change_tune ($newdelayednote_id,-$shift * 100000,1)
$poly := $poly + 1
end if
$oldnoteid := $EVENT_ID
$oldnote := $EVENT_NOTE
$oldnoteplayed := $noteplayed
end on
on release
$poly := $poly - 1
end on
As I said, this plays perfectly. Notes shut off as they should and everything is cool. It's only the virtual Kontakt keyboard that displays stuck notes, and that only happens when $shift # 0. (The virtual keyboard is fine if there is no shift.)
If I make the $oldnoteid variable polyphonic, I stop getting stuck notes,but then the note_off command ceases to work, most likely because $oldnoteid is no longer the "old note."
Any thoughts on how to get that virtual keyboard to behave?