Include a header file required for build on mac 10.4
[supercollider.git] / Help / Control / IEnvGen.htm
blob412c80f123d3629ed03d5c0e13a86c6185df516e
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: 13.0px Helvetica; color: #000000}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; min-height: 14.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
18 span.s1 {font: 18.0px Helvetica}
19 span.s2 {font: 9.0px Monaco}
20 span.s3 {color: #0000bf}
21 span.s4 {color: #007300}
22 span.s5 {color: #000000}
23 span.Apple-tab-span {white-space:pre}
24 </style>
25 </head>
26 <body>
27 <p class="p1"><span class="s1"><b>IEnvGen</b></span><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><b>envelope generator for polling values from an InterplEnv</b></p>
28 <p class="p2"><br></p>
29 <p class="p3"><b>superclass: UGen</b></p>
30 <p class="p4"><b></b><br></p>
31 <p class="p3"><b><span class="Apple-tab-span"> </span>*ar(ienvelope, index, mul, add)</b></p>
32 <p class="p3"><b><span class="Apple-tab-span"> </span>*kr(ienvelope, index, mul, add)</b></p>
33 <p class="p4"><br></p>
34 <p class="p3"><span class="Apple-tab-span"> </span>Plays back break point envelopes from the index point. The envelopes are instances of the InterplEnv <span class="Apple-tab-span"> </span>class. See the <b>InterplEnv</b> help file for more info.<span class="Apple-converted-space"> </span></p>
35 <p class="p2"><br></p>
36 <p class="p2"><span class="Apple-tab-span"> </span></p>
37 <p class="p3"><span class="s2"><span class="Apple-tab-span"> </span></span><b>ienvelope</b> <span class="Apple-tab-span"> </span>an instance of InterplEnv (this is static for the life of the UGen)</p>
38 <p class="p3"><span class="Apple-tab-span"> </span><b>index<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>a point to access within the InterplEnv</p>
39 <p class="p4"><br></p>
40 <p class="p5"><br></p>
41 <p class="p6">// example</p>
42 <p class="p5"><br></p>
43 <p class="p7"><span class="s3">SynthDef</span>(<span class="s4">\test</span>, {<span class="s3">arg</span> gate = 1;</p>
44 <p class="p7"><span class="Apple-tab-span"> </span><span class="s3">var</span> env, sin;</p>
45 <p class="p7"><span class="Apple-tab-span"> </span>sin = <span class="s3">SinOsc</span>.ar(440, 0, 1);</p>
46 <p class="p7"><span class="Apple-tab-span"> </span>env = <span class="s3">InterplEnv</span>([0, 0.6, 0.3, 1.0, 0], [0.1, 0.02, 0.4, 1.1], [<span class="s4">\lin</span>, <span class="s4">\exp</span>, -6, <span class="s4">\sin</span>]).plot;<span class="Apple-tab-span"> </span><span class="s3">Out</span>.ar(0, sin *<span class="Apple-converted-space"> </span></p>
47 <p class="p6"><span class="s5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// use MouseX to index into the InterplEnv to control amps</p>
48 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">IEnvGen</span>.kr(env, <span class="s3">MouseX</span>.kr(0, env.times.sum)) *</p>
49 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">EnvGen</span>.kr(<span class="s3">Env</span>.asr(0.01, 1, 0.01), gate, doneAction: 2);</p>
50 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
51 <p class="p7">}).load(s);</p>
52 <p class="p5"><br></p>
53 <p class="p7">s = <span class="s3">Server</span>.internal.boot;</p>
54 <p class="p7">s.scope;</p>
55 <p class="p5"><br></p>
56 <p class="p7">s.sendMsg(<span class="s4">\s_new</span>, <span class="s4">\test</span>, a = s.nextNodeID, 0, 1);</p>
57 <p class="p7">s.sendMsg(<span class="s4">\n_set</span>, a, <span class="s4">\gate</span>, 0);</p>
58 <p class="p5"><br></p>
59 <p class="p6">// index with an SinOsc ... mouse controls amplitude of SinOsc</p>
60 <p class="p8">SynthDef<span class="s5">(</span><span class="s4">\test</span><span class="s5">, {</span></p>
61 <p class="p7"><span class="Apple-tab-span"> </span><span class="s3">var</span> env, sin;</p>
62 <p class="p7"><span class="Apple-tab-span"> </span>sin = <span class="s3">SinOsc</span>.ar(440, 0, <span class="s3">MouseX</span>.kr(0, 1));</p>
63 <p class="p6"><span class="s5"><span class="Apple-tab-span"> </span></span>// use offset so negative values of SinOsc will map into the InterplEnv</p>
64 <p class="p7"><span class="Apple-tab-span"> </span>env = <span class="s3">InterplEnv</span>([-1, -0.7, 0.7, 1], [ 0.8666, 0.2666, 0.8668 ], <span class="s4">\lin</span>, -1.0);</p>
65 <p class="p7"><span class="Apple-tab-span"> </span><span class="s3">Out</span>.ar(0, <span class="s3">IEnvGen</span>.ar(env, sin))<span class="Apple-converted-space"> </span></p>
66 <p class="p7">}).load(s);</p>
67 <p class="p5"><br></p>
68 <p class="p7">s.sendMsg(<span class="s4">\s_new</span>, <span class="s4">\test</span>, a = s.nextNodeID, 0, 1);</p>
69 <p class="p7">s.sendMsg(<span class="s4">\n_free</span>, a);</p>
70 <p class="p5"><br></p>
71 <p class="p5"><br></p>
72 <p class="p6">// index with Amplitude of input, control freq of SinOsc</p>
73 <p class="p7"><span class="s3">SynthDef</span>(<span class="s4">\test</span>, {<span class="s3">arg</span> inbus;</p>
74 <p class="p7"><span class="Apple-tab-span"> </span><span class="s3">var</span> env, point;</p>
75 <p class="p7"><span class="Apple-tab-span"> </span>point = <span class="s3">Amplitude</span>.ar(<span class="s3">In</span>.ar(inbus), 0.01, 0.2);</p>
76 <p class="p6"><span class="s5"><span class="Apple-tab-span"> </span></span>// use offset so negative values of SinOsc will map into the InterplEnv</p>
77 <p class="p7"><span class="Apple-tab-span"> </span>env = <span class="s3">InterplXYC</span>([[0, 330, <span class="s4">\exp</span>], [0.5, 440, <span class="s4">\exp</span>], [1.0, 1760]]);</p>
78 <p class="p7"><span class="Apple-tab-span"> </span><span class="s3">Out</span>.ar(1, <span class="s3">SinOsc</span>.ar(<span class="s3">IEnvGen</span>.kr(env, point), 0, 0.2))<span class="Apple-converted-space"> </span></p>
79 <p class="p7">}).load(s);</p>
80 <p class="p5"><br></p>
81 <p class="p7">s.sendMsg(<span class="s4">\s_new</span>, <span class="s4">\test</span>, a = s.nextNodeID, 0, 1, <span class="s4">\inbus</span>, s.options.numOutputBusChannels);</p>
82 <p class="p7">s.sendMsg(<span class="s4">\n_free</span>, a);</p>
83 </body>
84 </html>