Face and microphone

var eyeSize; var eyeHeight=20; /*var means variable, by default is zero. The names are chosen by me*/ var input; var analyzer; var eyeColor; //input and analyzer are names to work with sounds function setup() { //these are the settings createCanvas(1800,1200); // Canvas is the area to draw (width,height) in pixels // Create an Audio input mic = new p5.AudioIn(); // start the Audio Input. // By default, it does not .connect() (to the computer speakers) mic.start(); } function draw() { frameRate(5); eyeColor=random(255); eyeSize=random(20,50); //random value from zero to 255 background(39,47,239) //this is a blue background var vol = mic.getLevel(); var h = map(vol, 0, 1, 20, 80); if (mouseIsPressed) { //mouseX=300,mouseY=200 fill(255,0,0); //Red for the face ellipse (mouseX,mouseY,200,200); //Face fill(0,255,0); ellipse(mouseX-30,mouseY-50,30,eyeHeight); // Right eye fill(eyeColor,127-eyeColor,0); ellipse(mouseX+30,mouseY-50,30,20); //Left eye fill(0,0,255); ellipse(mouseX,mouseY+40,100,h); //Mouth } else { //mouseX=300,mouseY=200 fill(230,60-h*4,182); ellipse (mouseX,mouseY,200+h,200+h); fill(0,255,0); ellipse(mouseX-30,mouseY-50,30,eyeHeight); ellipse(mouseX+30,mouseY-50,eyeSize,eyeSize); fill(0,0,255); arc(mouseX,mouseY+40,100,h,0,PI); //Mouth } eyeHeight=eyeHeight-15; if (eyeHeight<0) { eyeHeight=20; } }

The best way to predict the future is to invent it (Alan Kay)