How do you make loops play sequentially in Kontakt?

{place midi latch after this script and select mono}

on init
declare ui_label $loop_1 (1,1)
set_text ($loop_1, "Loop 1")
declare ui_label $loop_2 (1,1)
set_text ($loop_2, "Loop 2")
declare ui_label $loop_3 (1,1)
set_text ($loop_3, "Loop 3")
declare ui_label $loop_4 (1,1)
set_text ($loop_4, "Loop 4")
declare ui_label $loop_5 (1,1)
set_text ($loop_5, "Loop 5")
declare ui_label $loop_6 (1,1)
set_text ($loop_6, "Loop 6")
declare $loop_one_length
declare $loop_two_length
declare $loop_three_length
declare $loop_four_length
declare $loop_five_length
declare $loop_six_length
declare ui_menu $synctype
declare ui_menu $synctyper
declare ui_menu $synctypeb
declare ui_menu $synctypec
declare ui_menu $synctyped
declare ui_menu $synctypee
declare $last_synctype
declare $helper
declare $helpert
declare $helperb
declare $helperc
declare $helperd
declare $helpere
declare $dog

{declare polyphonic $art_id}

{***----key knob one----***}
declare ui_knob $Key_knob_1 (0,127,1)
make_persistent($key_knob_1)
declare !note_class[12]
!note_class[0] := "C"
!note_class[1] := "Db"
!note_class[2] := "D"
!note_class[3] := "Eb"
!note_class[4] := "E"
!note_class[5] := "F"
!note_class[6] := "Gb"
!note_class[7] := "G"
!note_class[8] := "Ab"
!note_class[9] := "A"
!note_class[10] := "Bb"
!note_class[11] := "B"
declare !note_names [128]
_read_persistent_var($key_knob_1)
declare $c
$c := 0
while ($c < 128)
!note_names[$c] := !note_class[$c mod 12] & (($c/12)-2)
inc ($c)
end while
set_knob_label($key_knob_1,!note_names[($key_knob_1) mod 128])
set_text($key_knob_1,"Key")

{***----key knob two----***}

declare ui_knob $Key_knob_2 (0,127,1)
make_persistent($key_knob_2)
_read_persistent_var($key_knob_2)
while ($c < 128)
!note_names[$c] := !note_class[$c mod 12] & (($c/12)-2)
inc ($c)
end while
set_knob_label($key_knob_2,!note_names[($key_knob_2) mod 128])
set_text($key_knob_2,"Key")

{***----key knob three----***}

declare ui_knob $Key_knob_3 (0,127,1)
make_persistent($key_knob_3)
_read_persistent_var($key_knob_3)
while ($c < 128)
!note_names[$c] := !note_class[$c mod 12] & (($c/12)-2)
inc ($c)
end while
set_knob_label($key_knob_3,!note_names[($key_knob_3) mod 128])
set_text($key_knob_3,"Key")

{***----key knob four----***}

declare ui_knob $Key_knob_4 (0,127,1)
make_persistent($key_knob_4)
_read_persistent_var($key_knob_4)
while ($c < 128)
!note_names[$c] := !note_class[$c mod 12] & (($c/12)-2)
inc ($c)
end while
set_knob_label($key_knob_4,!note_names[($key_knob_4) mod 128])
set_text($key_knob_4,"Key")

{***----key knob five----***}

declare ui_knob $Key_knob_5 (0,127,1)
make_persistent($key_knob_5)
_read_persistent_var($key_knob_5)
while ($c < 128)
!note_names[$c] := !note_class[$c mod 12] & (($c/12)-2)
inc ($c)
end while
set_knob_label($key_knob_5,!note_names[($key_knob_5) mod 128])
set_text($key_knob_5,"Key")

{***----key knob six----***}

declare ui_knob $Key_knob_6 (0,127,1)
make_persistent($key_knob_6)
_read_persistent_var($key_knob_6)
while ($c < 128)
!note_names[$c] := !note_class[$c mod 12] & (($c/12)-2)
inc ($c)
end while
set_knob_label($key_knob_6,!note_names[($key_knob_6) mod 128])
set_text($key_knob_6,"Key")



{-----------------------}
declare $Note_off
$Note_off := 1
declare $Note_on
$Note_on := 1
declare $Sustain_NoteOff
$Sustain_NoteOff := 1

{----- Menu entries one -----}

