We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I guys, I need help to understand how to play two songs without overlapping. I am using the minim library but I do not know how to detect the final part of the first track to play the second song (or maybe there are others better ways to do it). This is my code, thanks for the tips:)
import ddf.minim.*;
Minim minim;
AudioPlayer player[]=new AudioPlayer[4];
String filenames[] = new String[]{"sound1.mp3", "sound2.mp3"};
void setup(){
minim = new Minim(this);
for(int i=0;i<2;i++){
player[i] = minim.loadFile(filenames[i]);
player[i].play();
print(filenames);
}
}
void draw(){}
void stop(){
for(int i=0;i<2;i++){
player[i].close();
}
minim.stop();
super.stop();
}
Answers
Well, don't launch playing of both sounds in setup() at the same time. Wait for the end of the first one to play the second one.
Hi Philho, thanks for the replay, actually I am proceeding step by step to understand the minimum functions, but probably is better if I ask directly what I would like to achieve.
I am trying to write a sort of musical player. On the top I have a alphabet composed by random images (for the moment I linked only 'a' and 'b') which are connected with the keyboard.
Using the images as letters, is possible to write on the bottom.
Each letter written on the bottom should be connected with a sound track and played one after other.
What I need to know is how to link each image to the sound track and how let the sound plays without overlapping.
Can you help me?:)
http://forum.processing.org/two/discussion/8506/how-do-i-make-sure-only-1-audio-file-is-played-at-a-single-time
Hi GoToLoop, the problem for the moment is that I do not understand how to link the image with the sound.
For each letter I have three images, and each of these three images should be connected with a specific sound track.(so the same for each alphabet letter).
How is possible to expres in code... "when 'a' is pressed, chose one random Aimg (here my basic way )
and load the corresponding soundtrack which it will be played in a second moment (maybe with a 'ENTER')...
thanks
This is an even better forum thread about it: :>
http://forum.processing.org/two/discussion/7940/line-break-and-backspace-in-string
Thank you very much, I updated my sketch:)
here two options both that do not work....
1) overlapping of the sound: ... { if (key=='a') {
2) it plays only the last letter drawn
How is possible to let play the letter one after the other and not all together? Thanks a lott!