import krister.Ess.*; import processing.opengl.*; Channel myChannel1; Channel myChannel2; Channel myChannel3; Channel myChannel4; PImage backGroundImage; PImage plantImage; int sonicPlant1X = 50; int sonicPlant1Y = 50; void setup() { size(800, 600, OPENGL); noStroke(); framerate(50); colorMode(HSB, 100); //smooth(); backGroundImage = loadImage("floor2.jpg"); plantImage = loadImage("plant.jpg"); // start up Ess Ess.start(this); // create a new Channel myChannel1=new Channel(); myChannel2=new Channel(); myChannel3=new Channel(); myChannel4=new Channel(); myChannel1.initBuffer(myChannel1.frames(5000)); myChannel2.initBuffer(myChannel2.frames(5000)); myChannel3.initBuffer(myChannel3.frames(5000)); myChannel4.initBuffer(myChannel4.frames(5000)); // generate 3 seconds of soft pink noise //~ myChannel.noise(Ess.PINK,.9,0,myChannel.frames(2)); //~ myChannel.wave(Ess.TRIANGLE,480,.1,0,myChannel.frames(3000)); // play //~ myChannel.play(); } void draw() { image(backGroundImage, 0, 0); //~ drawPlants(); sonicPlant(); } void drawPlants() { for (int i=0; i<12; i++){ pushMatrix(); rotate(random(4) * PI/2.0); image(plantImage, random(500), random(300), 80, 80); popMatrix(); } } void sonicPlant(){ // make click if (frameCount % 4 == 0) { myChannel1.wave(Ess.TRIANGLE,2000 + random(2000),.9,0,myChannel1.frames(5)); //~ myChannel1.reverb(0.3, 1, 0.5, 0.5, 0.5); myChannel1.play(); } else if (frameCount % 4 == 1) { myChannel2.wave(Ess.TRIANGLE,2000 + random(2000),.9,0,myChannel2.frames(5)); //~ myChannel2.reverb(0.3, 1, 0.5, 0.5, 0.5); myChannel2.play(); } else if (frameCount % 4 == 2) { myChannel3.wave(Ess.TRIANGLE,2000 + random(2000),.9,0,myChannel3.frames(5)); //~ myChannel3.reverb(0.3, 1, 0.5, 0.5, 0.5); myChannel3.play(); } else if (frameCount % 4 == 3) { myChannel4.wave(Ess.TRIANGLE,2000 + random(2000),.9,0,myChannel4.frames(5)); //~ myChannel4.reverb(0.3, 1, 0.5, 0.5, 0.5); myChannel4.play(); } for (int k=0; k<3; k++){ for (int j=0; j<4; j++){ float direction = radians(random(30) + 30 + frameCount * 3 + (k + j) * 10); for (int i=0; i < 50 + random(1000); i++){ noStroke(); fill(0, 0, 100, 3); ellipse(sonicPlant1X + (j * 160) + random(30) + i * sin(direction), sonicPlant1Y + random(30) + i * sin(direction) + (k * 140), 10 + i, 10 + i); if (i % 15 == 0) { stroke(50, 50, random(100), 40); noFill(); ellipse(sonicPlant1X + (j * 160) + 50 + random(30) + i * sin(direction), sonicPlant1Y + 50 + random(30) + i * sin(direction) + (k * 140), 3 * i, 3 * i); } } } } } public void stop() { Ess.stop(); super.stop(); } // user input void keyReleased() { if (key =='s'){ saveFrame(); } }