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: #0030a7}
18 span
.s1
{color: #000000}
19 span
.s2
{text-decoration: underline
}
20 span
.s3
{color: #0030a7}
21 span
.s4
{color: #606060}
22 span
.s5
{color: #54682b}
23 span
.Apple-tab-span
{white-space:pre
}
27 <p class=
"p1"><b>PV_MagDiv
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>division of magnitudes
</b></p>
28 <p class=
"p2"><br></p>
29 <p class=
"p3"><b>PV_MagDiv(bufferA,
<span class=
"Apple-converted-space"> </span>bufferB,
<span class=
"Apple-converted-space"> </span>zeroed)
</b></p>
30 <p class=
"p2"><br></p>
31 <p class=
"p3">Divides magnitudes of two inputs and keeps the phases of the first input.
</p>
32 <p class=
"p3"><b>bufferA
</b> - fft buffer A.
</p>
33 <p class=
"p3"><b>bufferB
</b> - fft buffer B.
</p>
34 <p class=
"p3"><b>zeroed
</b> - number to use when bins are zeroed out, i.e. causing division by zero (defaults to
0.0001)
</p>
35 <p class=
"p2"><br></p>
36 <p class=
"p4"><span class=
"s1">See also
<a href=
"FFT Overview.html"><span class=
"s2">FFT Overview
</span></a>.
</span></p>
37 <p class=
"p2"><br></p>
38 <p class=
"p5">s.boot;
</p>
39 <p class=
"p6"><br></p>
40 <p class=
"p6"><br></p>
42 <p class=
"p7"><span class=
"s3">SynthDef
</span><span class=
"s1">(
</span>"help-magMul"<span class=
"s1">, {
</span><span class=
"s3">arg
</span><span class=
"s1"> out=
0;
</span></p>
43 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> inA, chainA, inB, chainB, chain;
</p>
44 <p class=
"p5"><span class=
"Apple-tab-span"> </span>inA =
<span class=
"s3">WhiteNoise
</span>.ar(
0.2);
</p>
45 <p class=
"p5"><span class=
"Apple-tab-span"> </span>inB =
<span class=
"s3">LFSaw
</span>.ar(
100,
0,
0.2);
</p>
46 <p class=
"p8"><span class=
"s1"><span class=
"Apple-tab-span"> </span>chainA =
</span>FFT(LocalBuf(
2048)
<span class=
"s1">, inA);
</span></p>
47 <p class=
"p8"><span class=
"s1"><span class=
"Apple-tab-span"> </span>chainB =
</span>FFT(LocalBuf(
2048)
<span class=
"s1">, inB);
</span></p>
48 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">PV_MagDiv
</span>(chainA, chainB);
<span class=
"Apple-converted-space"> </span></p>
49 <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>
50 <p class=
"p5">}).play;
</p>
52 <p class=
"p6"><br></p>
53 <p class=
"p6"><br></p>
54 <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>
55 <p class=
"p6"><br></p>
57 <p class=
"p5"><span class=
"s3">SynthDef
</span>(
<span class=
"s4">"help-magMul2"</span>, {
<span class=
"s3">arg
</span> out=
0, soundBufnum=
0;
</p>
58 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> inA, chainA, inB, chainB, chain;
</p>
59 <p class=
"p5"><span class=
"Apple-tab-span"> </span>inA =
<span class=
"s3">LFSaw
</span>.ar([
100,
150],
0,
0.2);
</p>
60 <p class=
"p5"><span class=
"Apple-tab-span"> </span>inB =
<span class=
"s3">PlayBuf
</span>.ar(
1, soundBufnum,
<span class=
"s3">BufRateScale
</span>.kr(soundBufnum), loop:
1);
</p>
61 <p class=
"p8"><span class=
"s1"><span class=
"Apple-tab-span"> </span>chainA =
</span>FFT(LocalBuf(
2048)
<span class=
"s1">, inA);
</span></p>
62 <p class=
"p8"><span class=
"s1"><span class=
"Apple-tab-span"> </span>chainB =
</span>FFT(LocalBuf(
2048)
<span class=
"s1">, inB);
</span></p>
63 <p class=
"p5"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">PV_MagDiv
</span>(chainA, chainB);
<span class=
"Apple-converted-space"> </span></p>
64 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
<span class=
"Apple-converted-space"> </span>0.1 *
<span class=
"s3">IFFT
</span>(chain));
</p>
65 <p class=
"p5">}).play(s,[
<span class=
"s5">\out
</span>,
0,
<span class=
"s5">\soundBufnum
</span>, c]);
</p>
67 <p class=
"p6"><br></p>
68 <p class=
"p5">c.free;
</p>
69 <p class=
"p6"><br></p>