Create individual random round-robin-chains in KSP


#1

Hi,

I posted my Pastaplate-samples some days ago and I took some time to clean and pitch them. Some days ago I started creating my first Kontakt-instrument with them also learning the programming of Kontakt but I am a bit stuck at the creation of the round-robin-chains for several mic-positions.

As a starting-point I chose the script from David Hilowitz for the random non-repetetive round-robin:
(https://www.youtube.com/watch?v=Er8O8eZ4cZQ)

"
on init
declare %list[7]
declare $at := num_elements(%list)
{ %list is the order the groups will play, $at is the current position in the list. }
{ for any number of round robin groups other than 7, change the %list size. }

declare $x
declare $last

declare @debug { remove this and the debug section below after testing }
end on

on note
disallow_group($ALL_GROUPS)

inc($at)

{ if all groups in the list have been played, fill the list with all groups in random }
{ order, and make sure the last played group is not the first in the new list }
if($at >= num_elements(%list))

{ remember last played group }
$last := %list[num_elements(%list) - 1]

{ fill list with all groups in random order }
%list[0] := 0
$at := 1
while($at # num_elements(%list))
  $x := random(0, $at)
  %list[$at] := %list[$x]
  %list[$x] := $at
  inc($at)
end while
$at := 0

{ if the last played group is first in the new list, swap first and last in the list }
if(%list[0] = $last)
  %list[0] := %list[num_elements(%list) - 1]
  %list[num_elements(%list) - 1] := $last
end if

{ debug: show list }
$x := 0
@debug := "list:"
while($x # num_elements(%list))
  @debug := @debug & " " & %list[$x]
  inc($x)
end while
message(@debug)
{ debug end }

end if

{ enable a group from the list }
allow_group(%list[$at])
end on
"

So a pool of 7 Groups would be played as RR

Can anyone please help me setting up a second round-robin-chain for e.g. additional 7 groups playing in parallel to the first RR-chain? I already declared his variables a second time with the suffix “_2” so just the algorithm in the “on note” block needs to be duplicated and changed (?).

Thanks in advance!

stay tuned
Max


#2

Hey, you know Murphys law?

Yeah, I found a simple solution.
Just copy the algorithm and change the names of all variabeles in the second algorithm (do not forget to declare them!) e.g. use %list_1 in the first RR-chain and %list_2 for the second. And within the term

allow_group(%list[$at])

at the end, just slap the length of your RR-chain on it.
E.G.

allow_group(%list_1[$at_1]) first chain
allow_group(%list_2[$at_2]+6) second chain
allow_group(%list_3[$at_3]+12) third chain for 6x RR

Hope that helps, if anyone has the same question!

stay tuned
Max