I think there is something wrong / buggy in p5 sound. When you hit stop it should return zero for currentTime(), unless I am misunderstanding the intended behavior. I’m trying to change the sound playing using an array, and constructors are plotting graphs off time values using sound.currentTime(). When the sound starts over, it’s obviously a big problem not to get 0 but to get the last time value of when the song was playing. Destroying the array of sounds, or recreating the sound variable itself does not do anything. sound.jump(0), also useless. The browser has the .currentTime() variable stuck in memory somewhere which needs to be expunged. Does anyone know a workaround?
Here is an example of stopping the song not giving zero. You would expect it to return the time value if using something like pause(), so I’m not understanding what’s wrong:
sound.stop();
console.log(sound.currentTime());
sound.play();
console.log(sound.currentTime());
something I tried that seems to work, but I’m not sure if this sketchy to attempt (why I’m posting this):
sound.stop();
sound._lastPos=0;
console.log(sound.currentTime());
sound.play();
console.log(sound.currentTime());
this gives you zero, which is correct for my application. Any advice appreciated.