1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"949.43">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #0030a7; min-height: 12.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0021e7}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 14.0px; text-indent: -14.0px; font: 12.0px Helvetica
}
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
; min-height: 12.0px}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #9d1c12}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
20 span
.s1
{font: 18.0px Helvetica
}
21 span
.s2
{color: #000000}
22 span
.s3
{color: #0026b4}
23 span
.s4
{color: #0021e7}
24 span
.s5
{color: #0000ff}
25 span
.s6
{color: #0024f8}
26 span
.s7
{text-decoration: underline
; color: #002fe0}
27 span
.s8
{color: #9d1c12}
28 span
.s9
{color: #606060}
29 span
.Apple-tab-span
{white-space:pre
}
33 <p class=
"p1"><span class=
"s1"><b>LocalOut
</b></span><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>write to buses local to a synth
</b></p>
34 <p class=
"p2"><br></p>
35 <p class=
"p3"><span class=
"s2"><b>Inherits from:
</b><a href=
"../../Core/Object.html"><b>Object
</b></a></span><span class=
"s3"><b> :
</b><a href=
"../../Core/Kernel/AbstractFunction.html"><span class=
"s4"><b>AbstractFunction
</b></span></a><b> :
</b><a href=
"../UGen.html"><span class=
"s4"><b>UGen
</b></span></a><b> :
</b><a href=
"AbstractOut.html"><span class=
"s5"><b>AbstractOut
</b></span></a></span></p>
36 <p class=
"p2"><br></p>
37 <p class=
"p4"><b>*ar(channelsArray)
</b>- write a signal to an audio bus local to the enclosing synth.
</p>
38 <p class=
"p4"><b>*kr(channelsArray)
</b>-
<b> </b>write a signal to a control bus local to the enclosing synth.
</p>
39 <p class=
"p5"><br></p>
40 <p class=
"p6"><b>channelsArray
</b>- an Array of channels or single output to write out. You cannot change the size of this once a SynthDef has been built.
</p>
41 <p class=
"p2"><br></p>
42 <p class=
"p4">LocalOut writes to buses that are local to the enclosing synth. The buses should have been defined by a
<a href=
"LocalIn.html"><span class=
"s6">LocalIn
</span></a> ugen. The
<b>channelsArray
</b> must be the same number of channels as were declared in the LocalIn. These are like the global buses, but are more convenient if you want to implement a self contained effect that uses a feedback processing loop.
</p>
43 <p class=
"p5"><br></p>
44 <p class=
"p4">See also:
<a href=
"LocalIn.html"><span class=
"s7">LocalIn
</span></a>,
<a href=
"LocalBuf.html"><span class=
"s6">LocalBuf
</span></a></p>
45 <p class=
"p5"><br></p>
46 <p class=
"p4"><b>N.B.
</b> Audio written to a LocalOut will not be read by a corresponding
<b>LocalIn
</b> until the next cycle, i.e. one block size of samples later. Because of this it is important to take this additional delay into account when using LocalIn to create feedback delays with delay times shorter than the threshold of pitch (i.e.
< 0.05 seconds or
> 20Hz), or where sample accurate alignment is required. See the resonator example below.
</p>
47 <p class=
"p5"><br></p>
50 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> source, local;
</p>
51 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
52 <p class=
"p7"><span class=
"Apple-tab-span"> </span>source =
<span class=
"s3">Decay
</span>.ar(
<span class=
"s3">Impulse
</span>.ar(
0.3),
0.1) *
<span class=
"s3">WhiteNoise
</span>.ar(
0.2);
</p>
53 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
54 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">LocalIn
</span>.ar(
2) + [source,
0];
<span class=
"s8">// read feedback, add to source
</span></p>
55 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
56 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">DelayN
</span>.ar(local,
0.2,
0.2);
<span class=
"s8">// delay sound
</span></p>
57 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
58 <p class=
"p9"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>// reverse channels to give ping pong effect, apply decay factor
</p>
59 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">LocalOut
</span>.ar(local.reverse *
0.8);
<span class=
"Apple-converted-space"> </span></p>
60 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
61 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(
0, local);
</p>
62 <p class=
"p7">}.play;
</p>
64 <p class=
"p8"><br></p>
65 <p class=
"p8"><br></p>
66 <p class=
"p8"><br></p>
68 <p class=
"p7">z =
<span class=
"s3">SynthDef
</span>(
<span class=
"s9">"tank"</span>, {
</p>
69 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> local, in;
</p>
70 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
71 <p class=
"p7"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">Mix
</span>.fill(
12, {
<span class=
"Apple-converted-space"> </span></p>
72 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Pan2
</span>.ar(
</p>
73 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Decay2
</span>.ar(
<span class=
"s3">Dust
</span>.ar(
0.05),
0.1,
0.5,
0.1)
<span class=
"Apple-converted-space"> </span></p>
74 <p class=
"p7"><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=
"s3">FSinOsc
</span>.ar(
<span class=
"s3">IRand
</span>(
36,
84).midicps).cubed.max(
0),
<span class=
"Apple-converted-space"> </span></p>
75 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">Rand
</span>(-
1,
1))
</p>
76 <p class=
"p7"><span class=
"Apple-tab-span"> </span>});
</p>
77 <p class=
"p7"><span class=
"Apple-tab-span"> </span>in = in +
<span class=
"s3">Pan2
</span>.ar(
<span class=
"s3">Decay2
</span>.ar(
<span class=
"s3">Dust
</span>.ar(
0.03),
0.04,
0.3) *
<span class=
"s3">BrownNoise
</span>.ar,
0);
</p>
78 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
79 <p class=
"p7"><span class=
"Apple-tab-span"> </span>4.do { in =
<span class=
"s3">AllpassN
</span>.ar(in,
0.03, {
<span class=
"s3">Rand
</span>(
0.005,
0.02)}.dup,
1); };
</p>
80 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
81 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">LocalIn
</span>.ar(
2) *
0.98;
</p>
82 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">OnePole
</span>.ar(local,
0.5);
</p>
83 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
84 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">Rotate2
</span>.ar(local[
0], local[
1],
0.23);
</p>
85 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">AllpassN
</span>.ar(local,
0.05, {
<span class=
"s3">Rand
</span>(
0.01,
0.05)}.dup,
2);
</p>
86 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-converted-space"> <span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span></p>
87 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">DelayN
</span>.ar(local,
0.3, [
0.19,
0.26]);
</p>
88 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">AllpassN
</span>.ar(local,
0.05, {
<span class=
"s3">Rand
</span>(
0.03,
0.15)}.dup,
2);
</p>
89 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
90 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">LeakDC
</span>.ar(local);
<span class=
"Apple-tab-span"> </span></p>
91 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local = local + in;
</p>
92 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
93 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">LocalOut
</span>.ar(local);
</p>
94 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
95 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(
0, local);
</p>
96 <p class=
"p7">}).play;
</p>
98 <p class=
"p8"><br></p>
99 <p class=
"p8"><br></p>
100 <p class=
"p8"><br></p>
102 <p class=
"p7">z =
<span class=
"s3">SynthDef
</span>(
<span class=
"s9">"tape"</span>, {
</p>
103 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> local, in, amp;
</p>
104 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
105 <p class=
"p7"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">SoundIn
</span>.ar([
0,
1]);
</p>
106 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
107 <p class=
"p7"><span class=
"Apple-tab-span"> </span>amp =
<span class=
"s3">Amplitude
</span>.kr(
<span class=
"s3">Mix
</span>.ar(in));
</p>
108 <p class=
"p7"><span class=
"Apple-tab-span"> </span>in = in * (amp
> 0.02);
<span class=
"s8">// noise gate
</span></p>
109 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
110 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">LocalIn
</span>.ar(
2);
</p>
111 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">OnePole
</span>.ar(local,
0.4);
</p>
112 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">OnePole
</span>.ar(local, -
0.08);
</p>
113 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
114 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">Rotate2
</span>.ar(local[
0], local[
1],
0.2);
</p>
115 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-converted-space"> <span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span></p>
116 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">DelayN
</span>.ar(local,
0.25,
0.25);
</p>
117 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
118 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s3">LeakDC
</span>.ar(local);
<span class=
"Apple-tab-span"> </span></p>
119 <p class=
"p7"><span class=
"Apple-tab-span"> </span>local = ((local + in) *
1.25).softclip;
</p>
120 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
121 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">LocalOut
</span>.ar(local);
</p>
122 <p class=
"p8"><span class=
"Apple-tab-span"> </span></p>
123 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(
0, local *
0.1);
</p>
124 <p class=
"p7">}).play;
</p>
126 <p class=
"p8"><br></p>
127 <p class=
"p9">// Resonator, must subtract blockSize for correct tuning
</p>
129 <p class=
"p7"><span class=
"s3">var
</span> play, imp, initial;
</p>
130 <p class=
"p10"><span class=
"s3">SynthDef
</span><span class=
"s2">(
</span>"testRes"<span class=
"s2">, {
</span></p>
131 <p class=
"p8"><br></p>
132 <p class=
"p7">play =
<span class=
"s3">LocalIn
</span>.ar(
1);
<span class=
"Apple-converted-space"> </span></p>
133 <p class=
"p7">imp =
<span class=
"s3">Impulse
</span>.ar(
1);
</p>
134 <p class=
"p8"><br></p>
135 <p class=
"p7"><span class=
"s3">LocalOut
</span>.ar(
<span class=
"s3">DelayC
</span>.ar(imp + (play *
0.995),
1,
440.reciprocal -
<span class=
"s3">ControlRate
</span>.ir.reciprocal));
<span class=
"s8">// for feedback
</span></p>
136 <p class=
"p8"><br></p>
137 <p class=
"p7"><span class=
"s3">OffsetOut
</span>.ar(
0, play);
</p>
138 <p class=
"p8"><br></p>
139 <p class=
"p7">}).play(s);
</p>
140 <p class=
"p8"><br></p>
141 <p class=
"p7">{
<span class=
"s3">SinOsc
</span>.ar(
440,
0,
0.2) }.play(s,
1);
<span class=
"s8">// compare pitch
</span></p>