xxxxxxxxxx
34
let mSound;
let mDelay;
function preload() {
mSound = loadSound("./voice-00.mp3");
}
function setup() {
createCanvas(windowWidth, windowHeight);
mDelay = new p5.Delay();
mDelay.delayTime(0.15);
mSound.disconnect();
mDelay.disconnect();
mSound.connect(mDelay);
mDelay.connect(p5.soundOut);
noLoop();
}
function draw() {
background(220, 20, 120);
}
function mouseClicked() {
if (mSound.isPlaying()) {
mSound.pause();
} else {
mSound.play();
}
}