Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.52k stars 983 forks source link

Tone.Transport.Loop triggers samples of Player twice or more when loopStart > 0 #944

Closed dirkk0 closed 2 years ago

dirkk0 commented 3 years ago

Describe the bug

The Codepen below runs correctly when loopStart = 0; if you change it to some value above zero, the sample gets triggered twice after some time. Unfortunately, this behaviour doesn't always show, but I found that opening a new tab with the CodePen usually results in the second loop playing two (or more) times, resulting in a higher loudness. This repeats several times afterwards.

To make things more interesting: once this behaviour occurs, the stop button (triggering Transport.stop() ) acts up when pressed several times. It restarts the loop or sample fragments with normal or higher loudness (which I assums is several samples playing at once).

To Reproduce

https://codepen.io/dirkk0/pen/zYzEBNV

Expected behavior Loop playing correctly with normal gain.

What I've tried setLoopPoints and loopStart/End behave identical. I played around with playbackRate, but to no avail. The codepen has no fancy features so far, so that seems to be no side effect.

Tested on Chrome and Firefox on a Mac and Linux.

jtwigg commented 2 years ago

@dirkk0 Any luck here? I'm having the same experience. It doubles up sometimes.

dirkk0 commented 2 years ago

@jtwigg no, unfortunately not, good that you opened up another issue.