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: #bf0000}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000}
19 span
.s1
{color: #000000}
20 span
.s2
{text-decoration: underline
}
21 span
.s3
{color: #0029ac}
22 span
.s4
{color: #0000bf}
23 span
.s5
{color: #606060}
24 span
.s6
{color: #007300}
25 span
.Apple-tab-span
{white-space:pre
}
29 <p class=
"p1"><b>PV_BinScramble
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>scramble bins
</b></p>
30 <p class=
"p2"><br></p>
31 <p class=
"p3"><b>PV_BinScramble(buffer,
<span class=
"Apple-converted-space"> </span>wipe,
<span class=
"Apple-converted-space"> </span>width,
<span class=
"Apple-converted-space"> </span>trig)
</b></p>
32 <p class=
"p2"><br></p>
33 <p class=
"p3">Randomizes the order of the bins.
</p>
34 <p class=
"p3">The trigger will select a new random ordering.
</p>
35 <p class=
"p3"><b>buffer
</b> - fft buffer.
</p>
36 <p class=
"p3"><b>wipe
</b> - scrambles more bins as wipe moves from zero to one.
</p>
37 <p class=
"p3"><b>width
</b> - a value from zero to one, indicating the maximum randomized distance of a bin from its
</p>
38 <p class=
"p3">original location in the spectrum.
</p>
39 <p class=
"p3"><b>trig
</b> - a trigger selects a new random ordering.
</p>
40 <p class=
"p2"><br></p>
41 <p class=
"p4"><span class=
"s1">See also
<a href=
"FFT Overview.html"><span class=
"s2">FFT Overview
</span></a>.
</span></p>
42 <p class=
"p2"><br></p>
43 <p class=
"p5">s.boot;
</p>
44 <p class=
"p6"><br></p>
45 <p class=
"p7"><span class=
"s1">c =
</span><span class=
"s3">Buffer
</span><span class=
"s1">.read(s,
</span>"sounds/a11wlk01.wav"<span class=
"s1">);
</span></p>
46 <p class=
"p6"><br></p>
47 <p class=
"p2"><br></p>
49 <p class=
"p8">// trig with MouseY
</p>
50 <p class=
"p9"><span class=
"s4">SynthDef
</span>(
<span class=
"s5">"help-binScramble"</span>, {
<span class=
"s4">arg
</span> out=
0, bufnum=
0, soundBufnum=
2;
</p>
51 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"s4">var
</span> in, chain;
</p>
52 <p class=
"p9"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s4">PlayBuf
</span>.ar(
1, soundBufnum,
<span class=
"s4">BufRateScale
</span>.kr(soundBufnum), loop:
1);
</p>
53 <p class=
"p9"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s4">FFT
</span>(
<span class=
"s4">LocalBuf
</span>(
2048), in);
</p>
54 <p class=
"p9"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s4">PV_BinScramble
</span>(chain,
<span class=
"s4">MouseX
</span>.kr ,
0.1,
<span class=
"s4">MouseY
</span>.kr
> 0.5 );
<span class=
"Apple-converted-space"> </span></p>
55 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"s4">Out
</span>.ar(out,
0.5 *
<span class=
"s4">IFFT
</span>(chain).dup);
</p>
56 <p class=
"p9">}).play(s,[
<span class=
"s6">\out
</span>,
0,
<span class=
"s6">\bufnum
</span>, b,
<span class=
"s6">\soundBufnum
</span>, c]);
</p>
58 <p class=
"p6"><br></p>
59 <p class=
"p5">c.free;
</p>