As I would like to build some form of device to feed data to my visualisation I have order myself an Arduino Uno. But until that arrieves I throught it would be a good idea to see if I could build a quick prototype in processing which would graphically display the volume of a mic input. I decided to ignore the web limitations for now as I had no idea how easy it would be to put together.
I used Minium, a sound library for processing. Which I discovered records the volume from the left and right channel with a value between 0 and 1. This meant that with a very small amount of code I was able to create a simple visualisation which changed the colour of a circle based on the volume.
// load libaries
import ddf.minim.*;
// minium vars
Minim minim;
AudioInput input;
void setup(){
size(500,500);
smooth();
noStroke();
colorMode(HSB);
minim = new Minim(this);
input = minim.getLineIn();
}
void draw() {
background(0);
fill(volume(),255,255);
ellipse(width/2,height/2,100,100);
println(input);
}
float volume() {
return(input.mix.get(1)*1000);
}
void stop(){
input.close();
minim.stop();
super.stop();
}
even with something simple like this if you where to have a large amount of them positioned relative to there location you would get a really interesting image
- Leave your comment • Category: Project 5: Independent Project
- Share on Twitter, Facebook, Delicious, Digg, Reddit