add_menu_item($synctype,"Bar Select",99)
add_menu_item($synctype, "--------------",99)
add_menu_item ($synctype, "1",1)
add_menu_item ($synctype, "2",2)
add_menu_item ($synctype, "3",3)
add_menu_item ($synctype, "4",4)
add_menu_item ($synctype, "5",5)
add_menu_item ($synctype, "6", 6)
add_menu_item ($synctype, "7",7)
add_menu_item ($synctype, "8",8)
add_menu_item ($synctype, "9",9)
add_menu_item ($synctype, "10",10)

{----- Menu entries two -----}
add_menu_item($synctyper,"Bar Select",99)
add_menu_item($synctyper, "--------------",99)
add_menu_item ($synctyper, "1",1)
add_menu_item ($synctyper, "2",2)
add_menu_item ($synctyper, "3",3)
add_menu_item ($synctyper, "4",4)
add_menu_item ($synctyper, "5",5)
add_menu_item ($synctyper, "6", 6)
add_menu_item ($synctyper, "7",7)
add_menu_item ($synctyper, "8",8)
add_menu_item ($synctyper, "9",9)
add_menu_item ($synctyper, "10",10)

{----- Menu entries three -----}

add_menu_item($synctypeb,"Bar Select",99)
add_menu_item($synctypeb, "--------------",99)
add_menu_item ($synctypeb, "1",1)
add_menu_item ($synctypeb, "2",2)
add_menu_item ($synctypeb, "3",3)
add_menu_item ($synctypeb, "4",4)
add_menu_item ($synctypeb, "5",5)
add_menu_item ($synctypeb, "6", 6)
add_menu_item ($synctypeb, "7",7)
add_menu_item ($synctypeb, "8",8)
add_menu_item ($synctypeb, "9",9)
add_menu_item ($synctypeb, "10",10)

{----- Menu entries four -----}

add_menu_item($synctypec,"Bar Select",99)
add_menu_item($synctypec, "--------------",99)
add_menu_item ($synctypec, "1",1)
add_menu_item ($synctypec, "2",2)
add_menu_item ($synctypec, "3",3)
add_menu_item ($synctypec, "4",4)
add_menu_item ($synctypec, "5",5)
add_menu_item ($synctypec, "6", 6)
add_menu_item ($synctypec, "7",7)
add_menu_item ($synctypec, "8",8)
add_menu_item ($synctypec, "9",9)
add_menu_item ($synctypec, "10",10)

{----- Menu entries five -----}

add_menu_item($synctyped,"Bar Select",99)
add_menu_item($synctyped, "--------------",99)
add_menu_item ($synctyped, "1",1)
add_menu_item ($synctyped, "2",2)
add_menu_item ($synctyped, "3",3)
add_menu_item ($synctyped, "4",4)
add_menu_item ($synctyped, "5",5)
add_menu_item ($synctyped, "6", 6)
add_menu_item ($synctyped, "7",7)
add_menu_item ($synctyped, "8",8)
add_menu_item ($synctyped, "9",9)
add_menu_item ($synctyped, "10",10)

{----- Menu entries six -----}

add_menu_item($synctypee,"Bar Select",99)
add_menu_item($synctypee, "--------------",99)
add_menu_item ($synctypee, "1",1)
add_menu_item ($synctypee, "2",2)
add_menu_item ($synctypee, "3",3)
add_menu_item ($synctypee, "4",4)
add_menu_item ($synctypee, "5",5)
add_menu_item ($synctypee, "6", 6)
add_menu_item ($synctypee, "7",7)
add_menu_item ($synctypee, "8",8)
add_menu_item ($synctypee, "9",9)
add_menu_item ($synctypee, "10",10)


{----- Init -----}

{$Note_on := 1}

$synctype := 4
$last_synctype := 4
$synctyper := 4
$synctypeb := 4
$synctypec := 4
$synctyped := 4
$synctypee := 4
{$last_synctyper := 4}

{----- Recall -----}

make_persistent ($synctype)
make_persistent ($synctyper)
make_persistent ($synctypeb)
make_persistent ($synctypec)
make_persistent ($synctyped)
make_persistent ($synctypee)
make_persistent ($last_synctype)
make_persistent ($synctype)
{make_persistent ($last_synctype)}


