supernova: fix boost.thread move semantics
[supercollider.git] / Help / UGens / Random / CoinGate.html
blob84969074647dde1d2993a205d45f81cadbe253df
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="824.42">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #a71e12}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
17 span.s1 {font: 18.0px Helvetica}
18 span.s2 {color: #0019b7}
19 span.s3 {color: #606060}
20 span.s4 {color: #326f17}
21 span.Apple-tab-span {white-space:pre}
22 </style>
23 </head>
24 <body>
25 <p class="p1"><span class="s1"><b>CoinGate<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>statistical gate</b></p>
26 <p class="p2"><br></p>
27 <p class="p1"><b><span class="Apple-tab-span"> </span>*kr(prob, trig)</b></p>
28 <p class="p1"><b><span class="Apple-tab-span"> </span>*ar(prob, trig)</b></p>
29 <p class="p3"><br></p>
30 <p class="p1">When it receives a trigger, it tosses a coin, and either passes the trigger or doesn't.</p>
31 <p class="p3"><br></p>
32 <p class="p1"><b><span class="Apple-tab-span"> </span>prob</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>value between 0 and 1 determines probability of either possibilities</p>
33 <p class="p1"><b><span class="Apple-tab-span"> </span>trig</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>input signal</p>
34 <p class="p4"><br></p>
35 <p class="p4"><br></p>
36 <p class="p5">//examples</p>
37 <p class="p6"><br></p>
38 <p class="p7">(</p>
39 <p class="p7">a = <span class="s2">SynthDef</span>(<span class="s3">"help-TCoin"</span>, { <span class="s2">arg</span> out=0, prob=0.5;</p>
40 <p class="p7"><span class="Apple-tab-span"> </span><span class="s2">var</span> trig;</p>
41 <p class="p7"><span class="Apple-tab-span"> </span>trig = <span class="s2">CoinGate</span>.kr(prob, <span class="s2">Impulse</span>.kr(10));</p>
42 <p class="p7"><span class="Apple-tab-span"> </span><span class="s2">Out</span>.ar(out,<span class="Apple-converted-space"> </span></p>
43 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">SinOsc</span>.ar(</p>
44 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">TRand</span>.kr(300.0, 400.0, trig),0,0.2<span class="Apple-converted-space"> </span></p>
45 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
46 <p class="p7"><span class="Apple-tab-span"> </span>)</p>
47 <p class="p7">}).play;</p>
48 <p class="p7">)</p>
49 <p class="p6"><br></p>
50 <p class="p7">a.set(<span class="s4">\prob</span>, 1.0);</p>
51 <p class="p7">a.set(<span class="s4">\prob</span>, 0.0);</p>
52 <p class="p7">a.set(<span class="s4">\prob</span>, 0.1);</p>
53 <p class="p6"><br></p>
54 <p class="p6"><br></p>
55 <p class="p7">(</p>
56 <p class="p7">a = <span class="s2">SynthDef</span>(<span class="s3">"help-TCoin"</span>, { <span class="s2">arg</span> out=0, prob=0.5;</p>
57 <p class="p7"><span class="Apple-tab-span"> </span><span class="s2">var</span> trig;</p>
58 <p class="p7"><span class="Apple-tab-span"> </span>trig = <span class="s2">Impulse</span>.ar(20, 0, <span class="s2">SinOsc</span>.kr(0.5,0,1,1));</p>
59 <p class="p7"><span class="Apple-tab-span"> </span><span class="s2">Out</span>.ar(out,<span class="Apple-converted-space"> </span></p>
60 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">Mix</span>.fill(3, {<span class="s2">Ringz</span>.ar(<span class="s2">CoinGate</span>.ar(prob, trig*0.5), #[1,1.5]*<span class="s2">Rand</span>(1000, 9000), 0.01)})</p>
61 <p class="p7"><span class="Apple-tab-span"> </span>)</p>
62 <p class="p7">}).play;</p>
63 <p class="p7">)</p>
64 <p class="p6"><br></p>
65 <p class="p7">a.set(<span class="s4">\prob</span>, 1.0);</p>
66 <p class="p7">a.set(<span class="s4">\prob</span>, 0.0);</p>
67 <p class="p7">a.set(<span class="s4">\prob</span>, 0.1);</p>
68 <p class="p6"><br></p>
69 <p class="p6"><br></p>
70 <p class="p6"><br></p>
71 <p class="p6"><br></p>
72 </body>
73 </html>