If you're like me, then you're constantly looking for people to bounce ideas off of, show your work to, and co-work with. So I've started a co-working/project night on MIT's campus (called 'Your Regularly Scheduled Programming') to facilitate people getting together and working on projects. We meet every Monday night from 7pm-9pm on MIT's campus in Room 4-144 (
http://bit.ly/RiqDZn ). We've got a big conference table, a projector (for people working on visual projects or who just want to make it easier to show their work), and blackboards; all we need are PEOPLE. Hopefully, you can provide that last part :)
Feel free to contact me for more information about the space (or just post a question and i'll get back ASAP)!
ellipse(width/2 + fft.getAvg(w)*50, height/2 + fft.getAvg(i)*50, i, i);
ellipse(width/2 + fft.getAvg(w)*50, height/2 - fft.getAvg(i)*50, i, i);
ellipse(width/2 - fft.getAvg(w)*50, height/2 + fft.getAvg(i)*50, i, i);
ellipse(width/2 - fft.getAvg(w)*50, height/2 - fft.getAvg(i)*50, i, i);
}
}
void stop(){
input.close();
minim.stop();
super.stop();
}
It looks pretty neat, but I wanted to be able to put multiple visualizations into a single file and be able to switch between them without closing the window. I figured the best way to do this would be with classes, so I tried to turn this sketch into a class:
import ddf.minim.analysis.*;
import ddf.minim.*;
import processing.video.*;
Minim minim;
AudioInput input;
FFT fft;
DualCircles circ;
void setup() {
size(1024, 640);
smooth();
background(0);
minim = new Minim(this);
input = minim.getLineIn(Minim.STEREO, 512);
fft = new FFT(input.bufferSize(), input.sampleRate());
fft.linAverages(64);
rectMode(CORNERS);
DualCircles circ = new DualCircles(color(25,25,25),75);
}
void draw() {
fill(0, 16);
rect(0, 0, width, height);
noFill();
//move the FFT forward
fft.forward(input.mix);
//pass the updated FFT to draw() to update the sketch
The sketch that I'm working on should produce a shape essentially random-walking from the center of the page; however, it doesn't seem to walk from the center of the page.
My original code is below. At first I thought that init_x and init_y needed to be defined after I set a size (so width and height were meaningful), but then draw() doesn't recognize init_x or init_y.
So I need to find a way to make the variable settings in setup() global, or perhaps there is another problem with this?
for (int dy = -(matrixSize - 1) / 2; dy <= (matrixSize - 1) / 2; dy++) {
//snag the location of the pixel
int loc = (x+dx) + (y+dy)*img.width;
// Pick a parameter of the pixel
float redVal = red(img.pixels[loc]);
float greenVal = green(img.pixels[loc]);
float blueVal = blue(img.pixels[loc]);
// Multiply adjacent pixels based on the kernel values
redSum += matrix[dy+1][dx+1]*redVal;
greenSum += matrixl[dy+1][dx+1]*greenVal;
blueSum += matrix[dy+1][dx+1]*blueVal;
return color(redSum,greenSum,blueSum);
}
}
}
but i keep getting the error 'the field Component.x is not visible', with line 39 highlighted. I thought that perhaps the image ('target') attributes weren't properly getting passed on to the blur function. However, I tried another simple example:
//-----------------Globals
PImage target;
int rad = 10;
//-----------------Setup
void setup() {
size(1024,683);
target = loadImage("data/leaf.jpg");
target.loadPixels();
int randomX = int(random(target.width));
int randomY = int(random(target.height));
int loc = x + y*target.width;
float r = red(target.pixels[loc]);
float g = green(target.pixels[loc]);
float b = blue(target.pixels[loc]);
noStroke();
fill(r,g,b,100);
ellipse(randomX,randomY,rad,rad);
//save("leaf_blur.png");
and get the EXACT same error, but this time line 14 is highlighted (coincidentally, or perhaps not, both times it is the 'int loc = ' line). There's no functions here, so it shouldn't be a problem with the function inheriting the proper attributes.