xxxxxxxxxx
var mySound, ball, ball2, ball3, amplitude,mic;
function preload() {
soundFormats('mp3', 'ogg');
// mySound = loadSound('bensound-jazzfrenchy.mp3');
ball = loadImage('ball.png');
ball2 = loadImage('bauble.png');
ball3 = loadImage('bauble2.png');
}
function setup() {
createCanvas(800,400);
// amplitude = new p5.Amplitude();
mic = new p5.AudioIn();
mic.start();
background(0);
noFill();
stroke(255);
line(100,0,100,200);
line(200,0,200,100);
line(300,0,300,100);
// mySound.play();
}
function draw() {
background(0);
var level = mic.getLevel();
var size = map(level, 0, 1, 200, 2000);
ball.resize(size,size);
ball2.resize(size,size);
ball3.resize(size,size);
imageMode(CENTER);
image(ball, 100, 300);
image(ball2,200, 200);
image(ball3,300,200);
// ellipse(mouseX, mouseY, 20, 20);
}