end on
on note
if ($Note_on = 1 and $EVENT_NOTE = $Key_knob_1)
ignore_event($EVENT_ID)
select ($synctype)
case 1
$loop_one_length := $DURATION_BAR
case 2
$loop_one_length := $DURATION_QUARTER * 8
case 3
$loop_one_length := $DURATION_QUARTER * 12
case 4
$loop_one_length := $DURATION_QUARTER * 16
case 5
$loop_one_length := $DURATION_QUARTER * 20
case 6
$loop_one_length := $DURATION_QUARTER * 24
case 7
$loop_one_length := $DURATION_QUARTER * 28
case 8
$loop_one_length := $DURATION_QUARTER * 32
case 9
$loop_one_length := $DURATION_QUARTER * 36
case 10
$loop_one_length := $DURATION_QUARTER * 40
end select

$helper := (($DURATION_BAR - $DISTANCE_BAR_START)+($DURATION_BAR*10)) mod $loop_one_length
if ($helper > 0)
wait($helper)


end if
end if


if ($Note_off = 1 and $Sustain_NoteOff = 1 and $NOTE_HELD = 0 and $EVENT_NOTE = $Key_knob_1)
$helper := play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,$loop_one_length)
set_event_par($helper,0,1)
end if
{-----------------------------------------------------------------------}

if ($Note_on = 1 and $EVENT_NOTE = $Key_knob_2)
ignore_event($EVENT_ID)
select ($synctyper)
case 1
$loop_two_length := $DURATION_BAR
case 2
$loop_two_length := $DURATION_QUARTER * 8
case 3
$loop_two_length := $DURATION_QUARTER * 12
case 4
$loop_two_length := $DURATION_QUARTER * 16
case 5
$loop_two_length := $DURATION_QUARTER * 20
case 6
$loop_two_length := $DURATION_QUARTER * 24
case 7
$loop_two_length := $DURATION_QUARTER * 28
case 8
$loop_two_length := $DURATION_QUARTER * 32
case 9
$loop_two_length := $DURATION_QUARTER * 36
case 10
$loop_two_length := $DURATION_QUARTER * 40
end select

$helpert := (($DURATION_BAR - $DISTANCE_BAR_START)+($DURATION_BAR*10)) mod $loop_two_length
if ($helpert > 0)
wait($helpert)


end if
end if



if ($Note_off = 1 and $Sustain_NoteOff = 1 and $NOTE_HELD = 0 and $EVENT_NOTE = $Key_knob_2)
$helpert := play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,$loop_two_length)
set_event_par($helpert,0,1)
end if
{--------------------------------------------------------------------}

if ($Note_on = 1 and $EVENT_NOTE = $Key_knob_3)
ignore_event($EVENT_ID)
select ($synctypeb)
case 1
$loop_three_length := $DURATION_BAR
case 2
$loop_three_length := $DURATION_QUARTER * 8
case 3
$loop_three_length := $DURATION_QUARTER * 12
case 4
$loop_three_length := $DURATION_QUARTER * 16
case 5
$loop_three_length := $DURATION_QUARTER * 20
case 6
$loop_three_length := $DURATION_QUARTER * 24
case 7
$loop_three_length := $DURATION_QUARTER * 28
case 8
$loop_three_length := $DURATION_QUARTER * 32
case 9
$loop_three_length := $DURATION_QUARTER * 36
case 10
$loop_three_length := $DURATION_QUARTER * 40
end select

$helperb := (($DURATION_BAR - $DISTANCE_BAR_START)+($DURATION_BAR*10)) mod $loop_three_length
if ($helperb > 0)
wait($helperb)


end if
end if



if ($Note_off = 1 and $Sustain_NoteOff = 1 and $NOTE_HELD = 0 and $EVENT_NOTE = $Key_knob_3)
$helperb := play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,$loop_three_length)
set_event_par($helperb,0,1)
end if

{--------------------------------------------------------------------}

if ($Note_on = 1 and $EVENT_NOTE = $Key_knob_4)
ignore_event($EVENT_ID)
select ($synctypec)
case 1
$loop_four_length := $DURATION_BAR
case 2
$loop_four_length := $DURATION_QUARTER * 8
case 3
$loop_four_length := $DURATION_QUARTER * 12
case 4
$loop_four_length := $DURATION_QUARTER * 16
case 5
$loop_four_length := $DURATION_QUARTER * 20
case 6
$loop_four_length := $DURATION_QUARTER * 24
case 7
$loop_four_length := $DURATION_QUARTER * 28
case 8
$loop_four_length := $DURATION_QUARTER * 32
case 9
$loop_four_length := $DURATION_QUARTER * 36
case 10
$loop_four_length := $DURATION_QUARTER * 40
end select

$helperc := (($DURATION_BAR - $DISTANCE_BAR_START)+($DURATION_BAR*10)) mod $loop_four_length
if ($helperc > 0)
wait($helperc)


