// camera obscura by andres burbano // code based on "Listening to Images" workshop by Daniel Sauter - AUDO2008, Purdue. // import video library import processing.video.*; //import supercollider lybrary import supercollider.*; // scanner is a line to scann the video int scanner = 0; // stroke color color strokeCol = color(10); // camera variable Capture cam; // Synthetizer Synth synth; void setup() { size(800, 500); background(0); stroke(255); // New Camera Capture cam = new Capture(this,width, height); // New Synth and first parameters synth = new Synth("sine"); synth.set("amp", 0.5); synth.set("freq", 40); synth.create(); } void draw() { // line stroke(100); line(scanner-1, 0, scanner-1, height); stroke(255); line(scanner, 0, scanner, height); stroke(strokeCol); // run the camera and load it if (cam.available() == true){ cam.read(); set(0,0,cam); } // scanner increment scanner = scanner + 10; // loadpixels to check the values loadPixels(); for (int i=height-1; i>0; i--) { // Condition t create a loop if (scanner >= width) { scanner = 0; synth.set("val1", ((height/2)-i)/6); synth.set("val2", ((height/2)-i)/20); synth.set("val3", 0); } float var = pixels[(scanner)+i*(width)]; if (var == color(30)) { // checking pixels grey 30 synth.set("val1", ((height/2)-i)*2); } if (var == color(70)) { // checking pixels grey 70 synth.set("val2", ((height/2)-i)/20); synth.set("val1", ((height/2)-i)); } if (var == color(250)) { // // checking pixels white synth.set("val3", ((height/2)-i)); } } }