-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
I'm not sure if this is the correct repo for this issue since I'm using version 1.11.1 (p5.SoundFile.loop() does not seem to work with version 2.0). Happy to work on this issue if this is the correct repo.
p5.js & p5.sound version
1.11.1
Web browser and version
Chrome 138.0.7204.184
Operating system
Mac OS
Steps to reproduce this
Open my sketch here: https://editor.p5js.org/jeanetteandrews/sketches/tU-3SU3gE
Comment/uncomment duration to test the different cases
Snippet:
let soundFile;
let startTime = 0;
let rate = 1;
let amp = 1;
let cueLoopStart = 14;
let duration;
// CASE 1: cueLoopStart < duration
// loops from 0:14-0:15 (1 second)
duration = 15;
// CASE 2: cueLoopStart + duration > song length (30 seconds)
// loops from 0:14-0:30
// duration = 17;
// CASE 3: cueLoopStart > duration
// starts at 0:14, ends at 0:18, and then plays from 0:00
// duration = 4;
function preload() {
mySound = loadSound('I_Love_Music.mp3');
}
function setup() {
let cnv = createCanvas(100, 100);
cnv.mousePressed(canvasPressed);
background('pink');
text('tap to play', 10, 20);
}
function canvasPressed() {
mySound.loop(startTime, rate, amp, cueLoopStart, duration);
background('blue');
text('music is playing', 10, 20);
}
Metadata
Metadata
Assignees
Labels
No labels