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: 13.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica
; min-height: 22.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
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 0.0px; font: 9.0px Monaco
}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000; min-height: 12.0px}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
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: 12.0px Monaco
; min-height: 16.0px}
19 span
.s1
{font: 18.0px Helvetica
}
20 span
.s2
{color: #0000bf}
21 span
.Apple-tab-span
{white-space:pre
}
25 <p class=
"p1"><span class=
"s1"><b>Pluck
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>a Karplus-Strong UGen
</b></p>
26 <p class=
"p2"><b></b><br></p>
27 <p class=
"p3"><b>Pluck.ar(in, trig, maxdelaytime, delaytime, decaytime, coef, mul, add)
</b></p>
28 <p class=
"p4"><br></p>
29 <p class=
"p3"><b>in
</b> - an excitation signal
</p>
30 <p class=
"p3"><b>trig
</b>- upon a negative to positive transition, the excitation signal will be fed into the delay line
</p>
31 <p class=
"p3"><b>maxdelaytime
</b> - the max delay time in seconds (initializes the internal delay buffer).
</p>
32 <p class=
"p3"><b>delaytime
</b> - delay time in seconds.
</p>
33 <p class=
"p3"><b>decaytime
</b> - time for the echoes to decay by
60 decibels. Negative times emphasize odd partials.
</p>
34 <p class=
"p3"><b>coef
</b> - the coef of the internal OnePole filter. Values should be between -
1 and +
1 (larger values will
</p>
35 <p class=
"p3"><span class=
"Apple-tab-span"> </span>be unstable... so be careful!).
</p>
36 <p class=
"p4"><br></p>
37 <p class=
"p5">s.boot;
</p>
38 <p class=
"p6"><br></p>
39 <p class=
"p7">// excitation signal is WhiteNoise, triggered twice a second with varying OnePole coef
</p>
41 <p class=
"p5"><span class=
"Apple-tab-span"> </span>{
<span class=
"s2">Pluck
</span>.ar(
<span class=
"s2">WhiteNoise
</span>.ar(
0.1),
<span class=
"s2">Impulse
</span>.kr(
2),
440.reciprocal,
440.reciprocal,
10,
<span class=
"Apple-converted-space"> </span></p>
42 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>coef:
<span class=
"s2">MouseX
</span>.kr(-
0.999,
0.999))
</p>
43 <p class=
"p5"><span class=
"Apple-tab-span"> </span>}.play(s)
</p>
45 <p class=
"p5">s.quit;
</p>
46 <p class=
"p7">// a group of angry fretless mandolin players
</p>
48 <p class=
"p5"><span class=
"Apple-tab-span"> </span>{
</p>
49 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> freq, numparts;
</p>
50 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>numparts =
50;
</p>
51 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>freq =
<span class=
"s2">SinOsc
</span>.kr(
<span class=
"s2">Array
</span>.fill(numparts, {
<span class=
"s2">Rand
</span>(
0.05,
0.2)}),
<span class=
"Apple-converted-space"> </span></p>
52 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Array
</span>.fill(numparts, {
<span class=
"s2">Rand
</span>(
0,
1.0)})).range(
1000,
3000);
</p>
53 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">LeakDC
</span>.ar(
</p>
54 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pan2
</span>.ar(
</p>
55 <p class=
"p5"><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=
"s2">Pluck
</span>.ar(
</p>
56 <p class=
"p5"><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=
"s2">WhiteNoise
</span>.ar(
0.1).dup(numparts),
<span class=
"Apple-converted-space"> </span></p>
57 <p class=
"p5"><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=
"s2">Impulse
</span>.kr(
<span class=
"s2">Array
</span>.fill(numparts, {
<span class=
"s2">Rand
</span>(
10,
12)})),
<span class=
"Apple-converted-space"> </span></p>
58 <p class=
"p5"><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>100.reciprocal, freq.reciprocal,
2, Rand(
0.01,
0.2), mul:
1),
</p>
59 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Array.fill(numparts, {
<span class=
"s2">Rand
</span>.new(-
1.0,
1.0)}))
</p>
60 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.sum
</p>
61 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
62 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}.play(s);
</p>
64 <p class=
"p8"><br></p>
65 <p class=
"p9"><br></p>