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
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #007300}
15 span
.s1
{font: 18.0px Helvetica
}
16 span
.s2
{color: #0000bf}
17 span
.s3
{color: #007300}
18 span
.s4
{color: #000000}
19 span
.Apple-tab-span
{white-space:pre
}
23 <p class=
"p1"><span class=
"s1"><b>Paddpre
<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></b></span><b>event pattern that adds to existing value of one key
</b></p>
24 <p class=
"p2"><br></p>
25 <p class=
"p1"><b>superclass: FilterPattern
</b></p>
26 <p class=
"p2"><br></p>
27 <p class=
"p1"><b>Pset(name, value, pattern)
</b></p>
28 <p class=
"p2"><br></p>
29 <p class=
"p1">adds a value in an event, before it is passed up the stream.
</p>
30 <p class=
"p1">to add to the value after it has been passed to the stream, use
<b>Padd
</b></p>
31 <p class=
"p2"><br></p>
32 <p class=
"p2"><br></p>
34 <p class=
"p3"><span class=
"s2">var
</span> a, b;
</p>
35 <p class=
"p3">a =
<span class=
"s2">Paddpre
</span>(
<span class=
"s3">\x
</span>,
8,
<span class=
"s2">Pbind
</span>(
<span class=
"s3">\dur
</span>,
0.5));
</p>
36 <p class=
"p3">x = a.asStream;
</p>
37 <p class=
"p3">9.do({ x.next(
<span class=
"s2">(\x:
4)
</span>).postln; });
</p>
39 <p class=
"p2"><br></p>
40 <p class=
"p1">Paddpre does not override incoming values:
</p>
41 <p class=
"p2"><br></p>
43 <p class=
"p3"><span class=
"s2">var
</span> a, b;
</p>
44 <p class=
"p3">a =
<span class=
"s2">Paddpre
</span>(
<span class=
"s3">\freq
</span>,
302,
<span class=
"s2">Pset
</span>(
<span class=
"s3">\freq
</span>,
500,
<span class=
"s2">Pbind
</span>(
<span class=
"s3">\dur
</span>,
0.3)));
</p>
45 <p class=
"p3">x = a.asStream;
</p>
46 <p class=
"p3">9.do({ x.next(
<span class=
"s2">Event
</span>.default).postln; });
</p>
48 <p class=
"p4"><br></p>
49 <p class=
"p2"><br></p>
50 <p class=
"p1"><b>value
</b> can be a pattern or a stream. the resulting stream ends when that incoming stream ends
</p>
51 <p class=
"p2"><br></p>
53 <p class=
"p3"><span class=
"s2">var
</span> a, b;
</p>
54 <p class=
"p3">a =
<span class=
"s2">Paddpre
</span>(
<span class=
"s3">\legato
</span>,
<span class=
"s2">Pseq
</span>([
0.2,
0.4],
2),
<span class=
"s2">Pbind
</span>(
<span class=
"s3">\dur
</span>,
0.5));
</p>
55 <p class=
"p3">x = a.asStream;
</p>
56 <p class=
"p3">9.do({ x.next(
<span class=
"s2">Event
</span>.default).postln; });
</p>
58 <p class=
"p4"><br></p>
59 <p class=
"p4"><br></p>
60 <p class=
"p1">sound example
</p>
61 <p class=
"p4"><br></p>
63 <p class=
"p5"><span class=
"s2">SynthDef
</span><span class=
"s4">(
</span>\sinegrain
<span class=
"s4">,
<span class=
"Apple-converted-space"> </span></span></p>
64 <p class=
"p3"><span class=
"Apple-tab-span"> </span>{
<span class=
"s2">arg
</span> out=
0, freq=
440, sustain=
0.02;
</p>
65 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> env;
</p>
66 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>env =
<span class=
"s2">EnvGen
</span>.kr(
<span class=
"s2">Env
</span>.perc(
0.001, sustain),
1, doneAction:
2);
</p>
67 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Out
</span>.ar(out,
<span class=
"s2">SinOsc
</span>.ar(freq,
0, env *
0.1))
</p>
68 <p class=
"p3"><span class=
"Apple-tab-span"> </span>}).add;
</p>
70 <p class=
"p4"><br></p>
71 <p class=
"p4"><br></p>
73 <p class=
"p5"><span class=
"s4">a =
</span><span class=
"s2">Pbind
</span><span class=
"s4">(
</span>\dur
<span class=
"s4">,
0.5,
</span>\instrument
<span class=
"s4">,
</span>\sinegrain
<span class=
"s4">);
</span></p>
74 <p class=
"p3">b =
<span class=
"s2">Paddpre
</span>(
<span class=
"s3">\freq
</span>,
<span class=
"s2">Pseq
</span>([
10,
30,
100],
<span class=
"s2">inf
</span>), a);
</p>
75 <p class=
"p3">b.play;
</p>
77 <p class=
"p4"><br></p>
78 <p class=
"p4"><br></p>
79 <p class=
"p4"><br></p>
80 <p class=
"p4"><br></p>