pianoc = loadSound("pianoc.wav");
pianod = loadSound("pianod.wav");
pianoe = loadSound("pianoe.wav");
pianof = loadSound("pianof.wav");
pianog = loadSound("pianog.wav");
pianoa = loadSound("pianoa.wav");
pianob = loadSound("pianob.wav");
rect(0, height - height/6, width, height)
text("TOUCH anywhere to add a ball", 500, 1400);
text("TALK gently to increase the gravity", 500, 1480);
text("TALK loudly to decrease the gravity", 500, 1560);
text("Reset", width/2 - 20, height - height/12, 50);
balls = subset(balls, 1, 8);}
for (n = 0; n < balls.length; n++) {
function mouseClicked() {
if (n < 8 && mouseY < height - 50){
append(balls, new Ball(mouseX, mouseY));
if (mouseX > 0 && mouseY > height- height/6){
balls = subset(balls, 8, 8);
this.update = function(){
var vol = mic.getLevel();
var d = map(vol, 0, 1, 0, 1);
if (this.x > 0 && this.x < width/8 && this.y == height){
if (this.x > width/8 && this.x < (width/8 * 2) && this.y == height){
if (this.x > (width/8 * 2) && this.x < (width/8 * 3) && this.y == height){
if (this.x > (width/8 * 3) && this.x < (width/8 * 4) && this.y == height){
if (this.x > (width/8 * 4) && this.x < (width/8 * 5) && this.y == height){
if (this.x > (width/8 * 5) && this.x < (width/8 * 6) && this.y == height){
if (this.x > (width/8 * 6) && this.x < (width/8 * 7) && this.y == height){
if (this.x > (width/8 * 7) && this.x < width && this.y == height){
this.display = function() {
ellipse(this.x, this.y, width/12, width/12);