Hi,
I'm new on processing and I'm starting to create a simple sketch using ESS to make a cube react with the sound (see the code below).
Now the question is, how can I apply that Blur filter to just the drawCube() function instead of the whole sketch?
Because the rect's are being affected with the BLUR too.
Quote:
import krister.Ess.*;
import processing.opengl.*;
import javax.media.opengl.*;
// start
FFT fft;
AudioInput in;
int bufferSize;
float [] zoneFill;
int beat;
void setup(){
size(532, 230, OPENGL);
Ess.start(this);
bufferSize = 1024;
in = new AudioInput(bufferSize);
fft = new FFT(bufferSize);
fft.equalizer(true);
in.start();
// set up our FFT normalization/dampening
float minLimit=.005;
float maxLimit=.05;
float myDamp=.1f;
int numAverages=32;
fft.limits(minLimit,maxLimit);
fft.damp(myDamp);
fft.averages(numAverages);
zoneFill = new float[]{
255.0, 255.0, 255.0 };
noStroke();
}
// Maximum fft 1.0
// Minimum fft 0.0
// After init to Ess FFT demo that is
void draw(){
background(242, 240, 174);
noStroke();
fill(color(131,104,81), 50);
for(int i=0; i<bufferSize/2; i++) {
rect(10+i,10,1,fft.spectrum[i]*200);
}
stroke(0);
// pushMatrix();
drawCube();
// popMatrix();
}
public void drawCube() {
print((10*fft.getLevel(in)) + "\n");
translate(250, 100, 3);
rotateZ(radians(frameCount)+(1*fft.getLevel(in)));
rotateX(radians(frameCount)+(1*fft.getLevel(in)));
fill(color(100, 100, 100));
box(35+(50*fft.getLevel(in)));
// filter(BLUR, 2);
}
public void audioInputData(AudioInput theInput) {
fft.getSpectrum(in);
}
public void stop() {
Ess.stop();
super.stop();
}