Professional Documents
Culture Documents
{ BEGIN ON INIT }
on init
hide_inst_icon
make_perfview
set_ui_height_px(540) { adjust size to your needs here }
set_script_title("Main")
message("Welcome to Kontakt GUI Maker!") { enter your message here }
{ 3D DEPTH 1 }
declare const $KGM_GROUP_OFFSET := 1
declare $KGM_GROUP_COUNT := 1
declare $KGM_FX_QUERY := 1
declare $KGM_SEND_QUERY := 1
declare $KGM_GROUP_A := 0
declare $KGM_GROUP_B := 0
declare $KGM_GROUP_C := 0
declare $KGM_GROUP_D := 0
declare $KGM_GROUP_E := 0
declare $KGM_GROUP_F := 0
declare $KGM_GROUP_G := 0
declare $KGM_GROUP_H := 0
declare $KGM_GROUP_I := 0
declare $KGM_GROUP_J := 0
declare $KGM_GROUP_A_ACTIVE := 1
declare $KGM_GROUP_B_ACTIVE := 0
declare $KGM_GROUP_C_ACTIVE := 0
declare $KGM_GROUP_D_ACTIVE := 0
declare $KGM_GROUP_E_ACTIVE := 0
declare $KGM_GROUP_F_ACTIVE := 0
declare $KGM_GROUP_G_ACTIVE := 0
declare $KGM_GROUP_H_ACTIVE := 0
declare $KGM_GROUP_I_ACTIVE := 0
declare $KGM_GROUP_J_ACTIVE := 0
declare $KGM_CONTROL_ALL_GROUPS := 1
declare $KGM_ACTIVE_GROUPS := 1
declare $KGM_MULTISAMPLE_MODE := 0
{ BUSSES }
declare $BUS1_VOLUME := 630000
declare $BUS2_VOLUME := 630000
declare $BUS3_VOLUME := 630000
declare $BUS4_VOLUME := 630000
declare $BUS5_VOLUME := 630000
declare $BUS6_VOLUME := 630000
declare $BUS7_VOLUME := 630000
declare $BUS8_VOLUME := 630000
declare $BUS9_VOLUME := 630000
declare $BUS10_VOLUME := 630000
declare $BUS11_VOLUME := 630000
declare $BUS12_VOLUME := 630000
declare $BUS13_VOLUME := 630000
declare $BUS14_VOLUME := 630000
declare $BUS15_VOLUME := 630000
declare $BUS16_VOLUME := 630000
make_persistent ($BUS1_VOLUME)
make_persistent ($BUS2_VOLUME)
make_persistent ($BUS3_VOLUME)
make_persistent ($BUS4_VOLUME)
make_persistent ($BUS5_VOLUME)
make_persistent ($BUS6_VOLUME)
make_persistent ($BUS7_VOLUME)
make_persistent ($BUS8_VOLUME)
make_persistent ($BUS9_VOLUME)
make_persistent ($BUS10_VOLUME)
make_persistent ($BUS11_VOLUME)
make_persistent ($BUS12_VOLUME)
make_persistent ($BUS13_VOLUME)
make_persistent ($BUS14_VOLUME)
make_persistent ($BUS15_VOLUME)
make_persistent ($BUS16_VOLUME)
read_persistent_var ($BUS1_VOLUME)
read_persistent_var ($BUS2_VOLUME)
read_persistent_var ($BUS3_VOLUME)
read_persistent_var ($BUS4_VOLUME)
read_persistent_var ($BUS5_VOLUME)
read_persistent_var ($BUS6_VOLUME)
read_persistent_var ($BUS7_VOLUME)
read_persistent_var ($BUS8_VOLUME)
read_persistent_var ($BUS9_VOLUME)
read_persistent_var ($BUS10_VOLUME)
read_persistent_var ($BUS11_VOLUME)
read_persistent_var ($BUS12_VOLUME)
read_persistent_var ($BUS13_VOLUME)
read_persistent_var ($BUS14_VOLUME)
read_persistent_var ($BUS15_VOLUME)
read_persistent_var ($BUS16_VOLUME)
pgs_create_key (PGS_MONO_MODE,1)
pgs_create_key (PGS_MONO_PRIO,1)
pgs_create_key (PGS_GLIDE_MODE,1)
pgs_create_key (PGS_GLIDE_RATE,1)
pgs_create_key (PGS_UNI_VOICES,1)
pgs_create_key (PGS_UNI_DETUNE,1)
pgs_create_key (PGS_UNI_SPREAD,1)
{ END PGS DECLARE }
{ LISTENERS }
set_listener ($NI_SIGNAL_TIMER_MS,18000)
declare $KGM_ANIM_STEP := 0
declare $KGM_ANIM_FRAMES_MAX := 99
declare %KGM_NOTE_SEQUENCER_ARRAY[128]
make_persistent (%KGM_NOTE_SEQUENCER_ARRAY)
read_persistent_var (%KGM_NOTE_SEQUENCER_ARRAY)
declare $KGM_NOTE_SEQUENCER_STEPS_SHOWN := 16
make_persistent ($KGM_NOTE_SEQUENCER_STEPS_SHOWN)
read_persistent_var ($KGM_NOTE_SEQUENCER_STEPS_SHOWN)
declare $KGM_NOTE_SEQUENCER_ENABLE := 0
make_persistent ($KGM_NOTE_SEQUENCER_ENABLE)
read_persistent_var ($KGM_NOTE_SEQUENCER_ENABLE)
declare $KGM_NOTE_ID := 0
declare $KGM_FIRST_NOTE := 0
declare $KGM_WAIT_EVENT := 0
declare $KGM_CHK_NOTES := 0
declare $KGM_NCOUNT := 0
declare $KGM_SEQUENCER_POS := 0
declare $KGM_SEQUENCER_DURATION := 0
$KGM_SEQUENCER_DURATION := $DURATION_SIXTEENTH
make_persistent ($KGM_SEQUENCER_DURATION)
read_persistent_var ($KGM_SEQUENCER_DURATION)
{ GROUPS }
make_persistent ($KGM_GROUP_A)
make_persistent ($KGM_GROUP_B)
make_persistent ($KGM_GROUP_C)
make_persistent ($KGM_GROUP_D)
make_persistent ($KGM_GROUP_E)
make_persistent ($KGM_GROUP_F)
make_persistent ($KGM_GROUP_G)
make_persistent ($KGM_GROUP_H)
make_persistent ($KGM_GROUP_I)
make_persistent ($KGM_GROUP_J)
make_persistent ($KGM_GROUP_A_ACTIVE)
make_persistent ($KGM_GROUP_B_ACTIVE)
make_persistent ($KGM_GROUP_C_ACTIVE)
make_persistent ($KGM_GROUP_D_ACTIVE)
make_persistent ($KGM_GROUP_E_ACTIVE)
make_persistent ($KGM_GROUP_F_ACTIVE)
make_persistent ($KGM_GROUP_G_ACTIVE)
make_persistent ($KGM_GROUP_H_ACTIVE)
make_persistent ($KGM_GROUP_I_ACTIVE)
make_persistent ($KGM_GROUP_J_ACTIVE)
make_persistent ($KGM_CONTROL_ALL_GROUPS)
make_persistent ($KGM_ACTIVE_GROUPS)
read_persistent_var ($KGM_GROUP_A)
read_persistent_var ($KGM_GROUP_B)
read_persistent_var ($KGM_GROUP_C)
read_persistent_var ($KGM_GROUP_D)
read_persistent_var ($KGM_GROUP_E)
read_persistent_var ($KGM_GROUP_F)
read_persistent_var ($KGM_GROUP_G)
read_persistent_var ($KGM_GROUP_H)
read_persistent_var ($KGM_GROUP_I)
read_persistent_var ($KGM_GROUP_J)
read_persistent_var ($KGM_GROUP_A_ACTIVE)
read_persistent_var ($KGM_GROUP_B_ACTIVE)
read_persistent_var ($KGM_GROUP_C_ACTIVE)
read_persistent_var ($KGM_GROUP_D_ACTIVE)
read_persistent_var ($KGM_GROUP_E_ACTIVE)
read_persistent_var ($KGM_GROUP_F_ACTIVE)
read_persistent_var ($KGM_GROUP_G_ACTIVE)
read_persistent_var ($KGM_GROUP_H_ACTIVE)
read_persistent_var ($KGM_GROUP_I_ACTIVE)
read_persistent_var ($KGM_GROUP_J_ACTIVE)
read_persistent_var ($KGM_CONTROL_ALL_GROUPS)
read_persistent_var ($KGM_ACTIVE_GROUPS)
{ BEGIN FUNCTIONS }
function randomize_layer_a
end function
function randomize_layer_b
end function
function randomize_layer_c
end function
function randomize_layer_d
end function
{ END FUNCTIONS }
{ BEGIN ON NOTE }
on note
ignore_event($EVENT_ID)
if ($KGM_MULTISAMPLE_MODE = 1)
allow_group($ALL_GROUPS)
if ($KGM_NOTE_SEQUENCER_ENABLE = 1)
if ($KGM_FIRST_NOTE = 0)
$KGM_FIRST_NOTE := 1
$KGM_SEQUENCER_POS := 0
$KGM_WAIT_EVENT := $NI_CALLBACK_ID
while ($KGM_FIRST_NOTE = 1)
if (%KGM_NOTE_SEQUENCER_ARRAY[$KGM_SEQUENCER_POS] > 0)
$KGM_NOTE_ID := play_note($EVENT_NOTE,
%KGM_NOTE_SEQUENCER_ARRAY[$KGM_SEQUENCER_POS],0,$KGM_SEQUENCER_DURATION)
end if
if ($KGM_SEQUENCER_POS < $KGM_NOTE_SEQUENCER_STEPS_SHOWN-1)
inc($KGM_SEQUENCER_POS)
else
$KGM_SEQUENCER_POS := 0
end if
wait($KGM_SEQUENCER_DURATION)
end while
end if
else
$KGM_NOTE_ID := play_note($EVENT_NOTE,$EVENT_VELOCITY,0,-1)
end if
else
disallow_group($ALL_GROUPS)
if ($KGM_GROUP_A_ACTIVE = 1)
allow_group($KGM_GROUP_A+$KGM_GROUP_OFFSET)
end if
if ($KGM_GROUP_B_ACTIVE = 1)
allow_group($KGM_GROUP_B+$KGM_GROUP_OFFSET)
end if
if ($KGM_GROUP_C_ACTIVE = 1)
allow_group($KGM_GROUP_C+$KGM_GROUP_OFFSET)
end if
if ($KGM_GROUP_D_ACTIVE = 1)
allow_group($KGM_GROUP_D+$KGM_GROUP_OFFSET)
end if
if ($KGM_GROUP_E_ACTIVE = 1)
allow_group($KGM_GROUP_E+$KGM_GROUP_OFFSET)
end if
if ($KGM_GROUP_F_ACTIVE = 1)
allow_group($KGM_GROUP_F+$KGM_GROUP_OFFSET)
end if
if ($KGM_GROUP_G_ACTIVE = 1)
allow_group($KGM_GROUP_G+$KGM_GROUP_OFFSET)
end if
if ($KGM_GROUP_H_ACTIVE = 1)
allow_group($KGM_GROUP_H+$KGM_GROUP_OFFSET)
end if
if ($KGM_GROUP_I_ACTIVE = 1)
allow_group($KGM_GROUP_I+$KGM_GROUP_OFFSET)
end if
if ($KGM_GROUP_J_ACTIVE = 1)
allow_group($KGM_GROUP_J+$KGM_GROUP_OFFSET)
end if
if ($KGM_NOTE_SEQUENCER_ENABLE = 1)
if ($KGM_FIRST_NOTE = 0)
$KGM_FIRST_NOTE := 1
$KGM_SEQUENCER_POS := 0
$KGM_WAIT_EVENT := $NI_CALLBACK_ID
while ($KGM_FIRST_NOTE = 1)
if (%KGM_NOTE_SEQUENCER_ARRAY[$KGM_SEQUENCER_POS] > 0)
$KGM_NOTE_ID := play_note($EVENT_NOTE,
%KGM_NOTE_SEQUENCER_ARRAY[$KGM_SEQUENCER_POS],0,$KGM_SEQUENCER_DURATION)
end if
if ($KGM_SEQUENCER_POS < $KGM_NOTE_SEQUENCER_STEPS_SHOWN-1)
inc($KGM_SEQUENCER_POS)
else
$KGM_SEQUENCER_POS := 0
end if
wait($KGM_SEQUENCER_DURATION)
end while
end if
else
$KGM_NOTE_ID := play_note($EVENT_NOTE,$EVENT_VELOCITY,0,-1)
end if
end if
end on
{ END ON NOTE }
{ BEGIN ON RELEASE }
on release
if ($KGM_NOTE_SEQUENCER_ENABLE = 1)
$KGM_NCOUNT := 0
$KGM_CHK_NOTES := 0
while ($KGM_NCOUNT < 127)
$KGM_CHK_NOTES := $KGM_CHK_NOTES+%KEY_DOWN[$KGM_NCOUNT]
inc($KGM_NCOUNT)
end while
if ($KGM_CHK_NOTES = 0)
$KGM_FIRST_NOTE := 0
{ stop_wait($KGM_WAIT_EVENT,0) UNCOMMENT THIS LINE WHEN USING THE
SEQUENCER. ONLY WORKS WITH KONTAKT 5 ! }
end if
end if
end on
{ END ON RELEASE }
{ BEGIN ON LISTENER }
on listener
if ($NI_SIGNAL_TYPE = $NI_SIGNAL_TIMER_MS)
if ($KGM_ANIM_STEP < $KGM_ANIM_FRAMES_MAX)
inc($KGM_ANIM_STEP)
else
$KGM_ANIM_STEP := 0
end if
end if
end on
{ END ON LISTENER }