import pitaru.sonia_v2_9.*; import processing.video.*; Capture myCapture; //initialize capture variable. PImage img1; import pitaru.sonia_v2_9.*; //sonia setting. float increment = 0.0f; Sample sounds[]; int numSounds=10; int i; int c; int c2; int num = 10; Spring[] springs = new Spring[num]; void setup() { size(320, 280); String s = "IIDC Firewire Video";//my webcam myCapture = new Capture(this, s, width, height, 30); Sonia.start(this); //start sonia. sounds=new Sample[numSounds]; LiveInput.start(); noStroke(); smooth(); springs[0] = new Spring( 80, 60, 80, 0.94, 8.0, 0.2, springs, 0); springs[1] = new Spring( 120, 40, 70, 0.94, 7.9, 0.3, springs, 1); springs[2] = new Spring( 158, 40, 75, 0.94, 7.9, 0.4, springs, 2); springs[3] = new Spring( 200, 40, 75, 0.94, 7.9, 0.2, springs, 3); springs[4] = new Spring( 260, 60, 80, 0.94, 7.9, 0.3, springs, 4); springs[5] = new Spring( 210, 95, 75, 0.94, 7.9, 0.4, springs, 5); springs[6] = new Spring( 145, 95, 75, 0.94, 7.9, 0.4, springs, 6); springs[7] = new Spring( 110, 110, 70, 0.94, 7.9, 0.3, springs, 7); springs[8] = new Spring( 260, 110, 60, 0.94, 7.9, 0.2, springs, 8); springs[9] = new Spring( 60, 110, 60, 0.94, 7.9, 0.3, springs, 9); framerate(30); } void captureEvent(Capture myCapture) { myCapture.read(); //read the image from Cam. } void draw() { background(0); float meterData = LiveInput.getLevel(); //sonia. println(increment); println(i); increment = (float)meterData * 500; //get and increment the value of input sound. //rectMode(CENTER); c = constrain (int(increment), 0, 255); c2 = constrain (int(increment), 0, 128); //change the float to int also set the range between 0 -> 255. image(myCapture, 0, 0); //display current image. if (mousePressed) { //take a snap shot when mouse pressed. img1 = myCapture; //declare img1 = myCapture. img1.copy(myCapture, 0, 0, width, height, 0, 0, width, height); //copy myCapture from position a to b. image(img1,0,0); //place the snapshot to (0, 0). myCapture.stop(); //stop the Capture. } if (keyPressed){ //this function doesn't work, I can't take the second shot! if (keyCode == SHIFT) { myCapture.read(); myCapture.updatePixels(); } } for(int i=0; i