PLtuple dynamic scope Ptuple variant
Part of: miSCellaneous
Inherits from: PL_ListPattern
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: Ptuple, Event patterns and Functions, VarGui, VarGui shortcut builds
Creation / Class Methods
*new (list, repeats, envir)
Creates a new PLtuple object.
list - Symbol or Ptuple list arg.
If a Symbol is passed, list can be assigned to an envir variable later on.
This lists's elements can be dynamically replaced by Patterns or Streams.
repeats - Symbol or Ptuple repeats arg. Defaults to inf.
If a Symbol is passed, repeats can be assigned to an envir variable later on.
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 = PLtuple(\a);
// prepare current Environment
// PLtuple defaults to repeats = inf,
// so inner Patterns are repeatedly embedded
~a = [ Pshuf((60..65)), 70, Pshuf((75..80)) ];
// run
x = Pbind(\midinote, p, \dur, 0.2).trace.play;
// replace elements
~a[0] = 72.5;
~a[1] = 74.5;
~a[2] = Prand([85, 86, 87]);
// replace array
// Ptuple and PLtuple start with new embedding of ALL patterns
// if one ends, so here default repeats = inf of PLshuf has no effect:
// new permutation with every loop as Pshuf has repeats = 1
~a = [ Pshuf((60..65)), 70, PLshuf((75..80)) ];
// both Patterns have repeats = inf,
// permutation is kept
~a = [ PLshuf((60..65)), 70, PLshuf((75..80)) ];
x.stop;