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=
"949.35">
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: 12.0px Helvetica
; color: #0021e7}
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
; min-height: 12.0px}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #ad140d}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #2c7014}
19 span
.s1
{color: #000000}
20 span
.s2
{text-decoration: underline
}
21 span
.s3
{color: #001bb9}
22 span
.s4
{color: #0029ac}
23 span
.s5
{color: #2c7014}
24 span
.Apple-tab-span
{white-space:pre
}
28 <p class=
"p1"><b>PV_RectComb2
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>make gaps in spectrum
</b></p>
29 <p class=
"p2"><br></p>
30 <p class=
"p3"><b>PV_RectComb2(bufferA,
<span class=
"Apple-converted-space"> </span>bufferB,
<span class=
"Apple-converted-space"> </span>numTeeth,
<span class=
"Apple-converted-space"> </span>phase,
<span class=
"Apple-converted-space"> </span>width)
</b></p>
31 <p class=
"p2"><br></p>
32 <p class=
"p3">Alternates blocks of bins between the two inputs.
</p>
33 <p class=
"p3"><b>bufferA
</b> - fft buffer A.
</p>
34 <p class=
"p3"><b>bufferB
</b> - fft buffer B.
</p>
35 <p class=
"p3"><b>numTeeth
</b> - number of teeth in the comb.
</p>
36 <p class=
"p3"><b>phase
</b> - starting phase of comb pulse.
</p>
37 <p class=
"p3"><b>width
</b> - pulse width of comb.
</p>
38 <p class=
"p2"><br></p>
39 <p class=
"p4"><span class=
"s1">See also
<a href=
"FFT Overview.html"><span class=
"s2">FFT Overview
</span></a>.
</span></p>
40 <p class=
"p2"><br></p>
41 <p class=
"p5">s.boot;
</p>
42 <p class=
"p6"><br></p>
45 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> inA, chainA, inB, chainB, chain ;
</p>
46 <p class=
"p5"><span class=
"Apple-tab-span"> </span>inA =
<span class=
"s3">Saw
</span>.ar(
<span class=
"s3">LFNoise1
</span>.kr(
2).exprange(
10,
1000));
</p>
47 <p class=
"p5"><span class=
"Apple-tab-span"> </span>inB =
<span class=
"Apple-converted-space"> </span><span class=
"s3">Pulse
</span>.ar(
<span class=
"s3">LFNoise1
</span>.kr(
2).exprange(
10,
1000));
</p>
48 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chainA =
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), inA);
</p>
49 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chainB =
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), inB);
</p>
50 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s4">PV_RectComb2
</span>(chainA, chainB,
<span class=
"s4">MouseX
</span>.kr(
0,
32),
<span class=
"s4">MouseY
</span>.kr,
0.3);
<span class=
"Apple-converted-space"> </span></p>
51 <p class=
"p5"><span class=
"Apple-tab-span"> </span>0.1 *
<span class=
"s3">IFFT
</span>(chain).dup;
</p>
52 <p class=
"p5">}.play
</p>
54 <p class=
"p6"><br></p>
55 <p class=
"p7"><span class=
"s1">d =
</span><span class=
"s4">Buffer
</span><span class=
"s1">.read(s,
</span>"sounds/a11wlk01.wav"<span class=
"s1">);
</span></p>
56 <p class=
"p6"><br></p>
58 <p class=
"p5"><span class=
"s3">SynthDef
</span>(
<span class=
"s5">\rectcomb_max
</span>, {
<span class=
"s3">arg
</span> out=
0, soundBufnum1=
0, soundBufnum2 =
0;
</p>
59 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> inA, chainA, inB, chainB, chain ;
</p>
60 <p class=
"p5"><span class=
"Apple-tab-span"> </span>inA =
<span class=
"s3">PlayBuf
</span>.ar(
1, soundBufnum1,
<span class=
"s3">BufRateScale
</span>.kr(soundBufnum1), loop:
1);
</p>
61 <p class=
"p5"><span class=
"Apple-tab-span"> </span>inB =
<span class=
"Apple-converted-space"> </span><span class=
"s3">PlayBuf
</span>.ar(
1, soundBufnum2,
<span class=
"s3">BufRateScale
</span>.kr(soundBufnum2), loop:
1);
</p>
62 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chainA =
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), inA);
</p>
63 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chainB =
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), inB);
</p>
64 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s4">PV_RectComb2
</span>(chainA, chainB,
<span class=
"s4">MouseX
</span>.kr(
0,
32),
<span class=
"s4">MouseY
</span>.kr,
0.3);
<span class=
"Apple-converted-space"> </span></p>
65 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
<span class=
"Apple-converted-space"> </span>0.5 *
<span class=
"s3">IFFT
</span>(chain).dup);
</p>
66 <p class=
"p5">}).store;
</p>
68 <p class=
"p6"><br></p>
69 <p class=
"p2"><br></p>
70 <p class=
"p6"><br></p>
72 <p class=
"p8"><span class=
"s1">q = q ? ();
</span>// use global dictionary
</p>
73 <p class=
"p6"><br></p>
74 <p class=
"p7"><span class=
"s1"><span class=
"Apple-tab-span"> </span>q[
</span><span class=
"s5">\bufferA
</span><span class=
"s1">] =
</span><span class=
"s3">Buffer
</span><span class=
"s1">.read(s,
</span>"sounds/a11wlk01.wav"<span class=
"s1">);
</span></p>
75 <p class=
"p8"><span class=
"s1"><span class=
"Apple-tab-span"> </span></span><span class=
"s3">CocoaDialog
</span><span class=
"s1">.getPaths({
</span><span class=
"s3">arg
</span><span class=
"s1"> paths;
</span>// get a second soundfile;
</p>
76 <p class=
"p5"><span class=
"Apple-tab-span"> </span>paths.do({
<span class=
"s3">arg
</span> p;
<span class=
"Apple-converted-space"> </span></p>
77 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>q[
<span class=
"s5">\bufferB
</span>] =
<span class=
"s3">Buffer
</span>.read(s, p);
</p>
78 <p class=
"p9"><span class=
"s1"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s3">Synth
</span><span class=
"s1">(
</span>\rectcomb_max
<span class=
"s1">, [
</span>\out
<span class=
"s1">,
0,
</span>\soundBufnum1
<span class=
"s1">, q[
</span>\bufferA
<span class=
"s1">],
</span>\soundBufnum2
<span class=
"s1">, q[
</span>\bufferB
<span class=
"s1">]]);
</span></p>
79 <p class=
"p5"><span class=
"Apple-tab-span"> </span>})
</p>
81 <p class=
"p7"><span class=
"s1"><span class=
"Apple-tab-span"> </span></span>"cancelled"<span class=
"s1">.postln;
</span></p>
84 <p class=
"p6"><br></p>
85 <p class=
"p5">q[
<span class=
"s5">\bufferA
</span>].free;
</p>
86 <p class=
"p5">q[
<span class=
"s5">\bufferB
</span>].free;
</p>