Menu Entry based changes in note and velocity value for specific key ranges

Hi! I am a beginner in kontakt scripting and hope somebody can help me with my problem.
Based on a menu entry I would like to play with the keys of the octave 24-35 the notes of octave 12-23 and only one velocity layer chosen by a menu entry value.
I achieved the note and velocity changes with the following code. But when I play the notes it always has clicking noises caused by the while loop. But why and how can I fix it? Is there a better way to do this? How can I change the values for only a certain key range?
In the end I would like to have multiple menus for different octaves all sharing the same menu entries and playing the samples from octave 12-23. I have everything ready but this is a major problem and I cant find a solution. PLEASE HELP :)
on init declare %menu_a[12] := (24,25,26,27,28,29,30,31,32,33,34,35) declare %samples[12] := (12,13,14,15,16,17,18,19,20,21,22,23) declare ui_menu $menu_a add_menu_item($menu_a,"Empty",-1) add_menu_item($menu_a,"1",1) add_menu_item($menu_a,"2",2) end on on note if (search(%menu_a,$EVENT_NOTE) # -1) change_note($EVENT_ID,$EVENT_NOTE-12) end if if ($menu_a=1) while (search(%samples,$EVENT_NOTE) # -1) change_velo($EVENT_ID,1) end while end if end on
Comments
-
Not sure if this is relevant, but change_velo requires an ID, not a NOTE
0 -
True that is a leftover from a try I did :) Thx
0 -
How about this?
on init declare ui_menu $menu_a add_menu_item($menu_a,"Empty", -1) add_menu_item($menu_a,"1",1) add_menu_item($menu_a,"2",2) end on on note if ($EVENT_NOTE >= 24 and $EVENT_NOTE <= 35 and $menu_a # -1) change_note($EVENT_ID, $EVENT_NOTE-12) change_velo($EVENT_ID, $menu_A) end if end on
1 -
Awesome! That will work for my case. Thank you for your fast reply and solution!
0
Categories
- All Categories
- 19 Welcome
- 1.5K Hangout
- 62 NI News
- 790 Tech Talks
- 4.1K Native Access
- 16.6K Komplete
- 2K Komplete General
- 4.3K Komplete Kontrol
- 5.7K Kontakt
- 1.6K Reaktor
- 381 Battery 4
- 850 Guitar Rig & FX
- 429 Massive X & Synths
- 1.3K Other Software & Hardware
- 5.8K Maschine
- 7.3K Traktor
- 7.3K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators