Ever want your sound to start on time?
Use this code:
var isSound = false;
function draw(){
if(isSound === true){
//do the program here
//v
//^
}else{
background('lightGray');
camera.x = 200;
camera.y = 200;
camera.zoom = 1;
push();
translate(random(-1,1),random(-1,1));
textAlign(CENTER,BASELINE);
textSize(40);
fill('black');
text('Loading sound', 200, 200);
textAlign(LEFT,BASELINE);
pop();
}
}
playSound("insertSoundNameHere.mp3", false,function(){
isSound = true;
setTimeout(function(){
stopSound();
},100000/change to determine when sound stops (millisec)/);
});