59 lines
913 B
Text
59 lines
913 B
Text
class:: CoinGate
|
|
summary:: Statistical gate.
|
|
categories:: UGens>Generators>Stochastic
|
|
|
|
|
|
Description::
|
|
|
|
When CoinGate receives a trigger, it tosses a coin
|
|
and either passes the trigger or doesn't.
|
|
|
|
|
|
classmethods::
|
|
|
|
method::ar, kr
|
|
|
|
argument::prob
|
|
|
|
Value between 0.0 and 1.0 determines probability of either possibilities.
|
|
|
|
|
|
argument::in
|
|
The trigger input.
|
|
|
|
Examples::
|
|
|
|
code::
|
|
|
|
(
|
|
a = SynthDef("help-TCoin", { arg out=0, prob=0.5;
|
|
var trig;
|
|
trig = CoinGate.kr(prob, Impulse.kr(10));
|
|
Out.ar(out,
|
|
SinOsc.ar(
|
|
TRand.kr(300.0, 400.0, trig),0,0.2
|
|
)
|
|
)
|
|
}).play;
|
|
)
|
|
|
|
a.set(\prob, 1.0);
|
|
a.set(\prob, 0.0);
|
|
a.set(\prob, 0.1);
|
|
|
|
|
|
(
|
|
a = SynthDef("help-TCoin", { arg out=0, prob=0.5;
|
|
var trig;
|
|
trig = Impulse.ar(20, 0, SinOsc.kr(0.5,0,1,1));
|
|
Out.ar(out,
|
|
Mix.fill(3, {Ringz.ar(CoinGate.ar(prob, trig*0.5), #[1,1.5]*Rand(1000, 9000), 0.01)})
|
|
)
|
|
}).play;
|
|
)
|
|
|
|
a.set(\prob, 1.0);
|
|
a.set(\prob, 0.0);
|
|
a.set(\prob, 0.1);
|
|
|
|
::
|