Hello guys,
Is Possible to know Which time to complete a sound (music) an .mp3 or .wav of a file in Processing, using the Minim library?
For example, I need at the end of a particular sound, perform a certain action, so I need to know when to finished.
This is the code I used as an example, although I'm using is in another project.
import ddf.minim.*;
Minim minim;
AudioPlayer player[] = new AudioPlayer[3];
String filenames[] = new String[] {"groove.mp3", "jingle.mp3", "Kalimba.mp3"};
void setup(){
minim = new Minim(this);
for(int i = 0; i < 3; i++){
player[i] = minim.loadFile(filenames[i], 2048);
}
}
void draw(){
//
}
void keyPressed(){
int som;
if (key == 'A' || key == 'a') som = 0;
else if (key == 'B' || key == 'b') som = 1;
else som = 2;
playSom(som);
}
void playSom(int opcSom){
for (int i = 0; i < 3; i++){
if (player[i].isPlaying())
player[i].pause();
}
player[opcSom].rewind();
player[opcSom].play();
println("Duration: "); //???
}
void stop(){
for(int i = 0; i < 3; i++){
player[i].close();
}
minim.stop();
super.stop();
}
Thanks for attention.