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