Include a header file required for build on mac 10.4
[supercollider.git] / Help / Libraries / JITLib / nodeproxy / Ndef.html
blob0a52f7e3c7ded8c1bf2ff1db934ffaa577ae48b1
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="1038.32">
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: 9.0px Monaco; min-height: 12.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #0000ee}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica; min-height: 17.0px}
18 p.p9 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
19 p.p10 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
20 p.p11 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
21 p.p12 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
22 p.p13 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco}
23 p.p14 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000; min-height: 12.0px}
24 p.p15 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #007300}
25 p.p16 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf; min-height: 12.0px}
26 p.p17 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #737373}
27 p.p18 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #007300; min-height: 12.0px}
28 p.p19 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
29 span.s1 {font: 18.0px Helvetica}
30 span.s2 {font: 9.0px Monaco}
31 span.s3 {color: #000000}
32 span.s4 {text-decoration: underline}
33 span.s5 {color: #0000bf}
34 span.s6 {text-decoration: underline ; color: #0000ee}
35 span.s7 {color: #007300}
36 span.s8 {font: 12.0px Helvetica}
37 span.s9 {color: #bf0000}
38 span.s10 {font: 12.0px Helvetica; color: #000000}
39 span.s11 {color: #737373}
40 span.s12 {font: 9.0px Monaco; color: #007300}
41 span.s13 {font: 12.0px Helvetica; color: #0000bf}
42 span.Apple-tab-span {white-space:pre}
43 </style>
44 </head>
45 <body>
46 <p class="p1"><span class="s1"><b>Ndef<span class="Apple-tab-span"> </span></b></span><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><b>node proxy definition</b></p>
47 <p class="p2"><br></p>
48 <p class="p3"><span class="s3"><b>Inherits from:</b> <a href="../../../Core/Object.html"><span class="s4">Object</span></a></span><span class="s5"> : <a href="../../../Core/Kernel/AbstractFunction.html"><span class="s6">AbstractFunction</span></a> :</span><span class="s3"> <a href="BusPlug.html"><span class="s4">BusPlug</span></a></span><span class="s5"> :</span><span class="s3"> <a href="NodeProxy.html"><span class="s4">NodeProxy</span></a></span></p>
49 <p class="p4"><br></p>
50 <p class="p4"><br></p>
51 <p class="p1">Reference to a proxy, forms an alternative to <a href="../environments/ProxySpace.html"><span class="s5">ProxySpace</span></a>.<span class="Apple-converted-space"> </span></p>
52 <p class="p1">All methods are inherited from <a href="NodeProxy.html"><span class="s5">NodeProxy</span></a></p>
53 <p class="p4"><br></p>
54 <p class="p1"><b>Ndef(key)</b> returns the instance</p>
55 <p class="p1"><b>Ndef(key, obj)</b> stores the object and returns the instance, like <a href="../Patterns/Tdef.html"><span class="s5">Tdef</span></a> and <a href="../Patterns/Pdef.html"><span class="s5">Pdef</span></a>.</p>
56 <p class="p4"><br></p>
57 <p class="p1">Graphical editor overviewing all current Ndefs: <a href="../extras/NdefMixer.html"><span class="s5">NdefMixer</span></a></p>
58 <p class="p1">A general overview: <a href="../JITLib.html"><span class="s5">JITLib</span></a></p>
59 <p class="p4"><br></p>
60 <p class="p4"><br></p>
61 <p class="p5"><b>First Example</b></p>
62 <p class="p4"><br></p>
63 <p class="p6"><span class="Apple-tab-span"> </span>s.boot;</p>
64 <p class="p2"><span class="Apple-tab-span"> </span></p>
65 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s5">Ndef</span><span class="s3">(</span><span class="s7">\a</span><span class="s3">).play; </span>// play to hardware output.</p>
66 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s5">Ndef</span><span class="s3">(</span><span class="s7">\a</span><span class="s3">).fadeTime = 2; </span>// fadeTime specifies crossfade</p>
67 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span></span>// set the source</p>
68 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\a</span>, { <span class="s5">SinOsc</span>.ar([350, 351.3], 0, 0.2) });</p>
69 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\a</span>, { <span class="s5">Pulse</span>.ar([350, 351.3] / 4, 0.4) * 0.2 });</p>
70 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\a</span>, <span class="s5">Pbind</span>(<span class="s7">\dur</span>, 0.03, <span class="s7">\freq</span>, <span class="s5">Pbrown</span>(0, 1, 0.1, <span class="s5">inf</span>).linexp(0, 1, 200, 350)));</p>
71 <p class="p2"><span class="Apple-tab-span"> </span></p>
72 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\a</span>, { <span class="s5">Ringz</span>.ar(<span class="s5">Ndef</span>.ar(<span class="s7">\b</span>), [350, 351.3] * 8, 0.2) * 4 });</p>
73 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\b</span>, { <span class="s5">Impulse</span>.ar([5, 7]/2, [0, 0.5]) });</p>
74 <p class="p2"><span class="Apple-tab-span"> </span></p>
75 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s5">Ndef</span><span class="s3">.clear(3); </span>// clear all after 3 seconds</p>
76 <p class="p2"><br></p>
77 <p class="p8"><br></p>
78 <p class="p9"><b>Creation / Class Methods</b></p>
79 <p class="p10"><br></p>
80 <p class="p10"><br></p>
81 <p class="p11"><span class="Apple-tab-span"> </span><b>*new(key, object)</b></p>
82 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Return a new node proxy and store it in a global ProxySpace under the key. If there is already an Ndef there, replace its object with the new one. The object can be any supported class, see <a href="NodeProxy.html"><span class="s5">NodeProxy</span></a> help.</p>
83 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
84 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>If key is an association, it is interpreted as <b>key -&gt; server name.<span class="Apple-converted-space"> </span></b> (order changed in SC3.3 !).</p>
85 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>If no name is given, it uses the default server that was default when Ndef was first called. (to change it, see defaultServer_(server)).</p>
86 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
87 <p class="p11"><span class="Apple-tab-span"> </span><b>*ar(key, numChannels, offset)</b></p>
88 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>equivalent to *new(key).ar(numChannels, offset) (see <a href="NodeProxy.html"><span class="s5">NodeProxy</span></a> help for ar method)</p>
89 <p class="p10"><span class="Apple-tab-span"> </span></p>
90 <p class="p11"><span class="Apple-tab-span"> </span><b>*kr(key, numChannels, offset)</b></p>
91 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>equivalent to *new(key).kr(numChannels, offset) (see <a href="NodeProxy.html"><span class="s5">NodeProxy</span></a> help for kr method)</p>
92 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
93 <p class="p11"><span class="s2"><span class="Apple-tab-span"> </span></span><b>*clear</b></p>
94 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>clear all proxies</p>
95 <p class="p12"><br></p>
96 <p class="p11"><span class="s2"><span class="Apple-tab-span"> </span></span><b>*at(server, key)</b></p>
97 <p class="p11"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>return an instance at that key for that server</p>
98 <p class="p12"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
99 <p class="p11"><b><span class="Apple-tab-span"> </span>*defaultServer_(a server)</b></p>
100 <p class="p11"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>set the default server (default: Server.default)</p>
101 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
102 <p class="p11"><b><span class="Apple-tab-span"> </span>*all</b></p>
103 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Return the dictionary of all servers, pointing to proxyspaces with Ndefs for each.</p>
104 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
105 <p class="p13"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>.all;</p>
106 <p class="p2"><span class="Apple-tab-span"> </span></p>
107 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
108 <p class="p11"><span class="Apple-tab-span"> </span><b>*dictFor(server)</b></p>
109 <p class="p11"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Return the proxyspace for a given server.</p>
110 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
111 <p class="p13"><span class="s8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><span class="s5">Ndef</span>.dictFor(s);</p>
112 <p class="p2"><br></p>
113 <p class="p2"><br></p>
114 <p class="p14"><br></p>
115 <p class="p14"><br></p>
116 <p class="p14"><br></p>
117 <p class="p5"><b>Example</b><span class="s2"><span class="Apple-tab-span"> </span></span></p>
118 <p class="p14"><br></p>
119 <p class="p2"><span class="Apple-tab-span"> </span></p>
120 <p class="p6"><span class="Apple-tab-span"> </span>s.boot;</p>
121 <p class="p2"><span class="Apple-tab-span"> </span></p>
122 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>).play;</p>
123 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>).fadeTime = 1;</p>
124 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>, { <span class="s5">SinOsc</span>.ar([600, 635], 0, <span class="s5">SinOsc</span>.kr(2).max(0) * 0.2) });</p>
125 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>, { <span class="s5">SinOsc</span>.ar([600, 635] * 3, 0, <span class="s5">SinOsc</span>.kr(2 * 3).max(0) * 0.2) });</p>
126 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>, { <span class="s5">SinOsc</span>.ar([600, 635] * 2, 0, <span class="s5">SinOsc</span>.kr(2 * 3).max(0) * 0.2) });</p>
127 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>, <span class="s5">Pbind</span>(<span class="s7">\dur</span>, 0.17, <span class="s7">\freq</span>, <span class="s5">Pfunc</span>({ rrand(300, 700) })) );</p>
128 <p class="p2"><span class="Apple-tab-span"> </span></p>
129 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\lfo</span>, { <span class="s5">LFNoise1</span>.kr(3, 400, 800) });</p>
130 <p class="p15"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s5">Ndef</span><span class="s3">(</span>\sound<span class="s3">).map(</span>\freq<span class="s3">, </span><span class="s5">Ndef</span><span class="s3">(</span>\lfo<span class="s3">));</span></p>
131 <p class="p6"><span class="s7"><span class="Apple-tab-span"> </span></span><span class="s5">Ndef</span>(<span class="s7">\sound</span>, { <span class="s5">arg</span> freq; <span class="s5">SinOsc</span>.ar([600, 635] + freq, 0, <span class="s5">SinOsc</span>.kr(2 * 3).max(0) * 0.2) });</p>
132 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\lfo</span>, { <span class="s5">LFNoise1</span>.kr(300, 400, 800) });</p>
133 <p class="p2"><span class="Apple-tab-span"> </span></p>
134 <p class="p2"><br></p>
135 <p class="p2"><span class="Apple-tab-span"> </span></p>
136 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s5">Ndef</span><span class="s3">.clear; </span>//clear all</p>
137 <p class="p14"><span class="Apple-tab-span"> </span></p>
138 <p class="p14"><br></p>
139 <p class="p5"><b>Simple audio routing with the &lt;&lt;&gt; operator.</b></p>
140 <p class="p14"><br></p>
141 <p class="p14"><span class="Apple-tab-span"> </span></p>
142 <p class="p7"><span class="Apple-tab-span"> </span><span class="s3">(</span></p>
143 <p class="p15"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s5">Ndef</span><span class="s3">(</span>\sound<span class="s3">, {</span></p>
144 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s5">RHPF</span>.ar(</p>
145 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\in1</span>.ar([0, 0]) * <span class="s7">\in2</span>.ar([0, 0]),</p>
146 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\freq</span>.kr(6000, 2),</p>
147 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\rq</span>.kr(0.2)</p>
148 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>) * 10</p>
149 <p class="p6"><span class="Apple-tab-span"> </span>}).play;</p>
150 <p class="p6"><span class="Apple-tab-span"> </span>);</p>
151 <p class="p2"><span class="Apple-tab-span"> </span></p>
152 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\a</span>, { <span class="s5">SinOsc</span>.ar(<span class="s5">MouseX</span>.kr(300, 1000, 1) * [1, 1.2], <span class="s7">\phase</span>.ar([0, 0]) * 0.2) });</p>
153 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\b</span>, { <span class="s5">LFDNoise3</span>.ar(<span class="s5">MouseY</span>.kr(3, 1000, 1) * [1, 1.2]) });</p>
154 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\c</span>, { <span class="s5">LFTri</span>.ar(<span class="s5">MouseY</span>.kr(3, 10, 1) * [1, 1.2]).max(0) });</p>
155 <p class="p2"><span class="Apple-tab-span"> </span></p>
156 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>) &lt;&lt;&gt;.in1 <span class="s5">Ndef</span>(<span class="s7">\a</span>);</p>
157 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>) &lt;&lt;&gt;.in2 <span class="s5">Ndef</span>(<span class="s7">\b</span>);</p>
158 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>) &lt;&lt;&gt;.in2 <span class="s5">Ndef</span>(<span class="s7">\c</span>);</p>
159 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\a</span>) &lt;&lt;&gt;.phase <span class="s5">Ndef</span>(<span class="s7">\sound</span>);</p>
160 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\a</span>) &lt;&lt;&gt;.phase <span class="s5">nil</span>; <span class="s9">// unmap</span></p>
161 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span></span><span class="s5">Ndef</span><span class="s3">.clear(3);<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// clear all Ndefs</p>
162 <p class="p14"><br></p>
163 <p class="p14"><br></p>
164 <p class="p14"><br></p>
165 <p class="p1"><b>Recursion:</b></p>
166 <p class="p4"><br></p>
167 <p class="p1">Ndefs can be used recursively.</p>
168 <p class="p1">a structure like the following works:</p>
169 <p class="p4"><br></p>
170 <p class="p16"><br></p>
171 <p class="p6"><span class="s5"><span class="Apple-tab-span"> </span>Ndef</span>(<span class="s7">\sound</span>, { <span class="s5">SinOsc</span>.ar([600, 635], <span class="s5">Ndef</span>.ar(<span class="s7">\sound</span>) * 10, <span class="s5">LFNoise1</span>.kr(2).max(0) * 0.2) });</p>
172 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>).play;</p>
173 <p class="p4"><br></p>
174 <p class="p1">This is because there is a feedback delay (the server's <b>block size</b>), usually 64 samples, so that calculation can reiterate over its own outputs. For single sample feedback, see:</p>
175 <p class="p4"><br></p>
176 <p class="p17"><span class="s5"><span class="Apple-tab-span"> </span>Document</span><span class="s3">.open(</span>"Examples/demonstrations/single_sample_feedback.scd"<span class="s3">)</span></p>
177 <p class="p14"><br></p>
178 <p class="p14"><br></p>
179 <p class="p1"><b>Using different servers:</b></p>
180 <p class="p4"><br></p>
181 <p class="p7"><span class="s10"><b><span class="Apple-tab-span"> </span></b></span>// create a new server</p>
182 <p class="p6"><span class="Apple-tab-span"> </span>a = <span class="s5">Server</span>(<span class="s7">\foo</span>, <span class="s5">NetAddr</span>(<span class="s11">"127.0.0.1"</span>, 57123)).boot.makeWindow;</p>
183 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>, { <span class="s5">SinOsc</span>.ar([600, 635]) * <span class="s5">SinOsc</span>.kr(2).max(0) * 0.2 }).play; <span class="s9">// play on default</span></p>
184 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span> -&gt; <span class="s7">\foo</span>, { <span class="s5">SinOsc</span>.ar([700, 745]) * <span class="s5">SinOsc</span>.kr(2).max(0) * 0.2 }).play;<span class="s9">// play on foo</span></p>
185 <p class="p2"><span class="Apple-tab-span"> </span></p>
186 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span></span>// clear definitions</p>
187 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span> -&gt; <span class="s7">\foo</span>).clear(3);</p>
188 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>).clear(3);<span class="Apple-tab-span"> </span></p>
189 <p class="p2"><span class="Apple-tab-span"> </span></p>
190 <p class="p2"><span class="Apple-tab-span"> </span></p>
191 <p class="p1"><b>GUI</b></p>
192 <p class="p18"><span class="Apple-tab-span"> </span></p>
193 <p class="p7"><span class="s7"><span class="Apple-tab-span"> </span></span>// create a window for a given Ndef</p>
194 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>).edit</p>
195 <p class="p6"><span class="Apple-tab-span"> </span>(</p>
196 <p class="p19"><span class="s3"><span class="Apple-tab-span"> </span></span>Ndef<span class="s3">(</span><span class="s7">\sound</span><span class="s3">, { </span>|freq = 440, rate = 2|<span class="s3"><span class="Apple-converted-space"> </span></span></p>
197 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s5">SinOsc</span>.ar(freq * [1, 1.625]) * <span class="s5">SinOsc</span>.kr(rate).max(0) * 0.2<span class="Apple-converted-space"> </span></p>
198 <p class="p6"><span class="Apple-tab-span"> </span>}).play;</p>
199 <p class="p6"><span class="Apple-tab-span"> </span>);</p>
200 <p class="p2"><span class="Apple-tab-span"> </span></p>
201 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span></span>// set lags for controls:</p>
202 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\sound</span>).lag(<span class="s7">\freq</span>, 0.2, <span class="s7">\rate</span>, 0.5);</p>
203 <p class="p2"><span class="Apple-tab-span"> </span></p>
204 <p class="p7"><span class="s3"><span class="Apple-tab-span"> </span></span>// create a mixer for all Ndefs:</p>
205 <p class="p19"><span class="s3"><span class="Apple-tab-span"> </span></span>NdefMixer<span class="s3">(s);</span></p>
206 <p class="p18"><span class="Apple-tab-span"> </span></p>
207 <p class="p18"><span class="Apple-tab-span"> </span></p>
208 <p class="p1"><b>Using Associations</b></p>
209 <p class="p1">For a complete list, see <a href="NodeProxy.html"><span class="s5">NodeProxy</span></a>, and<span class="s12"> <a href="NodeProxy_roles.html"><span class="s13">NodeProxy_roles</span></a></span></p>
210 <p class="p18"><span class="Apple-tab-span"> </span></p>
211 <p class="p7"><span class="s7"><span class="Apple-tab-span"> </span></span>// setsrc</p>
212 <p class="p6"><span class="Apple-tab-span"> </span>(</p>
213 <p class="p6"><span class="Apple-tab-span"> </span><span class="s5">Ndef</span>(<span class="s7">\x</span>,<span class="Apple-converted-space"> </span></p>
214 <p class="p15"><span class="s3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>\setsrc<span class="s3"> -&gt; </span><span class="s5">Pbind</span><span class="s3">(</span>\source<span class="s3">,<span class="Apple-converted-space"> </span></span></p>
215 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s5">Pseq</span>([</p>
216 <p class="p6"><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 class="s5">LFTri</span>.ar(280 * <span class="s5">Line</span>.kr(1.1, 0.4, rrand(2, 3)) + [0,1]) * 0.1 },</p>
217 <p class="p6"><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 class="s5">Pulse</span>.ar(40 + [0,1]) * 0.1 },</p>
218 <p class="p6"><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 class="s5">LFTri</span>.ar(<span class="s5">LFTri</span>.kr(1).round(1.0.rand) + 1 * 180 + [0,1], 0.04) * 0.3 },</p>
219 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>], <span class="s5">inf</span>),<span class="Apple-converted-space"> </span></p>
220 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s7">\dur</span>, <span class="s5">Prand</span>([3, 2, 4], <span class="s5">inf</span>)</p>
221 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
222 <p class="p6"><span class="Apple-tab-span"> </span>).play;</p>
223 <p class="p6"><span class="Apple-tab-span"> </span>)</p>
224 <p class="p2"><span class="Apple-tab-span"> </span></p>
225 <p class="p2"><span class="Apple-tab-span"> </span></p>
226 <p class="p2"><span class="Apple-tab-span"> </span></p>
227 <p class="p2"><span class="Apple-tab-span"> </span></p>
228 <p class="p2"><span class="Apple-tab-span"> </span></p>
229 <p class="p2"><span class="Apple-tab-span"> </span></p>
230 <p class="p2"><span class="Apple-tab-span"> </span></p>
231 </body>
232 </html>