Im pretty much newb at this and have very little idea what im doing. I want the code to detect sounds and trigger a background change/another .wav file . I'm using getLineIn to detect the sounds but I cant figure out how to get that info to trigger the background/sound change.
My current code:
void function(){
for (int i = 0; i < 1; i++){
float r = (1000*in.right.get(i));
float l = (1000*in.left.get(i+1));
float number = ((r*l)/2);
//println(number);
if ( number > 100) {
s1.rewind();
s1.play();
}
//if(1 > 150)
//{
//s1.rewind();
//s1.play();
//background(255);
}
}
void stop(){
// always close Minim audio classes when you are done with them
in.close();
minim.stop();
super.stop();
}
there are two options in void function() that i was fiddling with but i couldn't get either to work... Any idea what should work, or what im doing wrong?