To dynamically change a value, use Pfunc. To dynamically change a value pattern, use Plazy. To dynamically change an event pattern, use Pdef.
Some examples:
// dynamically changing a value
(
s.waitForBoot({
var pat;
~duration = 1;
pat = Pbind(
\degree, Pseq([1,2,3], inf),
\dur, Pfunc { ~duration },
);
pat.play;
})
)
// dynamically change ~duration
~duration = 0.1;
~duration = 0.5;
// dynamically changing a value pattern
(
s.waitForBoot({
var pat;
~degrees = [1,2,3];
pat = Pbind(
\degree, Pn(Plazy{ Pseq(~degrees,1) },inf),
\dur, 0.3
);
pat.play;
});
)
// dynamically change ~degrees: change happens when previous pattern is fully played
~degrees = [4,5,6];
~degrees = [11,12,13,14,15,14];
// dynamically change a complete event pattern
(
s.waitForBoot({
~degrees = [1,2,3];
~pat = Pbind(
\degree, Pn(Plazy{ Pseq(~degrees,1) },inf),
\dur, 0.3
);
Pdef(\pat, ~pat);
Pdef(\pat).play;
});
)
// dynamically change complete pattern
(
~pat = Pbind(
\degree, Pwhite(0,12,inf),
\dur, Prand([0.125, 0.25,0.5], inf)
);
Pdef(\pat, ~pat);
)