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.44">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 18.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: 12.0px Helvetica
}
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
}
15 span
.s1
{color: #091fb1}
16 span
.s2
{color: #606060}
17 span
.s3
{color: #456c20}
21 <p class=
"p1"><b>PingPong
<span class=
"Apple-converted-space"> </span>ping pong delay
</b></p>
22 <p class=
"p2"><br></p>
23 <p class=
"p3"><b>PingPong.ar(bufnum, inputArray, delayTime, feedback, rotate)
</b></p>
24 <p class=
"p2"><br></p>
25 <p class=
"p3">Bounces sound between a number of outputs ...
<span class=
"Apple-converted-space"> </span>like a ping-pong ball.
</p>
26 <p class=
"p3">PingPong is actually a compound built upon
<b>RecordBuf
</b> and
<b>PlayBuf
</b>.
</p>
27 <p class=
"p2"><br></p>
28 <p class=
"p3"><b>bufnum
</b> - first index of a multi channel buffer .
</p>
29 <p class=
"p3"><b>inputArray
</b> - an array of audio inputs, the same size as your buffer.
</p>
30 <p class=
"p3"><b>delaytime
</b> - delay time in seconds..
</p>
31 <p class=
"p3"><b>feedback
</b> - feedback coefficient.
</p>
32 <p class=
"p3"><b>rotate
</b> - default
1: which rotates the inputArray by one step.
<span class=
"Apple-converted-space"> </span>(left -
> right, right -
> left)
</p>
33 <p class=
"p3"><span class=
"Apple-converted-space"> </span>rotation of
0 (or
2) would result in no rotation to the inputArray
</p>
34 <p class=
"p4"><br></p>
35 <p class=
"p4"><br></p>
37 <p class=
"p5">s =
<span class=
"s1">Server
</span>.local;
</p>
38 <p class=
"p5">s.waitForBoot({
</p>
39 <p class=
"p4"><br></p>
40 <p class=
"p5">b =
<span class=
"s1">Buffer
</span>.alloc(s,
44100 *
2,
2);
</p>
41 <p class=
"p4"><br></p>
42 <p class=
"p5"><span class=
"s1">SynthDef
</span>(
<span class=
"s2">"help-PingPong"</span>,{
<span class=
"s1">arg
</span> out=
0,bufnum=
0,feedback=
0.5,delayTime=
0.2;
<span class=
"Apple-converted-space"> </span></p>
43 <p class=
"p5"><span class=
"Apple-converted-space"> </span><span class=
"s1">var
</span> left, right;
</p>
44 <p class=
"p5"><span class=
"Apple-converted-space"> </span>left =
<span class=
"s1">Decay2
</span>.ar(
<span class=
"s1">Impulse
</span>.ar(
0.7,
0.25),
0.01,
0.25,
<span class=
"Apple-converted-space"> </span></p>
45 <p class=
"p5"><span class=
"Apple-converted-space"> </span><span class=
"s1">SinOsc
</span>.ar(
<span class=
"s1">SinOsc
</span>.kr(
3.7,
0,
200,
500)));
</p>
46 <p class=
"p5"><span class=
"Apple-converted-space"> </span>right =
<span class=
"s1">Decay2
</span>.ar(
<span class=
"s1">Impulse
</span>.ar(
0.5,
0.25),
0.01,
0.25,
<span class=
"Apple-converted-space"> </span></p>
47 <p class=
"p5"><span class=
"Apple-converted-space"> </span><span class=
"s1">Resonz
</span>.ar(
<span class=
"s1">PinkNoise
</span>.ar(
4),
<span class=
"s1">SinOsc
</span>.kr(
2.7,
0,
1000,
2500),
0.2));
</p>
48 <p class=
"p4"><span class=
"Apple-converted-space"> </span></p>
49 <p class=
"p5"><span class=
"Apple-converted-space"> </span><span class=
"s1">Out
</span>.ar(
0,
</p>
50 <p class=
"p5"><span class=
"Apple-converted-space"> </span><span class=
"s1">PingPong
</span>.ar(bufnum, [left,right], delayTime, feedback,
1)
</p>
51 <p class=
"p5"><span class=
"Apple-converted-space"> </span>)
</p>
52 <p class=
"p5">}).play(s,[
<span class=
"s3">\out
</span>,
0,
<span class=
"s3">\bufnum
</span>, b,\feedback,
0.5,\delayTime,
0.1]);
</p>
55 <p class=
"p4"><br></p>
56 <p class=
"p4"><br></p>
58 <p class=
"p5">s =
<span class=
"s1">Server
</span>.local;
</p>
59 <p class=
"p5">s.waitForBoot({
</p>
60 <p class=
"p4"><br></p>
61 <p class=
"p5">b =
<span class=
"s1">Buffer
</span>.alloc(s,
44100 *
2,
2);
</p>
62 <p class=
"p4"><br></p>
63 <p class=
"p5"><span class=
"s1">SynthDef
</span>(
<span class=
"s2">"help-PingPong"</span>,{
<span class=
"s1">arg
</span> out=
0,bufnum=
0;
</p>
64 <p class=
"p5"><span class=
"Apple-converted-space"> </span><span class=
"s1">var
</span> left, right;
</p>
65 <p class=
"p5"><span class=
"Apple-converted-space"> </span>left =
<span class=
"s1">Decay2
</span>.ar(
<span class=
"s1">Impulse
</span>.ar(
0.7,
0.25),
0.01,
0.25,
</p>
66 <p class=
"p5"><span class=
"Apple-converted-space"> </span><span class=
"s1">SinOsc
</span>.ar(
<span class=
"s1">SinOsc
</span>.kr(
3.7,
0,
200,
500)));
</p>
67 <p class=
"p5"><span class=
"Apple-converted-space"> </span>right =
<span class=
"s1">Decay2
</span>.ar(
<span class=
"s1">Impulse
</span>.ar(
0.5,
0.25),
0.01,
0.25,
</p>
68 <p class=
"p5"><span class=
"Apple-converted-space"> </span><span class=
"s1">Resonz
</span>.ar(
<span class=
"s1">PinkNoise
</span>.ar(
4),
<span class=
"s1">SinOsc
</span>.kr(
2.7,
0,
1000,
2500),
</p>
69 <p class=
"p5">0.2));
</p>
70 <p class=
"p4"><br></p>
71 <p class=
"p5"><span class=
"Apple-converted-space"> </span><span class=
"s1">Out
</span>.ar(
0,
</p>
72 <p class=
"p5"><span class=
"Apple-converted-space"> </span><span class=
"s1">PingPong
</span>.ar(bufnum, [left,right] *
<span class=
"Apple-converted-space"> </span><span class=
"s1">EnvGen
</span>.kr(
<span class=
"s1">Env
</span>([
1,
1,
0], [
2,
0.1])),
<span class=
"Apple-converted-space"> </span></p>
73 <p class=
"p5"><span class=
"Apple-converted-space"> </span>0.1,
0.8,
1)
</p>
74 <p class=
"p5"><span class=
"Apple-converted-space"> </span>)
</p>
75 <p class=
"p5">}).play(s,[
<span class=
"s3">\out
</span>,
0,
<span class=
"s3">\bufnum
</span>, b]);
</p>
78 <p class=
"p4"><br></p>
79 <p class=
"p4"><br></p>