xxxxxxxxxx
var voice1, voice2, voice3, amp, fft;
var s = 200;
var voice = [];
function preload() {
voice[0] = loadSound('stopplease.mp3');
voice[1] = loadSound('helpme.mp3');
voice[2] = loadSound('nvoice.mp3');
}
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
voice[0].playMode('restart');
voice[1].playMode('restart');
voice[2].playMode('restart');
// sound.play();
}
function draw() {
background(0,10);
translate(width/2, height/2);
fill(255);
text("click to play random voice",0,0);
}
function mousePressed() {
var voiceNum = Math.floor(Math.random() * 3);
voice[0].pause();
voice[1].pause();
voice[2].pause();
if (voice[voiceNum].isPlaying()) {
voice[voiceNum].pause();
} else {
voice[voiceNum].play();
}
}