I’m trying to wrap my brain around how to use a Pattern’s stream in multiple places across multiple Pbinds. Within a single Pbind, I could use Pkey()
to access values from a Pattern associated with one key for a different key. I’d like to accomplish something like this that I could use across multiple Pbinds, preferably something that I could re-evaluate in one place, and have the (identical) changes take effect in multiple places.
Now I understand that Patterns are stateless, so assigning a nondeterministic Pattern (e.g, Pshuf) to a variable, then using that variable in multiple Pbinds results in different Pshuf permutations within each Pbind . This makes sense. But I would have thought that I could do something like:
a = Pshuf([1,2,3,4], inf).asStream;
b = a.shallowCopy;
to get two identical Routines. The Pattern may be stateless, but the stream shouldn’t be (at some point the Pshuf permutation is chosen, and it has some kind of internal iterator). But the result is two different permutations, as before.
Now I can get the effect I want by building/storing an array and putting it into a Pseq
like this:
a = List[0,1,2,3].scramble;
~p = Pbind(
\degree, Pn(Plazy { Pseq(a.()) }),
).play;
But I’m basically missing out on most of the benefits that patterns bring by doing the work myself and putting it into a Pseq at the last minute. If I wanted to re-use something like Pbjorkland1(Pwhite(2,13),16))
, I’d need to roll my own Euclidean algorithm, instead of using the existing one.
Does anyone have any approaches to storing/reusing/re-evaluating Pattern output in multiple places?