PLslide dynamic scope Pslide 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: Pslide, Event patterns and Functions, VarGui, VarGui shortcut builds
Creation / Class Methods
*new (list, repeats, len, step, start, wrapAtEnd, cutItems, envir)
Creates a new PLslide object.
list - Symbol or Pslide 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 Pslide repeats arg. Defaults to inf.
If a Symbol is passed, repeats can be assigned to an envir variable later on.
len - Symbol or Pslide len arg. Defaults to 3.
If a Symbol is passed, len can be assigned to an envir variable later on.
Can be dynamically replaced by Patterns or Streams.
step - Symbol or Pslide step arg. Defaults to 1.
If a Symbol is passed, step can be assigned to an envir variable later on.
Can be dynamically replaced by Patterns or Streams.
start - Symbol or Pslide start arg. Defaults to 0.
If a Symbol is passed, start can be assigned to an envir variable later on.
wrapAtEnd - Symbol or Pslide wrapAtEnd arg. Defaults to true.
If a Symbol is passed, wrapAtEnd can be assigned to an envir variable later on.
cutItems - Symbol or Boolean or Integer (0 or 1) or a Function returning Boolean or Integer.
If a Symbol is passed, cutItems can be assigned to an envir variable later on.
Determines if list items, which are Patterns or Streams themselves,
will be finished if a replacement occurs during their embedding, or if they will be replaced immediately.
The latter is the default behaviour (default value true).
For protecting whole lists from immediate replacements see PLn.
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 = PLslide(\a, inf, \len, \step, \start);
// prepare current Environment
(
~len = 3;
~step = 1;
~start = 0;
~a = [60, 61, 62, 70, 71, 72, 80, 81, 82];
)
// run
(
x = Pbind(
\midinote, p,
\dur, 0.2
).play;
)
// replace list elements
~a[0] = 60.5;
~a[8] = Pseq([92, 80.5], 1);
// len and step can be replaced by Patterns
// PLseq defaults to repeats = inf
~len = Pstutter(5, PLseq([1, 2, 3]));
(
~len = 1;
~step = Pstutter(2, PLseq([0, 4]));
)
x.stop;
//////////////////////
// placeholder may also get lists of event patterns
(
p = PLslide(\a, inf, \len, \step, \start);
~len = 3;
~step = 1;
~start = 0;
~add = 0;
~a = (60, 62..70).collect { |x|
Pbind(
\midinote, x + Pseq((0, 0.2..0.8)) + PL(\add),
\dur, 0.1
);
};
x = p.play;
)
// replace slide params an ~add
~add = [4, 9];
~step = 2;
~len = 4;
~add = [4, 9, 13];
// replace array element
(
~a[0] = Pbind(
\midinote, 80 + Pseq((0.8, 0.6..0)) + PL(\add),
\dur, 0.05
);
)
x.stop;