This is my attempt in the \dur key, which does not work. Every time Pswitch1 receives a 0, it rests. Every time Pswitch1 receives a 1, the synth plays. When Pswitch1 receives a 2, I want Pn(0.25,2) to play the exact same note two times. Is there a way to achieve this, ideally without changing the pattern in Pseq?
I have spent several hours on this but cannot find a solution.
Pswitch can contain Pbinds, so there’s the linkage.
p = Pchain(
// unfortunately I don't see a way to keep statelessness
// but will try to isolate the mess inside a block
// (because 'degree' needs to be one stream shared across several patterns)
var degree = Pseq([1, 2, 3], inf).trace.asStream;
// unfortunately \dur must come first here
Pbind(\dur, Pn(Rest(1), 1), \degree, degree),
Pbind(\dur, Pn(1, 1), \degree, degree),
Pbind(\dur, Pn(0.25, 2), \degree, Pdup(2, degree))
], Pseq([0, 1, 0, 2, 0, 2], inf))
jamshark70, jordan, thank you so much for your time and effort. I need to experiment with your suggestions quite a bit in order to understand, what is actually happening. There is no doubt that this helps and teaches me a lot. I will also take a look at the Pattern Internals in that “Pattern Guide Reference”. Thank you again!