//import ESS library import krister.Ess.*; //create an array of Students class Students [] stu= new Students[16]; //ESS variables int bufferSize; int steps; float limitDiff; int numAverages=32; float myDamp=.1f; float maxLimit,minLimit; FFT myFFT; AudioInput myInput; void setup(){ //fullscreen //size(screen.width,screen.height); size(350,200); //ESS setup // start up Ess Ess.start(this); // set up our AudioInput bufferSize=512; myInput=new AudioInput(bufferSize); // set up our FFT myFFT=new FFT(bufferSize*2); myFFT.equalizer(true); // set up our FFT normalization/dampening minLimit=.005; maxLimit=.05; myFFT.limits(minLimit,maxLimit); myFFT.damp(myDamp); myFFT.averages(numAverages); // get the number of bins per average steps=bufferSize/numAverages; // get the distance of travel between minimum and maximum limits limitDiff=maxLimit-minLimit; myInput.start(); //consctruct Students (height, weight, intel, sexiness, x, sex) stu[0]=new Students(60,57,1,100,0,0); stu[1]=new Students(58,45,2,150,0,1); stu[2]=new Students(60,42,3,100,0,1); stu[3]=new Students(57,40,4,200,0,1); stu[4]=new Students(58,70,1,100,0,0); stu[5]=new Students(61,92,3,800,0,0); stu[6]=new Students(62,91,PI,400,0,0); stu[7]=new Students(55,40,5,200,0,0); stu[8]=new Students(59,100,random(1,10),100,0,0); stu[9]=new Students(54,20,1,1,0,1); stu[10]=new Students(59,50,2.5,500,0,0); stu[11]=new Students(54,20,PI,200,0,1); stu[12]=new Students(58,60,3,250,0,0); stu[13]=new Students(54,48,3,300,0,1); stu[14]=new Students(10,101,PI/2,200,0,0); stu[15]=new Students(59,40,PI,100,0,0); //calcuate x for each Student for(int i=0;i<16;i++){ stu[i].x=map(i,0,16,0,width); } } void draw(){ //background(255); //transparent overlay fill(255,20); //rectangle 0,0 at corner rectMode(CORNER); rect(0,0,width,height); for(int i=0;i<16;i++){ stu[i].appearance(); //for each Student use myFFT.averages[16] as (jig) parameter stu[i].performance(myFFT.averages[16]*200); } } class Students { float sHeight; float sWeight; float sIntel; float sSexiness; float x; float sex; float jiggle; Students (float h,float w, float i, float ss, float x, float s){ sHeight=h; sWeight=w; sIntel=i; sSexiness=ss; x=x; sex=s; } void appearance(){ pushMatrix(); //translate to x, half the height of the screen - sIntel translate(x,height/2-sIntel); rotate(sSexiness*sIntel+jiggle); fill(sSexiness,0,255-sSexiness,50); //rectangle 0,0 at center rectMode(CENTER); rect(0,0,sWeight, sHeight); popMatrix(); } void performance(float jig){ //rotate rectangle jiggle=random(radians(1), radians(jig)); } } public void audioInputData(AudioInput theInput) { myFFT.getSpectrum(myInput); }