Changing round robin cycle size


New Member
I'm building an instrument that has various articulations with different amounts of round robins. This is causing me problems because if I have 12 on articulation A and 10 on articulation B, then when I activate B (with a key switch) and play it, it will still count up to 12 and so I will play two notes that don't trigger anything until the cycle resets.

So my question is, is there a way that I could make Kontakts cycle count to one number when I triggered one articulation and a different number when I trigger another? Like setting the cycle max when a MIDI message is received for a specific keyswitch?

Thanks in advance to anyone who can help!


KSP Wizard
Here's how it would work in your illustrated case (assuming articulation A is the first 12 groups then articulation B is the next 10 groups).

on init
    declare const $NUM_ARTICS := 2


    declare %artic_grp_start[$NUM_ARTICS] := (0, 12)
    declare %artic_key_min[$NUM_ARTICS] := (48, 60)    { set keyrange for articulations here, this is lowest key used for all artics }
    declare %artic_key_max[$NUM_ARTICS] := (84, 96)    { set keyrange for articulations here, this is highest key used for all artics }
    declare %KS[$NUM_ARTICS] := (36, 37)
    declare %NUM_RR[$NUM_ARTICS] := (12, 10)
    declare %RR_count[$NUM_ARTICS]

    declare $i
    declare $search_KS
    declare $sel_KS

end on

function KeyColor()
    $i := 0
    while ($i < 128)
        set_key_color($i, $KEY_COLOR_INACTIVE)
        set_key_type($i, $NI_KEY_TYPE_NONE)

        if (in_range($i, %artic_key_min[$sel_KS], %artic_key_max[$sel_KS]))
            set_key_color($i, $KEY_COLOR_BLUE)
            set_key_type($i, $NI_KEY_TYPE_DEFAULT)
        end if

    end while

    $i := 0
    while ($i < $NUM_ARTICS)
        if ($i = $sel_KS)
            set_key_color(%KS[$i], $KEY_COLOR_GREEN)
            set_key_color(%KS[$i], $KEY_COLOR_RED)
        end if

        set_key_type(%KS[$i], $NI_KEY_TYPE_CONTROL)

    end while
end function

on persistence_changed
    call KeyColor()
end on

on note
    { process keyswitches }
    $search_KS := search(%KS, $EVENT_NOTE)
    if ($search_KS # -1)
        $sel_KS := $search_KS
        call KeyColor()

    end if

    { process playable keyrange }
    if (in_range($EVENT_NOTE, %artic_key_min[$sel_KS], %artic_key_max[$sel_KS]))

        if (%RR_count[$sel_KS] >= %NUM_RR[$sel_KS])
            %RR_count[$sel_KS] := 0
        end if
    end if
end on