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=
"824.42">
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
; min-height: 14.0px}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
16 span
.s1
{font: 18.0px Helvetica
}
17 span
.s2
{font: 9.0px Monaco
}
18 span
.s3
{color: #0000bf}
19 span
.s4
{color: #000000}
20 span
.Apple-tab-span
{white-space:pre
}
24 <p class=
"p1"><span class=
"s1"><b>Sweep
</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>triggered linear ramp
</b></p>
25 <p class=
"p2"><br></p>
26 <p class=
"p1">superclass: UGen
</p>
27 <p class=
"p3"><b></b><br></p>
28 <p class=
"p1">starts a linear raise by rate/sec from zero when trig input crosses from non-positive to positive
<span class=
"Apple-converted-space"> </span></p>
29 <p class=
"p3"><b></b><br></p>
30 <p class=
"p1"><b><span class=
"Apple-tab-span"> </span>*ar(trig, rate)
</b></p>
31 <p class=
"p1"><b><span class=
"Apple-tab-span"> </span>*kr(trig, rate)
</b></p>
32 <p class=
"p3"><b></b><br></p>
33 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
34 <p class=
"p2"><br></p>
35 <p class=
"p2"><br></p>
36 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
37 <p class=
"p4">// using sweep to modulate sine frequency
</p>
39 <p class=
"p5">{
<span class=
"s3">var
</span> trig;
</p>
40 <p class=
"p5"><span class=
"Apple-tab-span"> </span>trig =
<span class=
"s3">Impulse
</span>.kr(
<span class=
"s3">MouseX
</span>.kr(
0.5,
20,
1));
</p>
41 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">SinOsc
</span>.ar(
<span class=
"s3">Sweep
</span>.kr(trig,
700) +
500,
0,
0.2)
</p>
42 <p class=
"p5">}.play;
</p>
44 <p class=
"p2"><br></p>
45 <p class=
"p2"><br></p>
46 <p class=
"p2"><br></p>
47 <p class=
"p2"><br></p>
48 <p class=
"p2"><br></p>
49 <p class=
"p4">// using sweep to index into a buffer
</p>
50 <p class=
"p2"><br></p>
51 <p class=
"p6"><span class=
"s4">s.sendMsg(
</span>"/b_allocRead"<span class=
"s4">,
0,
</span>"sounds/a11wlk01.wav"<span class=
"s4">);
</span></p>
52 <p class=
"p2"><br></p>
54 <p class=
"p5">{
<span class=
"s3">var
</span> trig;
</p>
55 <p class=
"p5"><span class=
"Apple-tab-span"> </span>trig =
<span class=
"s3">Impulse
</span>.kr(
<span class=
"s3">MouseX
</span>.kr(
0.5,
10,
1));
</p>
56 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">BufRd
</span>.ar(
1,
0,
<span class=
"s3">Sweep
</span>.ar(trig,
<span class=
"s3">BufSampleRate
</span>.ir(
0)))
</p>
57 <p class=
"p5">}.play;
</p>
59 <p class=
"p2"><br></p>
60 <p class=
"p4">// backwards, variable offset
</p>
61 <p class=
"p2"><br></p>
63 <p class=
"p5">{
<span class=
"s3">var
</span> trig, pos, rate;
</p>
64 <p class=
"p5"><span class=
"Apple-tab-span"> </span>trig =
<span class=
"s3">Impulse
</span>.kr(
<span class=
"s3">MouseX
</span>.kr(
0.5,
10,
1));
</p>
65 <p class=
"p5"><span class=
"Apple-tab-span"> </span>rate =
<span class=
"s3">BufSampleRate
</span>.ir(
0);
</p>
66 <p class=
"p5"><span class=
"Apple-tab-span"> </span>pos =
<span class=
"s3">Sweep
</span>.ar(trig, rate.neg) + (
<span class=
"s3">BufFrames
</span>.ir(
0) *
<span class=
"s3">LFNoise0
</span>.kr(
0.2));
</p>
67 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">BufRd
</span>.ar(
1,
0, pos)
</p>
68 <p class=
"p5">}.play;
</p>
70 <p class=
"p2"><br></p>
71 <p class=
"p2"><br></p>
72 <p class=
"p4">// raising rate
</p>
74 <p class=
"p5">{
<span class=
"s3">var
</span> trig, rate;
</p>
75 <p class=
"p5"><span class=
"Apple-tab-span"> </span>trig =
<span class=
"s3">Impulse
</span>.kr(
<span class=
"s3">MouseX
</span>.kr(
0.5,
10,
1));
</p>
76 <p class=
"p5"><span class=
"Apple-tab-span"> </span>rate =
<span class=
"s3">Sweep
</span>.kr(trig,
2) +
0.5;
</p>
77 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">BufRd
</span>.ar(
1,
0,
<span class=
"s3">Sweep
</span>.ar(trig,
<span class=
"s3">BufSampleRate
</span>.ir(
0) * rate))
</p>
78 <p class=
"p5">}.play;
</p>
80 <p class=
"p2"><br></p>
81 <p class=
"p2"><br></p>