Hi guys,
I’ve a question related to patterns and lists. Maybe the solution relays in the knowledge of some kind of list pattern I ignore.
I would try to explain what I want to achieve.
Let’s say I have a list of lists like this:
a = [[1,2,3], [4,5,6], [7,8,9]];
I would like to create an Event pattern which should generate random values taken from the first list ( [1,2,3]
) then, let’s say after 3 times, will continue generating random values but, this time, from the second list, and then from the third, and repeat the process again.
The straight way to implement this that comes to my mind is the following:
(
Pbindef(\score1,
\instrument, \default,
\degree, Prand( Pdup(3, Pseq(a, inf)), inf),
\dur, 0.5
).play
);
but, obviously, this approach doesn’t work. The error I see in the post window is this one which makes perfectly sense to me
The preceding error dump is for ERROR: ListPattern (Prand) requires a non-empty collection; received a Pdup.
But the question still remains, I do I achieve the wnated result?
Is there any useful pattern out-of-the-box for doing this?
Thank you so much
n