Sequencing different patterns keeping the index

I’m trying to create a pattern that combines 3-note arpeggios in 8-note sequences. The idea is similar to that of Pser sequencing a triad for 8 steps, but I want to keep the index value on the next triad.

Here’s an example with 2 triads [0,2,4] [1,3,5]. How could I sequence them using Patterns so I get:

[ 0,2,4,0,2,4,0,2, 5,1,3,5,1,3,5,1, 2,4,0,2,4,0,2,4, 5,...] // arpeggio note
//1 2 3 4 5 6 7 8  1 2 3 4 5 6 7 8  1 2 3 4 5 6 7 8  1 ... // step number in 8-note sequence
//0 1 2 0 1 2 0 1  2 0 1 2 0 1 2 0  1 2 0 1 2 0 1 2  0 ... // arpeggio index
//|      A      |  |      B      |  |       A     |  |  B ...  // 

Using Pser doesn’t work because it resets the pattern.

Pseq(Pser([0,2,4],8), Pser([1,3,5],8), inf) => 0,2,4,0,2,4,0,2, | 1,3,5 ... 

I tried Pindex but I haven’t found a way to make it work. I can’t figure out how to change the pattern after 8 steps.

Any ideas?

p = Pswitch1([Pseq([0,2,4], inf), Pseq([1,3,5], inf)], Pseries().dupEach(8)) 
p.asStream.nextN(40)

Pindex is, uh, less than intuitive imo. I meant to update the docs for that and some other related patterns at one points, then forgot about it. Yours might make a good example though (for Pswitch1)!

1 Like

That seems to work, thanks!