import processing.sound.*;
Amplitude amp;
AudioIn in;
PImage photo, maskImage;
void setup() {
size(600, 400);
background(255);
// Create an Input stream which is routed into the Amplitude analyzer
amp = new Amplitude(this);
in = new AudioIn(this, 0);
in.start();
amp.input(in);
strokeWeight(2);
//background(20,40,70);
background(0);
ellipse(width*.5, height*.9, 50+amp.analyze()*1000, 10+amp.analyze()*800);
background(20,40,70);
//saveFrame();
}
void draw() {
background(20,40,70);
println(amp.analyze()1000);
float a = amp.analyze()500;
translate(width.5, height.5);
fill(60,110,130);
//stroke(120,220,255);
beginShape();
curveVertex(0, 120);
curveVertex(0, 180);
curveVertex(-140, 120);
curveVertex(-255, -95); // top corner
curveVertex(-250, -100); // top corner
curveVertex(-185, -50);
curveVertex(-165, -45);
curveVertex(-40, -50);
curveVertex(40, -50);
curveVertex(165, -45);
curveVertex(185, -50);
curveVertex(250, -100); // top corner
curveVertex(255, -95); // top corner
curveVertex(140, 120);
curveVertex(0, 180);
curveVertex(0, 120);
endShape();
fill(120,220,255);
beginShape();
vertex(-290, -155-a);
vertex(-290, -105-a);
vertex(-150, 80-a);//tooth 1
vertex(-120, 20-a);
vertex(-75, 105-a);//tooth 2
vertex(-40, 25-a);
vertex(0, 110-a);//tooth 3
vertex(40, 25-a);
vertex(75, 105-a);//tooth 4
vertex(120, 20-a);
vertex(150, 80-a);//tooth 5
vertex(290, -105-a);
vertex(290, -155-a);
endShape();
beginShape();
vertex(-290, 200+a);
vertex(-290, -105+a);
vertex(-150, 80+a);//tooth 1
vertex(-120, 20+a);
vertex(-75, 105+a);//tooth 2
vertex(-40, 25+a);
vertex(0, 110+a);//tooth 3
vertex(40, 25+a);
vertex(75, 105+a);//tooth 4
vertex(120, 20+a);
vertex(150, 80+a);//tooth 5
vertex(290, -105+a);
vertex(290, 200+a);
endShape();
saveFrame(“mouth.png”);
photo = loadImage(“mouth.png”);
background(0);
fill(255);
stroke(255);
beginShape();
curveVertex(0, 120);
curveVertex(0, 180);
curveVertex(-140, 120);
curveVertex(-255, -95); // top corner
curveVertex(-250, -100); // top corner
curveVertex(-185, -50);
curveVertex(-165, -45);
curveVertex(-40, -50);
curveVertex(40, -50);
curveVertex(165, -45);
curveVertex(185, -50);
curveVertex(250, -100); // top corner
curveVertex(255, -95); // top corner
curveVertex(140, 120);
curveVertex(0, 180);
curveVertex(0, 120);
endShape();
saveFrame(“mask.png”);
maskImage = loadImage(“mask.png”);
background(0,0,50);
translate(-width*.5, -height*.5);
photo.mask(maskImage);
image(photo, 0, 0);
}
I’m currently constantly saving two photos every time draw runs, if someone knows how to just take what’s on screen and load that as an image without having to save it as a file i think that would fix my problems, but I just don’t know how.