Aha! I had forgotten that Pshuf already does a random but constant order. So, with the method you suggested, not needing Plazy at all:
// an 8 note pattern repeated
Pbindef(\a, \note, (0..7).pshuf, \dur, 1/8).play
// repeat a pattern four times, then pick a new one:
Pbindef(\a, \note, (0..7).pshuf(4).repeat)
But, taking a slightly different approach, and back to Plazy, not quiet sure what is happening here:
// similar to the above, but choosing instead of shuffling:
Pbindef(\a, \note, {7.rand}.dup(8).pseq).play
// repeat four times, then change, fine:
Pbindef(\a, \note, {{7.rand}.dup(8).pseq(4)}.plazy.repeat) // works
// but, without the function braces, doesn't work as intended, repeats one pattern forever
Pbindef(\a, \note, {7.rand}.dup(8).pseq(4).plazy.repeat)
Here's the extensions:
+ ArrayedCollection {
pseq {|repeats=inf, offset=0|
^Pseq(this, repeats, offset);
}
pshuf {|repeats=inf|
^Pshuf(this, repeats);
}
}
+ Pattern {
plazy {
^Plazy({this});
}
}
+ Function {
plazy {
^Plazy(this);
}
}