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: 12.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #0000bf; min-height: 12.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0000bf}
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 14.0px; text-indent: -14.0px; font: 12.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
; min-height: 12.0px}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
19 span
.s1
{font: 18.0px Helvetica
}
20 span
.s2
{font: 14.0px Helvetica
}
21 span
.s3
{color: #000000}
22 span
.s4
{color: #0000bf}
23 span
.s5
{color: #0000bf}
24 span
.s6
{color: #0000bf}
25 span
.s7
{color: #0000bf}
26 span
.s8
{color: #bf0000}
27 span
.s9
{color: #606060}
28 span
.Apple-tab-span
{white-space:pre
}
32 <p class=
"p1"><span class=
"s1"><b>LocalIn
</b></span><span class=
"s2"><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></b></span><b>define and read from buses local to a synth
</b></p>
33 <p class=
"p2"><br></p>
34 <p class=
"p3"><span class=
"s3"><b>Inherits from:
</b><a href=
"../../Core/Object.html"><b>Object
</b></a></span><span class=
"s4"><b> :
</b><a href=
"../../Core/Kernel/AbstractFunction.html"><span class=
"s5"><b>AbstractFunction
</b></span></a><b> :
</b><a href=
"../UGen.html"><span class=
"s5"><b>UGen
</b></span></a></span><b> :
</b><a href=
"../Multichannel/MultiOutUGen.html"><span class=
"s6"><b>MultiOutUGen
</b></span></a><span class=
"s6"><b> :
</b><a href=
"AbstractIn.html"><b>AbstractIn
</b></a></span></p>
35 <p class=
"p2"><br></p>
36 <p class=
"p1"><b>*ar(numChannels)
</b>- define and read from an audio bus local to the enclosing synth.
</p>
37 <p class=
"p1"><b>*kr(numChannels)
</b>-
<b> </b>define and read from a control bus local to the enclosing synth.
</p>
38 <p class=
"p4"><br></p>
39 <p class=
"p5"><b>numChannels
</b>- the number of channels (i.e. adjacent buses) to read in. The default is
1. You cannot modulate this number by assigning it to an argument in a SynthDef.
</p>
40 <p class=
"p2"><br></p>
41 <p class=
"p1"><b>LocalIn
</b> defines buses that are local to the enclosing synth. 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>
42 <p class=
"p1">There can only be one audio rate and one control rate
<b>LocalIn
</b> per SynthDef.
</p>
43 <p class=
"p1">The audio can be written to the bus using
<a href=
"LocalOut.html"><span class=
"s6"><b>LocalOut
</b></span></a>.
</p>
44 <p class=
"p4"><br></p>
45 <p class=
"p1"><b>N.B.
</b> Audio written to a
<b>LocalOut
</b> will not be read by a corresponding LocalIn 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>
46 <p class=
"p4"><br></p>
49 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s7">var
</span> source, local;
</p>
50 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
51 <p class=
"p6"><span class=
"Apple-tab-span"> </span>source =
<span class=
"s7">Decay
</span>.ar(
<span class=
"s7">Impulse
</span>.ar(
0.3),
0.1) *
<span class=
"s7">WhiteNoise
</span>.ar(
0.2);
</p>
52 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
53 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">LocalIn
</span>.ar(
2) + [source,
0];
<span class=
"s8">// read feedback, add to source
</span></p>
54 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
55 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">DelayN
</span>.ar(local,
0.2,
0.2);
<span class=
"s8">// delay sound
</span></p>
56 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
57 <p class=
"p8"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// reverse channels to give ping pong effect, apply decay factor
</p>
58 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s7">LocalOut
</span>.ar(local.reverse *
0.8);
<span class=
"Apple-converted-space"> </span></p>
59 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
60 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s7">Out
</span>.ar(
0, local);
</p>
61 <p class=
"p6">}.play;
</p>
63 <p class=
"p7"><br></p>
64 <p class=
"p7"><br></p>
65 <p class=
"p7"><br></p>
67 <p class=
"p6">z =
<span class=
"s7">SynthDef
</span>(
<span class=
"s9">"tank"</span>, {
</p>
68 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s7">var
</span> local, in;
</p>
69 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
70 <p class=
"p6"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s7">Mix
</span>.fill(
12, {
<span class=
"Apple-converted-space"> </span></p>
71 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pan2
</span>.ar(
</p>
72 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Decay2
</span>.ar(
<span class=
"s7">Dust
</span>.ar(
0.05),
0.1,
0.5,
0.1)
<span class=
"Apple-converted-space"> </span></p>
73 <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=
"s7">FSinOsc
</span>.ar(
<span class=
"s7">IRand
</span>(
36,
84).midicps).cubed.max(
0),
<span class=
"Apple-converted-space"> </span></p>
74 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Rand
</span>(-
1,
1))
</p>
75 <p class=
"p6"><span class=
"Apple-tab-span"> </span>});
</p>
76 <p class=
"p6"><span class=
"Apple-tab-span"> </span>in = in +
<span class=
"s7">Pan2
</span>.ar(
<span class=
"s7">Decay2
</span>.ar(
<span class=
"s7">Dust
</span>.ar(
0.03),
0.04,
0.3) *
<span class=
"s7">BrownNoise
</span>.ar,
0);
</p>
77 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
78 <p class=
"p6"><span class=
"Apple-tab-span"> </span>4.do { in =
<span class=
"s7">AllpassN
</span>.ar(in,
0.03, {
<span class=
"s7">Rand
</span>(
0.005,
0.02)}.dup,
1); };
</p>
79 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
80 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">LocalIn
</span>.ar(
2) *
0.98;
</p>
81 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">OnePole
</span>.ar(local,
0.5);
</p>
82 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
83 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">Rotate2
</span>.ar(local[
0], local[
1],
0.23);
</p>
84 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">AllpassN
</span>.ar(local,
0.05, {
<span class=
"s7">Rand
</span>(
0.01,
0.05)}.dup,
2);
</p>
85 <p class=
"p7"><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>
86 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">DelayN
</span>.ar(local,
0.3, [
0.19,
0.26]);
</p>
87 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">AllpassN
</span>.ar(local,
0.05, {
<span class=
"s7">Rand
</span>(
0.03,
0.15)}.dup,
2);
</p>
88 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
89 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">LeakDC
</span>.ar(local);
<span class=
"Apple-tab-span"> </span></p>
90 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local = local + in;
</p>
91 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
92 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s7">LocalOut
</span>.ar(local);
</p>
93 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
94 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s7">Out
</span>.ar(
0, local);
</p>
95 <p class=
"p6">}).play;
</p>
97 <p class=
"p7"><br></p>
98 <p class=
"p7"><br></p>
99 <p class=
"p7"><br></p>
101 <p class=
"p6">z =
<span class=
"s7">SynthDef
</span>(
<span class=
"s9">"tape"</span>, {
</p>
102 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s7">var
</span> local, in, amp;
</p>
103 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
104 <p class=
"p6"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s7">SoundIn
</span>.ar([
0,
1]);
</p>
105 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
106 <p class=
"p6"><span class=
"Apple-tab-span"> </span>amp =
<span class=
"s7">Amplitude
</span>.kr(
<span class=
"s7">Mix
</span>.ar(in));
</p>
107 <p class=
"p6"><span class=
"Apple-tab-span"> </span>in = in * (amp
> 0.02);
<span class=
"s8">// noise gate
</span></p>
108 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
109 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">LocalIn
</span>.ar(
2);
</p>
110 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">OnePole
</span>.ar(local,
0.4);
</p>
111 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">OnePole
</span>.ar(local, -
0.08);
</p>
112 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
113 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">Rotate2
</span>.ar(local[
0], local[
1],
0.2);
</p>
114 <p class=
"p7"><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>
115 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">DelayN
</span>.ar(local,
0.25,
0.25);
</p>
116 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
117 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local =
<span class=
"s7">LeakDC
</span>.ar(local);
<span class=
"Apple-tab-span"> </span></p>
118 <p class=
"p6"><span class=
"Apple-tab-span"> </span>local = ((local + in) *
1.25).softclip;
</p>
119 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
120 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s7">LocalOut
</span>.ar(local);
</p>
121 <p class=
"p7"><span class=
"Apple-tab-span"> </span></p>
122 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s7">Out
</span>.ar(
0, local *
0.1);
</p>
123 <p class=
"p6">}).play;
</p>
125 <p class=
"p7"><br></p>
126 <p class=
"p8">// Resonator, must subtract blockSize for correct tuning
</p>
128 <p class=
"p6"><span class=
"s7">var
</span> play, imp, initial;
</p>
129 <p class=
"p9"><span class=
"s7">SynthDef
</span><span class=
"s3">(
</span>"testRes"<span class=
"s3">, {
</span></p>
130 <p class=
"p7"><br></p>
131 <p class=
"p6">play =
<span class=
"s7">LocalIn
</span>.ar(
1);
<span class=
"Apple-converted-space"> </span></p>
132 <p class=
"p6">imp =
<span class=
"s7">Impulse
</span>.ar(
1);
</p>
133 <p class=
"p7"><br></p>
134 <p class=
"p6"><span class=
"s7">LocalOut
</span>.ar(
<span class=
"s7">DelayC
</span>.ar(imp + (play *
0.995),
1,
440.reciprocal -
<span class=
"s7">ControlRate
</span>.ir.reciprocal));
<span class=
"s8">// for feedback
</span></p>
135 <p class=
"p7"><br></p>
136 <p class=
"p6"><span class=
"s7">OffsetOut
</span>.ar(
0, play);
</p>
137 <p class=
"p7"><br></p>
138 <p class=
"p6">}).play(s);
</p>
139 <p class=
"p7"><br></p>
140 <p class=
"p6">{
<span class=
"s7">SinOsc
</span>.ar(
440,
0,
0.2) }.play(s,
1);
<span class=
"s8">// compare pitch
</span></p>