you can use it to live code! for example:
(
SynthDef (\folded_sine) {
arg lag = 0;
var sig;
sig = SinOsc.ar (\freq.kr (330, lag));
sig = (sig * \fold.kr (0, lag)).fold2 (1);
sig = Pan2.ar (sig, \pan.kr (0, lag), \amp.kr (0.1, lag));
Out.ar (0, sig);
}.add;
~pattern = Pmono (\folded_sine,
\delta, Pfunc { ~delta.choose },
\freq, Pfunc { ~chord.choose.midicps * ~octaves.choose },
\fold, Pfunc { ~fold.choose },
\lag, Pfunc { ~lag },
\pan, Pwhite (-1.0, 1.0),
);
~delta = [ 2 / 7 ];
~chord = [ 0, 3, 7, 10, 14, 17 ] + 62;
~fold = [ 1 ];
~octaves = [ 1 ];
~lag = 0;
)
and then evaluate the following, line by line:
~play = Ppar (~pattern!6, inf).play
~lag = 0.2
~fold = (1..3)
~delta = (2..4) / 7
~octaves = 2 ** (-1..1)
~octaves = [ 1 ]
~chord = [ 0, 3, 7, 10, 14, 17 ] + 62
~chord = [ 0, 4, 7, 14, 18, 21 ] + 61
~chord = [ 0, 3, 7, 10, 14, 17 ] + 60
~chord = [ 0, 4, 7, 14, 18, 21 ] + 59
~delta = (1..4).nthPrime.reciprocal
~fold = [ 1 ]
~play.stop
by constantly directing the pattern to an environment variable, Pfunc
lets you control pattern parameters in real time, ie. without having to rebuild the pattern.