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=
"1038.25">
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: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #506929; min-height: 12.0px}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
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: #0000bf}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #007300}
18 span
.s1
{font: 18.0px Helvetica
}
19 span
.s2
{font: 9.0px Monaco
}
20 span
.s3
{color: #000000}
21 span
.s4
{color: #0000bf}
22 span
.s5
{color: #007300}
23 span
.s6
{color: #bf0000}
24 span
.Apple-tab-span
{white-space:pre
}
28 <p class=
"p1"><span class=
"s1"><b>LocalBuf
</b></span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>allocate a buffer local to the synth
</b></p>
29 <p class=
"p2"><br></p>
30 <p class=
"p1">superclass: UGen
</p>
31 <p class=
"p2"><br></p>
32 <p class=
"p2"><br></p>
33 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>*new(numFrames, numChannels)
</b></p>
34 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
35 <p class=
"p1"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>return a new buffer – the ugen outputs its buffer number and can thus be used in
</p>
36 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>any other ugen that requires a buffer number input.
</p>
37 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
38 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>numFrames
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>number of frames (default:
1)
</p>
39 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
40 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>numChannels
</b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>number of channels for multiple channel buffers (default:
1)
</p>
41 <p class=
"p2"><br></p>
42 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
43 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>*newFrom(list)
</b></p>
44 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
45 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>return a new buffer from a given list of values. The list may be two-dimensional for numChannels
> 1.
</p>
46 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>It is then reshaped into the buffer's current format by flattening.
</p>
47 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
48 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Since newFrom is called by the
<b>as
</b> message, one may thus convert an array to a LocalBuf:
</p>
49 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
1,
2,
3].as(LocalBuf)
</p>
50 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
51 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>set(list, offset)
</b><span class=
"Apple-tab-span"> </span></p>
52 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>set the buffer slots with a list of values. If list is smaller than numFrames, it will only set
</p>
53 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>part of the buffer. The list may be two-dimensional for numChannels
> 1.
</p>
54 <p class=
"p1"><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>offset
</b> is the starting index (default:
0)
</p>
55 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
56 <p class=
"p1"><span class=
"Apple-tab-span"> </span><b>clear
</b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>set the buffer slot to zero. This is
<b>important
</b> when randomly acessing buffer slots
</p>
57 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(e.g. with a BufRd) or not overwriting them. Clear is not an efficient real time operation
</p>
58 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>for larger buffers, so it should be only used when really needed - but then it is essential:
</p>
59 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a LocalBuf is
"created" in each new synth, and it may reuse old space. So if an older
<span class=
"Apple-converted-space"> </span></p>
60 <p class=
"p1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>synth has already ended, this part of memory may be the same as the new synth's.
</p>
61 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
62 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
63 <p class=
"p1"><span class=
"Apple-tab-span"> </span>see also SetBuf, ClearBuf
<span class=
"s2"><span class=
"Apple-tab-span"> </span></span></p>
64 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
65 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
66 <p class=
"p4"><span class=
"Apple-tab-span"> </span></p>
67 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// example: FFT
</p>
68 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
69 <p class=
"p6"><span class=
"Apple-tab-span"> </span>(
</p>
70 <p class=
"p6"><span class=
"Apple-tab-span"> </span>{
</p>
71 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> in, chain;
</p>
72 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>in =
<span class=
"s4">WhiteNoise
</span>.ar(
0.1.dup);
</p>
73 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s4">FFT
</span>({
<span class=
"s4">LocalBuf
</span>(
2048,
1)}.dup, in);
</p>
74 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s4">PV_BrickWall
</span>(chain,
<span class=
"s4">SinOsc
</span>.kr([
0.1,
0.11]));
<span class=
"Apple-converted-space"> </span></p>
75 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s4">IFFT
</span><span class=
"s3">(chain)
</span>// inverse FFT
</p>
76 <p class=
"p6"><span class=
"Apple-tab-span"> </span>}.play;
</p>
77 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
78 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
79 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// spawn some FFT based synths:
</p>
80 <p class=
"p6"><span class=
"Apple-tab-span"> </span>(
</p>
81 <p class=
"p7"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>SynthDef
<span class=
"s3">(
</span><span class=
"s5">\fftgrain
</span><span class=
"s3">, {
</span>|out, sustain =
1, rate =
0.2|
</p>
82 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> in, chain;
</p>
83 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>in =
<span class=
"s4">WhiteNoise
</span>.ar(
0.1).dup;
</p>
84 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s4">FFT
</span>({
<span class=
"s4">LocalBuf
</span>(
128,
1)}.dup, in);
</p>
85 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s4">PV_BrickWall
</span>(chain,
<span class=
"Apple-converted-space"> </span></p>
86 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">SinOsc
</span>.kr(rate *
<span class=
"s4">XLine
</span>.kr(
1,
15 * [
1,
1.6], sustain),
<span class=
"s4">Rand
</span>(
0, pi))
</p>
87 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
<span class=
"Apple-converted-space"> </span></p>
88 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">Out
</span>.ar(out,
<span class=
"s4">IFFT
</span>(chain) *
<span class=
"s4">XLine
</span>.kr(
1,
0.001, sustain, doneAction:
2))
<span class=
"s6">// inverse FFT
</span></p>
89 <p class=
"p6"><span class=
"Apple-tab-span"> </span>}).add;
</p>
90 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
91 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
92 <p class=
"p6"><span class=
"Apple-tab-span"> </span>(
</p>
93 <p class=
"p7"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>Pbind
<span class=
"s3">(
</span></p>
94 <p class=
"p8"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>\instrument
<span class=
"s3">,
</span>\fftgrain
<span class=
"s3">,
<span class=
"Apple-converted-space"> </span></span></p>
95 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s5">\rate
</span>,
<span class=
"s4">Pwhite
</span>().linexp(
0,
1,
0.01,
300),
<span class=
"Apple-converted-space"> </span></p>
96 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s5">\legato
</span>,
<span class=
"s4">Pwhite
</span>(
1,
3.0,
<span class=
"s4">inf
</span>),
</p>
97 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s5">\dur
</span>,
<span class=
"s4">Prand
</span>([
0.2,
1,
1.2],
<span class=
"s4">inf
</span>)
</p>
98 <p class=
"p6"><span class=
"Apple-tab-span"> </span>).play
</p>
99 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
100 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
101 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// IndexL
</p>
102 <p class=
"p6"><span class=
"Apple-tab-span"> </span>(
</p>
103 <p class=
"p6"><span class=
"Apple-tab-span"> </span>{
</p>
104 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> buf =
<span class=
"s4">LocalBuf
</span>.newFrom((
0.
.5).scramble);
</p>
105 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> freq =
<span class=
"s4">IndexL
</span>.kr(buf,
<span class=
"s4">MouseX
</span>.kr(
0,
<span class=
"s4">BufFrames
</span>.kr(buf))).poll *
100 +
40;
</p>
106 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">Saw
</span>.ar(freq * [
1,
1.1]) *
0.1</p>
107 <p class=
"p6"><span class=
"Apple-tab-span"> </span>}.play;
</p>
108 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
109 <p class=
"p3"><br></p>
110 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// DetectIndex
</p>
111 <p class=
"p6"><span class=
"Apple-tab-span"> </span>(
</p>
112 <p class=
"p6"><span class=
"Apple-tab-span"> </span>{
</p>
113 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> buf1 =
<span class=
"s4">LocalBuf
</span>.newFrom((
0.
.5).scramble);
</p>
114 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> buf2 =
<span class=
"s4">LocalBuf
</span>.newFrom((
0.
.5).scramble -
1);
</p>
115 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> buf3 =
<span class=
"s4">LocalBuf
</span>.newFrom((
0.
.5).scramble +
1);
</p>
116 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> index =
<span class=
"s4">DetectIndex
</span>.kr([buf1, buf2],
<span class=
"s4">SinOsc
</span>.kr([
0.85,
0.8],
0,
6).trunc).poll;
</p>
117 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> freq =
<span class=
"s4">IndexL
</span>.kr([buf2, buf3], index).poll *
40 +
40;
</p>
118 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">Saw
</span>.ar(freq) *
0.1</p>
119 <p class=
"p6"><span class=
"Apple-tab-span"> </span>}.play;
</p>
120 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
121 <p class=
"p3"><br></p>
122 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
123 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// DegreeToKey
</p>
124 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// modal space
</p>
125 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// mouse x controls discrete pitch in dorian mode
</p>
126 <p class=
"p6"><span class=
"Apple-tab-span"> </span>(
</p>
127 <p class=
"p6"><span class=
"Apple-tab-span"> </span>play({
</p>
128 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> mix;
</p>
129 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
130 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>mix =
<span class=
"Apple-converted-space"> </span></p>
131 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
132 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// lead tone
</p>
133 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">SinOsc
</span>.ar(
</p>
134 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
135 <p class=
"p7"><span class=
"s3"><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>DegreeToKey
<span class=
"s3">.kr(
</span></p>
136 <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=
"Apple-tab-span"> </span>[
0,
2,
3.2,
5,
7,
9,
10].as(
<span class=
"s4">LocalBuf
</span>),
</p>
137 <p class=
"p5"><span class=
"s3"><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=
"Apple-tab-span"> </span></span><span class=
"s4">MouseX
</span><span class=
"s3">.kr(
0,
15),
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// mouse indexes into scale
</p>
138 <p class=
"p5"><span class=
"s3"><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=
"Apple-tab-span"> </span>12,
<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=
"Apple-tab-span"> </span></span>//
12 notes per octave
</p>
139 <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=
"Apple-tab-span"> </span>1,
<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=
"Apple-tab-span"> </span><span class=
"s6">// mul =
1</span></p>
140 <p class=
"p5"><span class=
"s3"><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=
"Apple-tab-span"> </span>72<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=
"Apple-tab-span"> </span></span>// offset by
72 notes
</p>
141 <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>).poll
</p>
142 <p class=
"p5"><span class=
"s3"><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><span class=
"s4">LFNoise1
</span><span class=
"s3">.kr([
3,
3],
0.04)
<span class=
"Apple-tab-span"> </span></span>// add some low freq stereo detuning
</p>
143 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>).midicps,
<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=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// convert midi notes to hertz
</p>
144 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0,
</p>
145 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0.1)
</p>
146 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
147 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// drone
5ths
</p>
148 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>+
<span class=
"s4">RLPF
</span>.ar(
<span class=
"s4">LFPulse
</span>.ar([
48,
55].midicps,
0.15),
</p>
149 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">SinOsc
</span>.kr(
0.1,
0,
10,
72).midicps,
0.1,
0.1);
</p>
150 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
151 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// add some
70's euro-space-rock echo
</p>
152 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">CombN
</span>.ar(mix,
0.31,
0.31,
2,
1, mix)
</p>
153 <p class=
"p6"><span class=
"Apple-tab-span"> </span>})
</p>
154 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
155 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
156 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// Osc
</p>
157 <p class=
"p6"><span class=
"Apple-tab-span"> </span>(
</p>
158 <p class=
"p6"><span class=
"Apple-tab-span"> </span>{
</p>
159 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> buf;
</p>
160 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> list =
<span class=
"s4">Wavetable
</span>.sineFill(
512,
1.0 / [
1,
10,
3,
10,
5,
6,
10]);
</p>
161 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// list.plot;
</p>
162 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>buf =
<span class=
"s4">LocalBuf
</span>.newFrom(list);
</p>
163 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">Osc
</span>.ar(buf,
<span class=
"Apple-converted-space"> </span></p>
164 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">XLine
</span>.kr(
2000,
200 + {
30.0.rand}.dup,
10) +
<span class=
"s4">SinOsc
</span>.ar(
<span class=
"s4">Line
</span>.kr(
2,
300,
10),
<span class=
"Apple-converted-space"> </span></p>
165 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0,
100)
</p>
166 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>) *
0.1;
</p>
167 <p class=
"p6"><span class=
"Apple-tab-span"> </span>}.play;
</p>
168 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
169 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
170 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// see how not clearing the buffer accesses old data:
</p>
171 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// slowly overwrite data with noise
</p>
172 <p class=
"p6"><span class=
"Apple-tab-span"> </span>(
</p>
173 <p class=
"p6"><span class=
"Apple-tab-span"> </span>{
</p>
174 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> buf =
<span class=
"s4">LocalBuf
</span>(
2048,
2);
</p>
175 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">BufWr
</span>.ar(
<span class=
"s4">WhiteNoise
</span>.ar(
1.dup), buf,
<span class=
"s4">LFNoise0
</span>.ar(
530).range(
0,
<span class=
"s4">BufFrames
</span>.kr(buf)));
<span class=
"Apple-converted-space"> </span></p>
176 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">PlayBuf
</span>.ar(
2, buf,
<span class=
"s4">MouseX
</span>.kr(
1,
2), loop:
1) *
0.1</p>
177 <p class=
"p6"><span class=
"Apple-tab-span"> </span>}.play
</p>
178 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
179 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
180 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// avoid this (unless you like the glitch) by clearing buffer first:
</p>
181 <p class=
"p6"><span class=
"Apple-tab-span"> </span>(
</p>
182 <p class=
"p6"><span class=
"Apple-tab-span"> </span>{
</p>
183 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> buf =
<span class=
"s4">LocalBuf
</span>(
2048,
2).clear;
</p>
184 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">BufWr
</span>.ar(
<span class=
"s4">WhiteNoise
</span>.ar(
1.dup), buf,
<span class=
"s4">LFNoise0
</span>.ar(
530).range(
0,
<span class=
"s4">BufFrames
</span>.kr(buf)));
<span class=
"Apple-converted-space"> </span></p>
185 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">PlayBuf
</span>.ar(
2, buf,
<span class=
"s4">MouseX
</span>.kr(
1,
2), loop:
1) *
0.1</p>
186 <p class=
"p6"><span class=
"Apple-tab-span"> </span>}.play
</p>
187 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
188 <p class=
"p3"><br></p>
189 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
190 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// BufCombC stereo (needs no clearing, because delay is filled by ugen)
</p>
191 <p class=
"p6"><span class=
"Apple-tab-span"> </span>(
</p>
192 <p class=
"p6"><span class=
"Apple-tab-span"> </span>{
</p>
193 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> z =
<span class=
"s4">Decay
</span>.ar(
<span class=
"s4">Dust
</span>.ar(
1.dup,
0.1),
0.3,
<span class=
"s4">WhiteNoise
</span>.ar);
</p>
194 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s4">BufCombC
</span>.ar(
<span class=
"s4">LocalBuf
</span>(
<span class=
"s4">SampleRate
</span>.ir,
2), z,
<span class=
"s4">XLine
</span>.kr(
0.0001,
0.01,
20),
0.2);
<span class=
"Apple-converted-space"> </span></p>
195 <p class=
"p6"><span class=
"Apple-tab-span"> </span>}.play
</p>
196 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>
197 <p class=
"p3"><span class=
"Apple-tab-span"> </span></p>
198 <p class=
"p5"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// multichannel test
</p>
199 <p class=
"p6"><span class=
"Apple-tab-span"> </span>(
</p>
200 <p class=
"p6"><span class=
"Apple-tab-span"> </span>{
</p>
201 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> in, chain, n =
4;
</p>
202 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>in =
<span class=
"s4">WhiteNoise
</span>.ar(
0.1.dup(n));
</p>
203 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s4">FFT
</span>({
<span class=
"s4">LocalBuf
</span>(
2048,
1)}.dup(n), in);
</p>
204 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s4">PV_BrickWall
</span>(chain,
<span class=
"s4">LFNoise2
</span>.kr(
2.dup(n)));
<span class=
"Apple-converted-space"> </span></p>
205 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s4">Splay
</span>.ar(
<span class=
"s4">IFFT
</span>(chain))
<span class=
"s6">// inverse FFT
</span></p>
206 <p class=
"p6"><span class=
"Apple-tab-span"> </span>}.play;
</p>
207 <p class=
"p6"><span class=
"Apple-tab-span"> </span>)
</p>