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: 12.0px Helvetica
; color: #0016e6}
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 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
17 span
.s1
{color: #000000}
18 span
.s2
{text-decoration: underline
}
19 span
.s3
{color: #091fb1}
20 span
.s4
{color: #606060}
21 span
.s5
{color: #456c20}
22 span
.Apple-tab-span
{white-space:pre
}
26 <p class=
"p1"><b>PV_MagBelow
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>pass bins below a threshold
</b></p>
27 <p class=
"p2"><br></p>
28 <p class=
"p3"><b>PV_MagBelow(buffer, threshold)
</b></p>
29 <p class=
"p2"><br></p>
30 <p class=
"p3">Passes only bins whose magnitude is below a threshold.
</p>
31 <p class=
"p3"><b>buffer
</b> - fft buffer.
</p>
32 <p class=
"p3"><b>threshold
</b> - magnitude threshold.
</p>
33 <p class=
"p2"><br></p>
34 <p class=
"p4"><span class=
"s1">See also
<a href=
"FFT Overview.html"><span class=
"s2">FFT Overview
</span></a>.
</span></p>
35 <p class=
"p2"><br></p>
36 <p class=
"p5">s.boot;
</p>
38 <p class=
"p5">b =
<span class=
"s3">Buffer
</span>.alloc(s,
2048,
1);
</p>
39 <p class=
"p6"><span class=
"s1">c =
</span><span class=
"s3">Buffer
</span><span class=
"s1">.read(s,
</span>"sounds/a11wlk01.wav"<span class=
"s1">);
</span></p>
41 <p class=
"p2"><br></p>
43 <p class=
"p5"><span class=
"s3">SynthDef
</span>(
<span class=
"s4">"help-magBelow"</span>, {
<span class=
"s3">arg
</span> out=
0, bufnum=
0;
</p>
44 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> in, chain;
</p>
45 <p class=
"p5"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">SinOsc
</span>.ar(
<span class=
"s3">SinOsc
</span>.kr(
<span class=
"s3">SinOsc
</span>.kr(
0.08,
0,
6,
6.2).squared,
0,
100,
800));
</p>
46 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">FFT
</span>(bufnum, in);
</p>
47 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">PV_MagBelow
</span>(chain,
10);
<span class=
"Apple-converted-space"> </span></p>
48 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
0.5 *
<span class=
"s3">IFFT
</span>(chain).dup);
</p>
49 <p class=
"p5">}).play(s,[
<span class=
"s5">\out
</span>,
0,
<span class=
"s5">\bufnum
</span>, b]);
</p>
51 <p class=
"p7"><br></p>
53 <p class=
"p5"><span class=
"s3">SynthDef
</span>(
<span class=
"s4">"help-magBelow2"</span>, {
<span class=
"s3">arg
</span> out=
0, bufnum=
0;
</p>
54 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> in, chain;
</p>
55 <p class=
"p5"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">WhiteNoise
</span>.ar(
0.2);
</p>
56 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">FFT
</span>(bufnum, in);
</p>
57 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">PV_MagBelow
</span>(chain,
<span class=
"s3">MouseX
</span>.kr(
0,
7));
<span class=
"Apple-converted-space"> </span></p>
58 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
0.5 *
<span class=
"s3">IFFT
</span>(chain).dup);
</p>
59 <p class=
"p5">}).play(s,[
<span class=
"s5">\out
</span>,
0,
<span class=
"s5">\bufnum
</span>, b]);
</p>
61 <p class=
"p7"><br></p>
63 <p class=
"p5"><span class=
"s3">SynthDef
</span>(
<span class=
"s4">"help-magBelow3"</span>, {
<span class=
"s3">arg
</span> out=
0, bufnum=
0, soundBufnum=
2;
</p>
64 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> in, chain;
</p>
65 <p class=
"p5"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">PlayBuf
</span>.ar(
1, soundBufnum,
<span class=
"s3">BufRateScale
</span>.kr(soundBufnum), loop:
1);
</p>
66 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">FFT
</span>(bufnum, in);
</p>
67 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">PV_MagBelow
</span>(chain,
<span class=
"s3">MouseX
</span>.kr(
0,
310));
<span class=
"Apple-converted-space"> </span></p>
68 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
0.5 *
<span class=
"s3">IFFT
</span>(chain).dup);
</p>
69 <p class=
"p5">}).play(s,[
<span class=
"s5">\out
</span>,
0,
<span class=
"s5">\bufnum
</span>, b,
<span class=
"s5">\soundBufnum
</span>, c]);
</p>
71 <p class=
"p7"><br></p>
72 <p class=
"p5">b.free; c.free;
</p>