cmake build system: visiblity support for clang
[supercollider.git] / Help / UGens / FFT / pvcalc2.html
blob285d545b2b1b371fccdb06901897b61d55ae78b3
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="949.43">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 15.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}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
16 span.s1 {color: #1630ea}
17 span.s2 {color: #000000}
18 span.s3 {color: #1024b0}
19 span.s4 {color: #0910ba}
20 span.Apple-tab-span {white-space:pre}
21 </style>
22 </head>
23 <body>
24 <p class="p1"><b>pvcalc2<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Process the bins of two FFT chains</b></p>
25 <p class="p2"><br></p>
26 <p class="p3"><b><span class="Apple-tab-span"> </span>chain = chain.pvcalc2(chain2, numframes, func, frombin, tobin, zeroothers)</b></p>
27 <p class="p2"><br></p>
28 <p class="p3">pvcalc2 is just like <a href="pvcalc.html"><span class="s1">pvcalc</span></a> but can combine two FFT chains together. See <a href="pvcalc.html"><span class="s1">pvcalc</span></a> for more information.</p>
29 <p class="p2"><br></p>
30 <p class="p3"><b>func</b> should be a function that takes four arrays as inputs (magnitudes1, phases1, magnitudes2, phases2) and returns a resulting pair of arrays [magnitude, phase].</p>
31 <p class="p2"><br></p>
32 <p class="p2"><br></p>
33 <p class="p3"><b>Example</b></p>
34 <p class="p2"><br></p>
35 <p class="p4">(</p>
36 <p class="p4">s.boot.doWhenBooted {</p>
37 <p class="p5"><span class="s2">c = </span><span class="s3">Buffer</span><span class="s2">.read(s,</span>"sounds/a11wlk01.wav"<span class="s2">);</span></p>
38 <p class="p4">}</p>
39 <p class="p4">)</p>
40 <p class="p6"><br></p>
41 <p class="p4">(</p>
42 <p class="p4">x = {</p>
43 <p class="p4"><span class="Apple-tab-span"> </span><span class="s4">var</span> fftsize = 1024;</p>
44 <p class="p4"><span class="Apple-tab-span"> </span><span class="s4">var</span> in, chain, in2, chain2, out;</p>
45 <p class="p4"><span class="Apple-tab-span"> </span>in = <span class="s4">PlayBuf</span>.ar(1, c, <span class="s4">BufRateScale</span>.kr(c), loop: 1);</p>
46 <p class="p4"><span class="Apple-tab-span"> </span>chain = <span class="s4">FFT</span>(<span class="s4">LocalBuf</span>(fftsize), in);</p>
47 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
48 <p class="p4"><span class="Apple-tab-span"> </span>// in2 = <span class="s4">PlayBuf</span>.ar(1, e, <span class="s4">BufRateScale</span>.kr(e), loop: 1);</p>
49 <p class="p4"><span class="Apple-tab-span"> </span>// JMcC babbling brook</p>
50 <p class="p4"><span class="Apple-tab-span"> </span>in2 = ({</p>
51 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">RHPF</span>.ar(<span class="s4">OnePole</span>.ar(<span class="s4">BrownNoise</span>.ar, 0.99), <span class="s4">LPF</span>.ar(<span class="s4">BrownNoise</span>.ar, 14)</p>
52 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>* 400 + 500, 0.03, 0.003)}!2)</p>
53 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>+ ({<span class="s4">RHPF</span>.ar(<span class="s4">OnePole</span>.ar(<span class="s4">BrownNoise</span>.ar, 0.99), <span class="s4">LPF</span>.ar(<span class="s4">BrownNoise</span>.ar, 20)</p>
54 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>* 800 + 1000, 0.03, 0.005)}!2</p>
55 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
56 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>* 4;</p>
57 <p class="p4"><span class="Apple-tab-span"> </span>chain2 = <span class="s4">FFT</span>(<span class="s4">LocalBuf</span>(fftsize), in2);</p>
58 <p class="p6"><span class="Apple-tab-span"> </span></p>
59 <p class="p4"><span class="Apple-tab-span"> </span>chain = chain.pvcalc2(chain2, fftsize, {<span class="s4">|mags, phases, mags2, phases2|</span></p>
60 <p class="p4"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>[mags * mags2 / 10, phases2 + phases]</p>
61 <p class="p4"><span class="Apple-tab-span"> </span>}, frombin: 0, tobin: 125, zeroothers: 0);</p>
62 <p class="p6"><span class="Apple-tab-span"> </span></p>
63 <p class="p4"><span class="Apple-tab-span"> </span>out = <span class="s4">IFFT</span>(chain);</p>
64 <p class="p4"><span class="Apple-tab-span"> </span><span class="s4">Out</span>.ar(0, 0.5 * out.dup);</p>
65 <p class="p4">}.play(s);</p>
66 <p class="p4">)</p>
67 <p class="p4">x.free;</p>
68 </body>
69 </html>