/**
*
* Project 3 Template
* UCLA Design Media Arts, Spring 2011
* Prof. Casey Reas
*
* Based on code from Lorenzo Bravi:
* http://www.lorenzobravi.com/projects/workshop-isia/
*/
PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage img7;
PImage img8;
PImage img9;
PImage img10;
PImage img11;
float v;
float easing = .8; // Between 0 and 1
float volumeScalar = 2000;
boolean noMic = true;
void setup() {
size(500, 500);
smooth();
setupVolume();
img1 = loadImage("baby.png");
img2 = loadImage("eyes.png");
img3 = loadImage("eyes2.png");
img4 = loadImage("nose.png");
img5 = loadImage("eh.png");
img6 = loadImage("eh2.png");
img7 = loadImage("nostril.png");
img8 = loadImage("nostril2.png");
img9 = loadImage("tooth.png");
img10 = loadImage("blood.png");
img11 = loadImage("blood2.png");
}
void draw() {
background(255);
getVolume();
if (noMic == true) {
v = map(mouseX, 0, width, 0, 1000);
}
testFace();
//saveFrame("mask-####.png");
}
void testFace() {
background(115+v/2, 185-v/5, 255-v/5);
translate(250, 250);
// Viso
imageMode (CENTER);
image(img1, 0, 0, 500+v/5, 500+v/5);
// Occhi 1
pushMatrix();
smooth();
image(img2, 0, 0, 425+v/3, 425+v/3);
tint(255, 255-v/10, 255-v/10, v/4);
image(img10, 0, 0, 425+v/3, 425+v/3);
noTint();
popMatrix();
// Occhi 2
pushMatrix();
smooth();
// fill(0, 0, 0);
image(img3, 0, 0, 425+v/3, 425+v/3);
tint(255, 255-v/10, 255-v/10, v/4);
image(img11, 0, 0, 425+v/3, 425+v/3);
noTint();
popMatrix();
// Pupil
pushMatrix();
smooth();
image(img5, 0, 0, 425+v/2, 425+v/2);
popMatrix();
// Pupil 2
pushMatrix();
smooth();
image(img6, 0, 0, 425+v/2, 425+v/2);
popMatrix();
// Nariz
pushMatrix();
smooth();
image(img4, 0, 0-v/30, 500+v/53, 500+v/4);
popMatrix();
// Nostril
pushMatrix();
smooth();
image(img7, 0, 0-v/30, 500+v/4, 500+v/4);
popMatrix();
// Nostril2
pushMatrix();
smooth();
image(img8, 0, 0-v/30, 500+v/4, 500+v/4);
popMatrix();
// Bocca
pushMatrix();
translate(-250, -250);
fill(244,217,225);
stroke(0);
strokeWeight(1.5);
beginShape();
curveVertex(246, 302-v/15);
curveVertex(277, 302-v/15);
curveVertex(308, 304-v/15);
curveVertex(335+v/15, 306-v/15);
curveVertex(343+v/15, 327-v/15);
curveVertex(338+v/15, 343+v/15);
curveVertex(305, 346+v/15);
curveVertex(274, 349+v/15);
curveVertex(247, 349+v/15);
curveVertex(218, 349+v/15);
curveVertex(185-v/15, 345+v/15);
curveVertex(155-v/15, 346-v/15);
curveVertex(150-v/15, 325-v/15);
curveVertex(158-v/15, 307-v/15);
curveVertex(186, 304-v/15);
curveVertex(215, 304-v/15);
endShape(CLOSE);
popMatrix();
// Tooth
pushMatrix();
smooth();
image(img9, 25, -20-v/15, 500, 500);
popMatrix();
// Tooth2
pushMatrix();
smooth();
image(img9, 150, -20-v/15, 500, 500);
popMatrix();
// Credits
fill(0);
String credits = "Alejandro Bustamante";
text(credits, -240, 240);
fill(255);
}
import ddf.minim.*;
Minim minim;
AudioInput in;
float s_volume;
float volume;
void setupVolume() {
minim = new Minim(this);
in = minim.getLineIn(Minim.MONO, 512);
}
void getVolume() {
s_volume = in.right.level() * volumeScalar;
// println(s_volume);
float d_volume = s_volume - volume;
if (abs(d_volume) > 1) {
volume += d_volume * easing;
}
v = volume;
}
void stop() {
in.close();
minim.stop();
super.stop();
}
A baby that changes mood depending on volume. This project is meant to be listened to with Death Metal music. Emotions go from calm to angry.