end if
end if



if ($Note_off = 1 and $Sustain_NoteOff = 1 and $NOTE_HELD = 0 and $EVENT_NOTE = $Key_knob_4)
$helperc := play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,$loop_four_length)
set_event_par($helperc,0,1)
end if

{--------------------------------------------------------------------}

if ($Note_on = 1 and $EVENT_NOTE = $Key_knob_5)
ignore_event($EVENT_ID)
select ($synctyped)
case 1
$loop_five_length := $DURATION_BAR
case 2
$loop_five_length := $DURATION_QUARTER * 8
case 3
$loop_five_length := $DURATION_QUARTER * 12
case 4
$loop_five_length := $DURATION_QUARTER * 16
case 5
$loop_five_length := $DURATION_QUARTER * 20
case 6
$loop_five_length := $DURATION_QUARTER * 24
case 7
$loop_five_length := $DURATION_QUARTER * 28
case 8
$loop_five_length := $DURATION_QUARTER * 32
case 9
$loop_five_length := $DURATION_QUARTER * 36
case 10
$loop_five_length := $DURATION_QUARTER * 40
end select

$helperd := (($DURATION_BAR - $DISTANCE_BAR_START)+($DURATION_BAR*10)) mod $loop_five_length
if ($helperd > 0)
wait($helperd)


end if
end if



if ($Note_off = 1 and $Sustain_NoteOff = 1 and $NOTE_HELD = 0 and $EVENT_NOTE = $Key_knob_5)
$helperd := play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,$loop_five_length)
set_event_par($helperd,0,1)
end if
{-------------------------------------------------------------------}

if ($Note_on = 1 and $EVENT_NOTE = $Key_knob_6)
ignore_event($EVENT_ID)
select ($synctypee)
case 1
$loop_six_length := $DURATION_BAR
case 2
$loop_six_length := $DURATION_QUARTER * 8
case 3
$loop_six_length := $DURATION_QUARTER * 12
case 4
$loop_six_length := $DURATION_QUARTER * 16
case 5
$loop_six_length := $DURATION_QUARTER * 20
case 6
$loop_six_length := $DURATION_QUARTER * 24
case 7
$loop_six_length := $DURATION_QUARTER * 28
case 8
$loop_six_length := $DURATION_QUARTER * 32
case 9
$loop_six_length := $DURATION_QUARTER * 36
case 10
$loop_six_length := $DURATION_QUARTER * 40
end select

$helpere := (($DURATION_BAR - $DISTANCE_BAR_START)+($DURATION_BAR*10)) mod $loop_six_length
if ($helpere > 0)
wait($helpere)


end if
end if



if ($Note_off = 1 and $Sustain_NoteOff = 1 and $NOTE_HELD = 0 and $EVENT_NOTE = $Key_knob_6)
$helpere := play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,$loop_six_length)
set_event_par($helpere,0,1)
end if


{-------------------------------------------------------------------}
end on

on release
if ($Note_off = 1)
ignore_event($EVENT_ID)
$helper := (($DURATION_BAR - $DISTANCE_BAR_START)+($DURATION_BAR*10)) mod $loop_one_length
if ($helper > 0)
wait($helper)
end if
{------------------------------------}
{$helpert := (($DURATION_BAR - $DISTANCE_BAR_START)+($DURATION_BAR*10)) mod $time_length
if ($helpert > 0)
wait($helpert)
end if}
{--------------------------------------}
{note_off($art_id)}
end if
end on
on ui_control ($key_knob_1)
set_knob_label($key_knob_1,!note_names[($key_knob_1) mod 128])
end on
on ui_control ($key_knob_2)
set_knob_label($key_knob_2,!note_names[($key_knob_2) mod 128])
end on
on ui_control ($key_knob_3)
set_knob_label($key_knob_3,!note_names[($key_knob_3) mod 128])
end on
on ui_control ($key_knob_4)
set_knob_label($key_knob_4,!note_names[($key_knob_4) mod 128])
end on
on ui_control ($key_knob_5)
set_knob_label($key_knob_5,!note_names[($key_knob_5) mod 128])
end on
on ui_control ($key_knob_6)
set_knob_label($key_knob_6,!note_names[($key_knob_6) mod 128])
end on
on ui_control ($synctype)
if ($synctype # 99)
$last_synctype := $synctype
else
$synctype := $last_synctype
end if
end on
 
Last edited:
Back
Top