/* Sean's circle tracking extravaganza! it's the winningest! * In this program, the user can click anywhere on * screen and a ball of random color and size will * appear on the screen! when the user moves the * mouse around, the balls will move with some * random correlation to the mouse movement * */ //import processing.opengl.*; import ddf.minim.signals.*; import ddf.minim.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; //number of circles int numCircs = 30; //circle array circle[] circArray = new circle[numCircs]; //initialize audio thingies Minim minim; AudioPlayer song; BeatDetect beat; BeatListener bl; float kickSize, snareSize, hatSize; void setup() { //initialize all the circles for(int i = 0; i < numCircs; i++) { circArray[i] = new circle(); } minim = new Minim(this); size(1024,768); background(0); fill(random(255),random(255),random(255)); noStroke(); song = minim.loadFile("intotrees", 2048); song.play(); beat = new BeatDetect(song.bufferSize(), song.sampleRate()); beat.setSensitivity(30); kickSize = snareSize = hatSize = 16; bl = new BeatListener(beat, song); //you can adjust the frame rate if you want O_O_O_O //frameRate(100); } void draw() { if ( beat.isKick() ) kickSize = 32; if ( beat.isSnare() ) snareSize = 32; if ( beat.isHat() ) hatSize = 255; kickSize = constrain(kickSize * 0.95, 16, 32); snareSize = constrain(snareSize * 0.95, 16, 32); hatSize = constrain(hatSize * 0.95, 16, 255); translate(1024/2, 768/2); background(0); for (int i = 0; i0 ; i--) { circArray[i]=circArray[i-1]; } circArray[0] = new circle(mouseX-1024/2, mouseY-768/2, random(10,45), random(-2,2), random(-2,2), int(random(10,80))); } class circle { float[] xPos; float[] yPos; float[] theKick; float[] theSnare; float[] theHat; float radius; float factorX; float factorY; int numTrail; int trackme = 0; float c1 = random(255); float c2 = random(255); float c3 = random(255); circle() { numTrail = 1; xPos = new float[numTrail]; yPos = new float[numTrail]; theKick = new float[numTrail]; theSnare = new float[numTrail]; theHat = new float[numTrail]; for(int i = 0; i