cmake build system: visiblity support for clang
[supercollider.git] / Help / UGens / FFT / PV_MagShift.html
blob3b353a4facee11a077b2dfe5802dc68c7544ace7
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.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; color: #000000}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
17 span.s1 {color: #000000}
18 span.s2 {text-decoration: underline}
19 span.s3 {color: #0000bf}
20 span.s4 {color: #007300}
21 span.s5 {color: #606060}
22 span.Apple-tab-span {white-space:pre}
23 </style>
24 </head>
25 <body>
26 <p class="p1"><b>PV_MagShift<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>shift and stretch magnitude bin position</b></p>
27 <p class="p2"><br></p>
28 <p class="p3"><b>PV_MagShift(buffer,<span class="Apple-converted-space">  </span>stretch,<span class="Apple-converted-space">  </span>shift)</b></p>
29 <p class="p2"><br></p>
30 <p class="p3">Shift and stretch the positions of only the magnitude of the bins.<span class="Apple-converted-space"> </span></p>
31 <p class="p3">Can be used as a very crude frequency shifter/scaler.</p>
32 <p class="p3"><b>buffer</b> - fft buffer.</p>
33 <p class="p3"><b>stretch</b> - scale bin location by factor.</p>
34 <p class="p3"><b>shift</b> - add an offset to bin position.</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="p5">(</p>
41 <p class="p7"><span class="s3">SynthDef</span><span class="s1">(</span>"help-magStretch"<span class="s1">, { </span><span class="s3">arg</span><span class="s1"> out=0;</span></p>
42 <p class="p5"><span class="Apple-tab-span"> </span><span class="s3">var</span> in, chain;</p>
43 <p class="p5"><span class="Apple-tab-span"> </span>in = <span class="s3">LFSaw</span>.ar(200, 0, 0.2);</p>
44 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">FFT</span>(<span class="s3">LocalBuf</span>(2048), in);</p>
45 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">PV_MagShift</span>(chain, <span class="s3">MouseX</span>.kr(0.25, 4, <span class="s4">\exponential</span>) );<span class="Apple-converted-space"> </span></p>
46 <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>
47 <p class="p5">}).play;</p>
48 <p class="p5">)</p>
49 <p class="p6"><br></p>
50 <p class="p5">(</p>
51 <p class="p5"><span class="s3">SynthDef</span>(<span class="s5">"help-magStretch2"</span>, { <span class="s3">arg</span> out=0, soundBufnum=2;</p>
52 <p class="p5"><span class="Apple-tab-span"> </span><span class="s3">var</span> in, chain;</p>
53 <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>
54 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">FFT</span>(<span class="s3">LocalBuf</span>(2048), in);</p>
55 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">PV_MagShift</span>(chain, <span class="s3">MouseX</span>.kr(0.25, 4, <span class="s4">\exponential</span>) );<span class="Apple-converted-space"> </span></p>
56 <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>
57 <p class="p5">}).play(s,[<span class="s4">\out</span>, 0, <span class="s4">\soundBufnum</span>, c]);</p>
58 <p class="p5">)</p>
59 <p class="p6"><br></p>
60 <p class="p5">(</p>
61 <p class="p7"><span class="s3">SynthDef</span><span class="s1">(</span>"help-magShift"<span class="s1">, { </span><span class="s3">arg</span><span class="s1"> out=0;</span></p>
62 <p class="p5"><span class="Apple-tab-span"> </span><span class="s3">var</span> in, chain;</p>
63 <p class="p5"><span class="Apple-tab-span"> </span>in = <span class="s3">LFSaw</span>.ar(200, 0, 0.2);</p>
64 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">FFT</span>(<span class="s3">LocalBuf</span>(2048), in);</p>
65 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">PV_MagShift</span>(chain, 1, <span class="s3">MouseX</span>.kr(-128, 128) );<span class="Apple-converted-space"> </span></p>
66 <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>
67 <p class="p5">}).play;</p>
68 <p class="p5">)</p>
69 <p class="p6"><br></p>
70 <p class="p6"><br></p>
71 <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>
72 <p class="p6"><br></p>
73 <p class="p5">(</p>
74 <p class="p5"><span class="s3">SynthDef</span>(<span class="s5">"help-magShift2"</span>, {<span class="Apple-converted-space">  </span><span class="s3">arg</span> out=0, soundBufnum=2;</p>
75 <p class="p5"><span class="Apple-tab-span"> </span><span class="s3">var</span> in, chain;</p>
76 <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>
77 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">FFT</span>(<span class="s3">LocalBuf</span>(2048), in);</p>
78 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">PV_MagShift</span>(chain, 1, <span class="s3">MouseX</span>.kr(-128, 128) );<span class="Apple-converted-space"> </span></p>
79 <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>
80 <p class="p5">}).play(s,[<span class="s4">\out</span>, 0, <span class="s4">\soundBufnum</span>, c]);</p>
81 <p class="p5">)</p>
82 <p class="p6"><br></p>
83 <p class="p5">c.free;</p>
84 </body>
85 </html>