** Hi! :) I am trying to come up with some interactive video stuff, so I decided to try smth with Processing. So to see if interactivity is even working smooth I tried to make controllable video. The question- Whats wrong with the code if I want to control the speed of the video with sound intensity (video should go faster if the participant actively speaks/sings/make noises etc., but if it's quite it should get slower, maybe even go reverse)? And should I dig deeper to trying make some interactive video with Processing or should I better find other software, that could be more suitable for that kind of thing...? **
import processing.video.*;
import processing.sound.*;
AudioIn input;
Amplitude rms;
int speed=3;
Movie video;
void setup(){
size(640,360);
frameRate(25);
video=new Movie(this, "gliemezis.mov");
video.loop();
video.speed(speed);
input = new AudioIn(this, 0);
input.start();
rms = new Amplitude(this);
rms.input(input);
}
void movieEvent (Movie video) {
video.read();
}
void draw(){
image(video,0,0, width,height);
speed=int(map(rms.analyze(), 0, 0.5,0, 5));
video.speed(speed);
}