supernova: fixes for boost-1.49 and gcc-4.7
[supercollider.git] / Help / UGens / FFT / PV_BinShift.html
blob47f424e3e1af2196870f246c5e8a132e4efb32f3
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: #606060}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
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_BinShift<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 bin position</b></p>
27 <p class="p2"><br></p>
28 <p class="p3"><b>PV_BinShift(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 scale the positions 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"><span class="s1">c = </span><span class="s3">Buffer</span><span class="s1">.read(s,</span>"sounds/a11wlk01.wav"<span class="s1">);</span></p>
40 <p class="p7"><br></p>
41 <p class="p7"><br></p>
42 <p class="p5">(</p>
43 <p class="p6"><span class="s3">SynthDef</span><span class="s1">(</span>"help-binStretch"<span class="s1">, { </span><span class="s3">arg</span><span class="s1"> out=0;</span></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">LFSaw</span>.ar(200, 0, 0.2);</p>
46 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">FFT</span>(<span class="s3">LocalBuf</span>(2048), in);</p>
47 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">PV_BinShift</span>(chain, <span class="s3">MouseX</span>.kr(0.25, 4, <span class="s4">\exponential</span>) );<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="s4">\out</span>, 0]);</p>
50 <p class="p5">)</p>
51 <p class="p7"><br></p>
52 <p class="p5">(</p>
53 <p class="p5"><span class="s3">SynthDef</span>(<span class="s5">"help-binStretch2"</span>, { <span class="s3">arg</span> out=0, soundBufnum=2;</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">PlayBuf</span>.ar(1, soundBufnum, <span class="s3">BufRateScale</span>.kr(soundBufnum), loop: 1);</p>
56 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">FFT</span>(<span class="s3">LocalBuf</span>(2048), in);</p>
57 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">PV_BinShift</span>(chain, <span class="s3">MouseX</span>.kr(0.25, 4, <span class="s4">\exponential</span>) );<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="s4">\out</span>, 0, <span class="s4">\soundBufnum</span>, c]);</p>
60 <p class="p5">)</p>
61 <p class="p7"><br></p>
62 <p class="p5">(</p>
63 <p class="p6"><span class="s3">SynthDef</span><span class="s1">(</span>"help-binShift"<span class="s1">, { </span><span class="s3">arg</span><span class="s1"> out=0;</span></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">LFSaw</span>.ar(200, 0, 0.2);</p>
66 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">FFT</span>(<span class="s3">LocalBuf</span>(2048), in);</p>
67 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">PV_BinShift</span>(chain, 1, <span class="s3">MouseX</span>.kr(-128, 128) );<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="s4">\out</span>, 0]);</p>
70 <p class="p5">)</p>
71 <p class="p7"><br></p>
72 <p class="p5">(</p>
73 <p class="p5"><span class="s3">SynthDef</span>(<span class="s5">"help-binShift2"</span>, {<span class="Apple-converted-space">  </span><span class="s3">arg</span> out=0, soundBufnum=2;</p>
74 <p class="p5"><span class="Apple-tab-span"> </span><span class="s3">var</span> in, chain;</p>
75 <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>
76 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">FFT</span>(<span class="s3">LocalBuf</span>(2048), in);</p>
77 <p class="p5"><span class="Apple-tab-span"> </span>chain = <span class="s3">PV_BinShift</span>(chain, 1, <span class="s3">MouseX</span>.kr(-128, 128) );<span class="Apple-converted-space"> </span></p>
78 <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>
79 <p class="p5">}).play(s,[<span class="s4">\out</span>, 0, <span class="s4">\soundBufnum</span>, c]);</p>
80 <p class="p5">)</p>
81 <p class="p7"><br></p>
82 <p class="p5">c.free;</p>
83 </body>
84 </html>