xxxxxxxxxx
56
let gallerySound;
let gardenSound;
let kitchenSound;
let currentSound;
let soundJump;
let jumpTo;
function preload() {
gallerySound = loadSound('gallerySound.mp3');
gardenSound = loadSound('gardenSound.mp3');
kitchenSound = loadSound('kitchenSound.mp3');
}
function setup() {
createCanvas(windowWidth, windowHeight);
// gallerySound.loop();
gardenSound.loop();
// kitchenSound.loop();
gardenSound.amp(15);
}
function draw() {
background(220);
currentSound = gardenSound;
// if (mouseIsPressed) {
// gardenSound.loop();
// } else {
// gardenSound.pause();
// }
soundJump = int(map(mouseX, 0, width, 100, 1));
if (frameCount % int(soundJump) == 0) {
// jumpTo = random(0, currentSound.duration());
currentSound.stop();
// currentSound.jump(jumpTo, 1);
// currentSound.loop();
print("jumping!");
}
// print(soundJump);
text("framecount = " + frameCount, 10, 30);
text("soundJump = " + soundJump, 10, 50);
text("jumpTo = " + jumpTo, 10, 70);
}