PL dynamic scope placeholder pattern
Part of: miSCellaneous
Inherits from: PL_Pattern
Takes Symbol args for later reference by the Streams, which will read from variables in the Environments of their instantiation. See PLx suite.
See also: Event patterns and Functions, VarGui, VarGui shortcut builds
Creation / Class Methods
*new (item, repeats, type, envir)
Creates a new PL object.
item - Symbol or other Object.
If a Symbol is passed, item can be assigned to an envir variable later on.
Can be dynamically replaced by Patterns or Streams.
repeats - Symbol or repeats arg. Defaults to inf.
If a Symbol is passed, repeats can be assigned to an envir variable later on.
type - Expects 1 or inf.
Defines how items other than Patterns or Streams should be embedded.
Defaults to 1. Rather to be used by other PLx Patterns than by the user.
envir - Dictionary or one of the Symbols
\top, \t (topEnvironment), \current, \c (currentEnvironment).
Dictionary to be taken for variable reference. Defaults to \current.
Examples
(
s = Server.local;
Server.default = s;
s.boot;
)
// definition for future reference in arbitrary Environments
p = Pbind(\midinote, PL(\a), \dur, 0.2);
// prepare current Environment
(
~a = 60;
x = p.play;
)
// replace with items or patterns
~a = 58;
// PL had repeats = inf, so Pseq is embedded endlessly
~a = Pseq([60, 60, 58, 60, 53, 54.5, 56, 58]);
x.stop;
//////////////////////
// placeholder may also get event patterns
(
p = PL(\a, 1);
~a = Pbind(
\midinote, Pwhite(80, 85),
\dur, 0.2
);
x = p.play;
)
// replace, PL had repeats = 1, so ...
(
~a = Pbind(
\midinote, Pseq((70..65)),
\dur, 0.05
);
)
//////////////////////
// PL may be used in cases where there is no PLx implementation
// Pseg used for pitch curve, linear interpolation
(
p = Pbind(
\midinote, Pseg(PL(\p), PL(\d), \lin, inf),
\dur, 0.1
);
~p = Pshuf((50..75));
~d = 0.2;
x = p.play;
)
// play with segment length
~d = 0.4;
~d = 1;
// can also be replaced by pattern
~d = Pseq([0.2, 0.4, 1]);
// only two points left for interpolation
// there may be repetitions
~p = Pshufn([50, 100]).trace;
x.stop;