import pitaru.sonia_v2_9.*; int num = 25; BounceBall[] p = new BounceBall[num]; float radius = 10; float h = 0; float vh = .25; float meterData; void setup() { Sonia.start(this); // Start Sonia engine. LiveInput.start(256); // Start LiveInput and return 256 FFT frequency bands. colorMode(HSB, 255); size(720, 480); noStroke(); smooth(); for (int i = 0; i < p.length; i++) { //velocity levels float velX = random(2, 10); float velY = random(2, 10); if(random (0,10) >= 5) { velX = -velX; } if(random (0,10) >= 5) { velY = -velY; } p[i] = new BounceBall(width/2, height/2, velX, velY, radius); } } void draw() { meterData = LiveInput.getLevel(); color c1 = color(0, 0, 0); fill (c1); rect (0, 0, width, height); fill(150, h, 255); for (int i = 0; i < p.length; i++) { p[i].vx += meterData*random(10); p[i].vy -= meterData*random(10); p[i].update(); p[i].display(); } h+= vh; if(h >= 255 || h<= 0){ vh = -vh; } } public void stop(){ Sonia.stop(); super.stop(); }