Professional Documents
Culture Documents
12.1 FFT
12.1 FFT
Also see:
FFT Overview
FFT
input -> FFT -> PV_UGen1 ... PV_UGenN... -> IFFT -> output
See the code examples below for how this 'chain' looks in actual SC code form
s = Server.local.boot;
b = Buffer.alloc(s,1024,1); //a buffer must be allocated which gives the size of
the FFT; 1024 sample window size in this case. The hop size is half the window by
default.
(
{ var in, chain;
in = WhiteNoise.ar(0.8);
chain = FFT(b, in); //go from time domain to frequency domain; note that
the UGen does not appear to run at a conventional rate (no .ar or .kr); in actual
fact, FFT and PV_UGens are at control rate, but only calculate when there is data
to act on; IFFT is at audio rate to produce output samples
b = Buffer.alloc(s,1024,1);
(
{ var in, chain;
in = WhiteNoise.ar(0.8);
Pan2.ar(IFFT(chain),0.0)
}.play(s);
)
(
b = Buffer.alloc(s,1024,1);
c = Buffer.alloc(s,1024,1);
d = Buffer.alloc(s,1024,1); //buffer for a copy of spectral data
)
(
{ var in1, in2, chain1, chain2, copychain;
in1 = Saw.ar(440,0.8);
in2 = SoundIn.ar(0);
[0.25*IFFT(chain1),IFFT(copychain)]
}.play(s);
)
(
b.free; //frees the resource
c.free;
d.free;
)
See pvcollect
(
b = Buffer.alloc(s,1024,1);
c = Buffer.read(s,if(Main.versionAtLeast(3,5),{Platform.resourceDir +/+
"sounds/a11wlk01.wav"},{"sounds/a11wlk01.wav"}));
)
(
{ var in, chain;
in = PlayBuf.ar(1,c,BufRateScale.kr(c),loop:1);
noise= LFNoise1.kr(rrand(0.5,1.1));
[noise*mag,noise.range(-pi,pi)]
},
frombin:0, tobin:250,zeroothers:1);
Pan2.ar(IFFT(chain),0.0)
}.play(s);
)
(
b.free; //frees the resource
c.free;
)
Non-realtime analysis using LORIS, SPEAR and ATS, and real-time resynthesis: work
by Scott Wilson and Josh Parmenter.