How do I run one drive one sequence with another?

I’m trying to run a sequence of notes in a sequence of modes. I want start with the first mode, play through the note sequence, then repeat the pattern with next mode.

This seems like it should be simple, but I can’t figure out how to do it.

Pchain shown below is the latest failure. This seems basic. I’m asking for help before delving into environment variables and Pgate.

// modal transposition
var notes, modes;
modes = Pseq( [0,1,2,3], 1);
notes = Pseq( [0,1,2,3,4,5,6,7], 1);
	Pchain( Pbind(\mtranspose, modes ) ,Pbind(
        \dur, 0.15,
	    \mtranspose, 0,
        \degree, notes,
		\legato, 0.5

Maybe Ndef’s as a sub pattern?

You can play a Pseq of Pbinds. In this case we would get the array of Pbinds by calling collect on the modes array:

var modes = [0,1,2,3]; // simple list, no Pseq here
var notes = Pseq([0,1,2,3,4,5,6,7], 1);
// collect on the list to get a list of Pbinds:
var pbinds = modes.collect { |mode|
		\dur, 0.15,
		\mtranspose, mode,
		\degree, notes,
		\legato, 0.5
// play a Pseq of Pbinds

// note that calling .collect on the pseq doesn't work.
// so the following wouldn't work:
// Pseq(modes).collect { |mode| Pbind(...) }

It gets cleaner if you make your “arpeggio” (in this case the ascending scale) a Pdef:

Pdef(\ascendingScale, Pbind(
	\dur, 0.15,
	\degree, Pseq( [0,1,2,3,4,5,6,7], 1),
	\legato, 0.5

// note: we use Pchain to apply the selected mode to the generic Pdef
// (and just in case you didn't know, '<>' is a shortcut for Pchain)
	Pdef(\ascendingScale) <> (mtranspose: mode)

Thanks for the reply!
The examples clarify the syntax. I was trying similar approaches but couldn’t get the concept right. I never thought to use collect. Makes sense. I didn’t know about the <> short cut.

1 Like

I reorganized my project with Pdefs. It’s much clearer. Thanks!

1 Like