Now that you have your face programmed, we will animate it with sound. Check out this example, to get an idea of what you will be doing.
To Animate our faces we will be using a Sound Library called minim because the Processing sound library is not working on these lab machines. A library is a piece of code that was written by someone else, that is precompiled and ready to be used.
Minim is not downloaded automatically with Processing due to its increasing size. Simply click Sketch on the menu
And then click on Import Library and select Add Library and install it!
background(255, 255, 255);
import ddf.minim.*; Minim minim; AudioInput in; private float volumeA; private final float EASING = 0.2; private final float MULTIPLIER = 1000; void setupVolume() { minim = new Minim(this); in = minim.getLineIn(Minim.MONO, 512); } float getVolume() { float currentVolume = in.right.level() * MULTIPLIER; float volumeDifference = currentVolume - volumeA; if(abs(volumeDifference) > 1) { volumeA += volumeDifference * EASING; } return volumeA; } void stop() { in.close(); minim.stop(); super.stop(); }
float volume;
setupVolume();
volume = getVolume();.