Sytax for pattern inside a regular array?

What is the syntax for putting a pattern inside a regular array?

This is the idea:

Pbind(\degree, [0, Pseq([2,4,6],inf)]).play;

Doesn’t throw an error, but the pattern doesn’t sound, I hear only the 0, I expected to hear a chord of 0 and one of the values inside the pattern.

This is not the regular way of writing patterns. The normal way would be something like:

Pbind(\degree, Pseq( [0, Pseq([2,4,6],inf), inf)]).play;

and you could use any other Pattern that takes the array as argument, such as Prand or Pser. plus use another number of repeats than inf.

Patterns are designed so that you can nest patterns inside of patterns. But they must be patterns, not arrays.


Thanks. But that is not what I’m trying to achieve.
Your code plays: 0, 2, 4, 6, 2, 4, 6, 2, 4, ....
What I’m aiming for is to play: [0,2], [0,4], [0,6], [0,2], [0,4], ...

One solution would be:

Pbind(\degree, Pseq([[0,2],[0,4], [0,6]],inf)).play

but I was wondering if there is a simpler way to get the same result.
Any ideas?

You can use Ptuple in this situation:

Pbind(\degree, Ptuple([0, Pseq([2,4,6],inf)],inf)).play

Ah, yes! Thanks @vmx. That’s what I was looking for!

As the first component is not sequenced a further alternative would be collecting.

Pbind(\degree, Pseq([2,4,6],inf).collect { |i| [0, i] }).play

// or shorter

Pbind(\degree, Pseq([2,4,6],inf).collect([0,_])).play

hum… that’s an interesting one. Thanks @dkmayer!