Friday, August 29, 2008

CC3 Week 5 - FFT I


This week I created a GUI on some code that was generating FFT on white noise. Using the examples we went through in class, I used a slider to control the X-Y co-ordinates instead of the mouse.

I was exploring the GUI examples more thoroughly and found a slider that controlled the window colour. I used the same concept and made the slider change the colour of the slider itself.




Click here for an audio example of my patch. [1.7MB]




b = Buffer.alloc(s,2048,1);

(

SynthDef("help-rectcomb2", { arg out=0, bufnum=0, x=0, y=0;
var in, chain;
in = WhiteNoise.ar(0.2);
chain = FFT(bufnum, in);
chain = PV_RectComb(chain, x, y, 0.2);
Out.ar(out, IFFT(chain).dup);
}).send(s);
x = Synth("help-rectcomb2");


w = SCWindow("Filter", Rect(100, 500, 400, 400))
.front;
w.view.background_(Color.black);
w.alpha = 0.8;


p = SC2DSlider(w, Rect(20, 20,350, 350))
.x_(0.5) // initial location of x
.y_(1) // initial location of y
.action_({p.background = (Color.new(p.x, p.y, 200, 1));
x.set(\x, p.x*32);
x.set(\y, p.y);
// [\sliderX, p.x, \sliderY, p.y].postln;
});
//w.front;

);




[1] Christian Haines. "Creative Computing: Semester 2 - Week 5 - FFT I". Lecture presented at the Electronic Music Unit, University of Adelaide, South Australia, 28th August 2008

No comments: