so what about the
Code:movies.length
part?
when i try to enter this all in i get
"the method random (float,float)... is not applicable for the arguments (int, int,int)".
It seems like the only thing not working is that part. i get the concept of the high and low stuff, i just dont get where it goes. thanks for your patients guys. still struggling to get the vernacular down for this programming language stuff *as you can tell* hah. I know this must be unbearably simple to you all.
heres an updated look
Code:import processing.video.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.signals.*;
Minim minim;
AudioInput in;
FFT fft;
float loudestFreqAmp = 0;
float loudestFreq = 0;
//int timerCounter = 0;
boolean blown; // can be true or false
//Movie idle, idle2, idle3, light, light2, light3;
Movie[] movies = new Movie[6];
void setup()
{
size(550, 400, P2D);
frameRate(30);
minim = new Minim(this);
minim.debugOn();
background(255);
movies[0] = new Movie(this, "idle.mov");
movies[1] = new Movie(this, "idle2.mov");
movies[2] = new Movie(this, "idle3.mov");
movies[3] = new Movie(this, "light1.mov");
movies[4] = new Movie(this, "light2.mov");
movies[5] = new Movie(this, "light3.mov");
// myMovie2 = new Movie(this, "light1.mov");
movies[0].loop();
movies[1].loop();
movies[2].loop();
movies[3].loop();
movies[4].loop();
movies[5].loop();
noStroke();
// get a line in from Minim, default bit depth is 16
in = minim.getLineIn(Minim.STEREO, 1024);
fft = new FFT(in.bufferSize(), in.sampleRate());
blown = false;
}
void movieEvent(Movie light) {
light.read();
}
void draw()
{
// analyzing audio, is it being blown?
// step 1 - find loudest sample
float m = 0;
for(int i = 0; i < in.bufferSize() - 1; i++) {
if ( abs(in.mix.get(i)) > m ) {
m = abs(in.mix.get(i));
}
}
println(m);
// step 2 - is loudest sample loud enough to be being blown
if((blown==false) && (m > 0.1)) {
blown=true;
movies[3].jump(0);
movies[4].jump(0);
movies[5].jump(0);
}
// else {
// blown=false;
// }
// step 3 - draw the appropriate animation
if(blown==true) {
//play a blowing video
int rnd = int(random(3,5, movies.length));
movies[rnd].loop();
// randomely choose one of three
//if(random()
//image(movies[3],0,0); // blowing video 1
//image(light2,0,0); // blowing video 2
//image(light3,0,0); // blowing video 3
float currTime = movies[3].time();
float duration = movies[3].duration();
if(currTime > duration * 0.9) {
// we have reached the end of the movie file
// so stop blowing animation
blown=false;
movies[0].jump(0);
movies[1].jump(0);
movies[2].jump(0);
}
}
else {
int rnd = int(random(0,2, movies.length));
movies[rnd].loop();
//play an idle video
//image(movies[0],0,0);
//image(idle2,0,0); // idle 2
//image(idle3,0,0); // idle 3
}
}
void stop()
{
// always close Minim audio classes when you are done with them
in.close();
minim.stop();
super.stop();
}