xxxxxxxxxx
38
let mSound;
let mReverb;
function preload() {
mSound = loadSound("./voice-00.mp3");
}
function setup() {
createCanvas(windowWidth, windowHeight);
mReverb = new p5.Reverb();
mReverb.set(20, 50);
mSound.amp(0.55);
mReverb.amp(0.45);
mSound.disconnect();
mReverb.disconnect();
mSound.connect(mReverb);
mSound.connect(p5.soundOut);
mReverb.connect(p5.soundOut);
noLoop();
}
function draw() {
background(220, 20, 120);
}
function mouseClicked() {
if (mSound.isPlaying()) {
mSound.pause();
} else {
mSound.play();
}
}