PLbeta dynamic scope Pbeta variant
Part of: miSCellaneous
Inherits from: Pbeta
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: Pbeta, Event patterns and Functions, VarGui, VarGui shortcut builds
Creation / Class Methods
*new (lo, hi, prob1, prob2, length, envir)
Creates a new PLbeta object.
lo - Symbol or Pbeta lo arg. Defaults to 0.
If a Symbol is passed, lo can be assigned to an envir variable later on.
Can be dynamically replaced by Patterns or Streams.
hi - Symbol or Pbeta hi arg. Defaults to 1.
If a Symbol is passed, hi can be assigned to an envir variable later on.
Can be dynamically replaced by Patterns or Streams.
prob1 - Symbol or Pbeta prob1 arg. Defaults to 1.
If a Symbol is passed, prob1 can be assigned to an envir variable later on.
Can be dynamically replaced by Patterns or Streams.
prob2 - Symbol or Pbeta prob2 arg. Defaults to 1.
If a Symbol is passed, prob2 can be assigned to an envir variable later on.
Can be dynamically replaced by Patterns or Streams.
length - Symbol or Pbeta length arg. Defaults to inf.
If a Symbol is passed, length 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 = Pbind(
\midinote, PLbeta(\lo, \hi, \p1, \p2),
\dur, 0.1
);
)
// prepare current Environment
// prob values for equal distribution
(
~lo = 60;
~hi = 90;
~p1 = 1;
~p2 = 1;
)
// run
x = p.play;
// replace probabilities, get values close to the bounds
(
~p1 = 0.02;
~p2 = 0.02;
)
// change between close-to-bounds and equally-distributed
// PLseq defaults to repeats = inf
(
~p1 = Pstutter(10, PLseq([0.01, 1]));
~p2 = Pstutter(10, PLseq([0.01, 1]));
)
// moving bounds
(
~lo = PLseq((60..70));
~hi = PLseq((80..90));
)
x.stop;