import krister.Ess.*; AudioChannel myChannel; FFT myFFT; float vol; int bufferSize; int bufferDuration; void setup() { size(400, 400); // start up Ess Ess.start(this); myChannel=new AudioChannel("levan.mp3"); bufferSize=myChannel.buffer.length; bufferDuration=myChannel.ms(bufferSize); myFFT=new FFT(512); frameRate(30); background(0); noSmooth(); } void draw() { //background(0,0,255); fill(0,20); rect(0, 0, width, height); fill(255); drawSpectrum(); //drawSamples(); } void drawSpectrum() { noStroke(); vol = 0; myFFT.getSpectrum(myChannel); for (int i=0; i<256; i++) { float temp=max(0,185-myFFT.spectrum[i]*175); //rect(i,temp+.5,1,height-temp+.5); //ellipse(i, 0, (185/temp)*40, (185/temp)*40); vol+=myFFT.spectrum[i]; } if (vol <= 0.2) { //fill (240, 68, 223); fill (46, 170, 66); } else if(vol <= 0.6) { //fill (240, 231, 65); fill (250, 68, 156); } else if(vol <= 1.0) { //fill(65, 212, 240); fill (23, 178, 203); } else if(vol <= 2.0) { //fill(65, 240, 93); fill (162, 255, 239); } else{ fill(54, 204+(vol*10),232); } ellipse(random(width), random(height), vol*50, vol*50); } void drawSamples() { stroke(255); // interpolate between 0 and writeSamplesSize over writeUpdateTime int interp=(int)max(0,(((millis()-myChannel.bufferStartTime)/(float)bufferDuration)*bufferSize)); for (int i=0;i<256;i++) { float left=100; float right=100; if (i+interp+1