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.43">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.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
; color: #0021e7}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #001bb9}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
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: #ad140d}
18 span
.s1
{font: 18.0px Helvetica
}
19 span
.s2
{color: #000000}
20 span
.s3
{color: #001bb9}
21 span
.s4
{color: #0021e7}
22 span
.s5
{text-decoration: underline
}
23 span
.s6
{color: #ad140d}
24 span
.s7
{color: #606060}
25 span
.Apple-tab-span
{white-space:pre
}
29 <p class=
"p1"><span class=
"s1"><b>FFT
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>Fast Fourier Transform
</b></p>
30 <p class=
"p2"><br></p>
31 <p class=
"p3"><span class=
"s2"><b>Inherits from:
</b><a href=
"../../Core/Object.html"><b>Object
</b></a></span><span class=
"s3"><b> :
</b><a href=
"../../Core/Kernel/AbstractFunction.html"><span class=
"s4"><b>AbstractFunction
</b></span></a><b> :
</b><a href=
"../UGen.html"><span class=
"s4"><b>UGen
</b></span></a><b> :
</b><a href=
"../PV_ChainUGen.html"><span class=
"s4"><b>PV_ChainUGen
</b></span></a></span></p>
32 <p class=
"p2"><br></p>
33 <p class=
"p2"><br></p>
34 <p class=
"p1"><b>FFT.new(buffer, input, hop, wintype, active, winsize)
</b></p>
35 <p class=
"p2"><br></p>
36 <p class=
"p1">The fast fourier transform analyzes the frequency content of a signal, which can be useful for audio analysis or for frequency-domain sound processing (phase vocoder).
</p>
37 <p class=
"p2"><br></p>
38 <p class=
"p1"><b>buffer
</b> - The buffer where a frame will be held. Its size must be a power of two. LocalBuf is useful here, because processes should not share data between synths. (Note: most PV UGens operate on this data in place. Use PV_Copy for parallel processing.)
</p>
39 <p class=
"p2"><br></p>
40 <p class=
"p1"><b>input
</b> - the signal to be analyzed. The signal's rate determines the rate at which the input is read.
</p>
41 <p class=
"p2"><br></p>
42 <p class=
"p1">Only the above two arguments are required. The remaining arguments allow for custom FFT analyses for specialised situations:
</p>
43 <p class=
"p2"><br></p>
44 <p class=
"p1"><b>hop
</b> - the amount of offset from one FFT analysis frame to the next, measured in multiples of the analysis frame size. This can range between zero and one, and the default is
0.5 (meaning each frame has a
50% overlap with the preceding/following frames).
</p>
45 <p class=
"p1"><b>wintype
</b> - defines how the data is windowed:
</p>
46 <p class=
"p1"><span class=
"Apple-tab-span"> </span>-
1 is for
<b><i>rectangular
</i></b> windowing, simple but typically not recommended;
<span class=
"Apple-converted-space"> </span></p>
47 <p class=
"p1"><span class=
"Apple-tab-span"> </span>0 (the default) is for
<b><i>Sine
</i></b> windowing, typically recommended for phase-vocoder work;
<span class=
"Apple-converted-space"> </span></p>
48 <p class=
"p1"><span class=
"Apple-tab-span"> </span>1 is for
<b><i>Hann
</i></b> windowing, typically recommended for analysis work.
</p>
49 <p class=
"p1"><b>active
</b> - is a simple control allowing FFT analysis to be active (
>0) or inactive (
<=
0). This is mainly useful for signal analysis processes which are only intended to analyse at specific times rather than continuously
</p>
50 <p class=
"p1"><b>winsize
</b> - the windowed audio frames are usually the same size as the buffer. If you wish the FFT to be
<i>zero-padded
</i> then you can specify a window size smaller than the actual buffer size (e.g. window size
1024 with buffer size
2048). Both values must still be a power of two. Leave this at its default of zero for no zero-padding.
</p>
51 <p class=
"p2"><br></p>
52 <p class=
"p1">FFT uses a local buffer for holding the buffered audio. The buffer size must be a multiple of the control block size as well as being a power of two.
</p>
53 <p class=
"p2"><br></p>
54 <p class=
"p1">Note that for phase-vocoder usage, changing the hop or wintype settings from their defaults will typically result in unnatural sound when used in combination with IFFT, due to windowing artifacts. (A hop of
0.25, with Hann windowing, can be a useful combination for phase-vocoder work.)
</p>
55 <p class=
"p2"><br></p>
56 <p class=
"p4"><span class=
"s2"><b>See also:
</b> <a href=
"FFT Overview.html"><span class=
"s5">FFT Overview
</span></a>,
<a href=
"IFFT.html"><span class=
"s5">IFFT
</span></a>,
<a href=
"PV_Copy.html"><span class=
"s5">PV_Copy
</span></a></span></p>
57 <p class=
"p2"><br></p>
58 <p class=
"p5"><br></p>
59 <p class=
"p5"><br></p>
60 <p class=
"p5"><br></p>
61 <p class=
"p5"><br></p>
62 <p class=
"p5"><br></p>
64 <p class=
"p7"><span class=
"s3">SynthDef
</span><span class=
"s2">(
</span>"help-noopFFT"<span class=
"s2">, {
</span><span class=
"s3">arg
</span><span class=
"s2"> out=
0;
</span></p>
65 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> in, chain;
</p>
66 <p class=
"p6"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">WhiteNoise
</span>.ar(
0.05);
</p>
67 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), in);
</p>
68 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain.inspect;
<span class=
"s6">// its an FFT
</span></p>
69 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
<span class=
"Apple-converted-space"> </span></p>
70 <p class=
"p8"><span class=
"s2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s3">IFFT
</span><span class=
"s2">(chain)
</span>// inverse FFT
</p>
71 <p class=
"p6"><span class=
"Apple-tab-span"> </span>);
</p>
72 <p class=
"p6">}).play;
</p>
74 <p class=
"p5"><br></p>
76 <p class=
"p7"><span class=
"s3">SynthDef
</span><span class=
"s2">(
</span>"help-sineFFT"<span class=
"s2">, {
</span><span class=
"s3">arg
</span><span class=
"s2"> out=
0;
</span></p>
77 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> in, chain;
</p>
78 <p class=
"p6"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">SinOsc
</span>.ar(
<span class=
"s3">SinOsc
</span>.kr(
<span class=
"s3">SinOsc
</span>.kr(
0.08,
0,
6,
6.2).squared,
0,
100,
800));
</p>
79 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), in);
</p>
80 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
<span class=
"s3">IFFT
</span>(chain));
</p>
81 <p class=
"p6">}).play;
</p>
83 <p class=
"p5"><br></p>
85 <p class=
"p7"><span class=
"s3">SynthDef
</span><span class=
"s2">(
</span>"help-magAbove"<span class=
"s2">, {
</span><span class=
"s3">arg
</span><span class=
"s2"> out=
0;
</span></p>
86 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> in, chain;
</p>
87 <p class=
"p6"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">SinOsc
</span>.ar(
<span class=
"s3">SinOsc
</span>.kr(
<span class=
"s3">SinOsc
</span>.kr(
0.08,
0,
6,
6.2).squared,
0,
100,
800));
</p>
88 <p class=
"p8"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>//in = WhiteNoise.ar(
0.2);
</p>
89 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), in);
</p>
90 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">PV_MagAbove
</span>(chain,
310);
<span class=
"Apple-converted-space"> </span></p>
91 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
0.5 *
<span class=
"s3">IFFT
</span>(chain));
</p>
92 <p class=
"p6">}).play;
</p>
94 <p class=
"p5"><br></p>
96 <p class=
"p6"><span class=
"s3">SynthDef
</span>(
<span class=
"s7">"help-brick"</span>, {
<span class=
"s3">arg
</span> out=
0;
</p>
97 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> in, chain;
</p>
98 <p class=
"p6"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">WhiteNoise
</span>.ar(
0.2);
</p>
99 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), in);
</p>
100 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">PV_BrickWall
</span>(chain,
<span class=
"s3">SinOsc
</span>.kr(
0.1));
<span class=
"Apple-converted-space"> </span></p>
101 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
<span class=
"s3">IFFT
</span>(chain));
</p>
102 <p class=
"p6">}).play;
</p>
104 <p class=
"p5"><br></p>
106 <p class=
"p7"><span class=
"s3">SynthDef
</span><span class=
"s2">(
</span>"help-randcomb"<span class=
"s2">, {
</span><span class=
"s3">arg
</span><span class=
"s2"> out=
0;
</span></p>
107 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> in, chain;
</p>
108 <p class=
"p6"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">WhiteNoise
</span>.ar(
0.8);
</p>
109 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), in);
</p>
110 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">PV_RandComb
</span>(chain,
0.95,
<span class=
"s3">Impulse
</span>.kr(
0.4));
<span class=
"Apple-converted-space"> </span></p>
111 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
<span class=
"s3">IFFT
</span>(chain));
</p>
112 <p class=
"p6">}).play;
</p>
114 <p class=
"p5"><br></p>
116 <p class=
"p7"><span class=
"s3">SynthDef
</span><span class=
"s2">(
</span>"help-rectcomb"<span class=
"s2">, {
</span><span class=
"s3">arg
</span><span class=
"s2"> out=
0;
</span></p>
117 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> in, chain;
</p>
118 <p class=
"p6"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">WhiteNoise
</span>.ar(
0.2);
</p>
119 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), in);
</p>
120 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">PV_RectComb
</span>(chain,
8,
<span class=
"s3">LFTri
</span>.kr(
0.097,
0,
0.4,
0.5),
<span class=
"Apple-converted-space"> </span></p>
121 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">LFTri
</span>.kr(
0.24,
0,-
0.5,
0.5));
<span class=
"Apple-converted-space"> </span></p>
122 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
<span class=
"s3">IFFT
</span>(chain));
</p>
123 <p class=
"p6">}).play;
</p>
125 <p class=
"p5"><br></p>
127 <p class=
"p7"><span class=
"s3">SynthDef
</span><span class=
"s2">(
</span>"help-magFreeze"<span class=
"s2">, {
</span><span class=
"s3">arg
</span><span class=
"s2"> out=
0;
</span></p>
128 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> in, chain;
</p>
129 <p class=
"p6"><span class=
"Apple-tab-span"> </span>in =
<span class=
"s3">SinOsc
</span>.ar(
<span class=
"s3">LFNoise1
</span>.kr(
5.2,
250,
400));
</p>
130 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), in);
</p>
131 <p class=
"p8"><span class=
"s2"><span class=
"Apple-tab-span"> </span></span>// moves in and out of freeze
</p>
132 <p class=
"p6"><span class=
"Apple-tab-span"> </span>chain =
<span class=
"s3">PV_MagFreeze
</span>(chain,
<span class=
"s3">SinOsc
</span>.kr(-
0.2) );
<span class=
"Apple-converted-space"> </span></p>
133 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"s3">Out
</span>.ar(out,
0.5 *
<span class=
"s3">IFFT
</span>(chain));
</p>
134 <p class=
"p6">}).play;
</p>