Silence change_note "out of range" error?

cbmtrx Member Posts: 11 Member
edited October 2022 in Scripting Workshop

I give users the ability to shift the playable range of an instrument by x octaves by adding x*12 in change_note. It works great, problem is, when the oct shift is high enough the change_note calc begins yielding <0 results and that causes Kontakt to display the error—despite the instrument playing back correctly. (Playing within the "new" range works fine; the error comes in when notes are struck in the lower register—where the active notes "used" to be.)

Tried two approaches to fixing this: play only notes that would fall within the range *with* the octave shift added OR don't play notes that *do not* fall where the octave shift would have modified it. In both cases it creates odd playback issues, effectively breaking what was working.

I'm wary of trying to code something complicated to get around a little error's more of an annoyance.


  • EvilDragon
    EvilDragon Moderator Posts: 1,017 mod

    You should simply not process a note event that goes outside of 0-127 range. So, I would suggest have a temporary variable that calculates the octave transposition ($EVENT_NOTE + ($x * 12)) then only continue with note callback stuff that you want, if this resulting value is in_range($note, 0, 127). Otherwise, exit callback.

Back To Top