Tone.js icon indicating copy to clipboard operation
Tone.js copied to clipboard

ToneEvent callback triggering twice

Open jhaavard opened this issue 3 years ago • 3 comments

I'm having an issue with the Tone.ToneEvent callback being triggered twice on the same event, only slightly apart. When using a Sampler, one sample is played on top of the other, making the sound twice as loud. With a Synth, it results in the error: "Start time must be strictly greater than previous start time." In CodeSandbox, however, the synth works fine, but the callback is still triggered twice. It's only off by a tiny amount and it seems to be happening randomly and not very often. Some kind of floating point bug, or am I missing something? Curious to hear if others get the same result.

CodeSandbox example https://codesandbox.io/s/tone-issue-fqkwkp?file=/src/index.js

Expected behavior Tone.ToneEvent callback to only be called once per event.

Additional context Tone v14.7.77

jhaavard avatar Mar 06 '22 13:03 jhaavard

Could you try it on tone@next? I wonder if this might have already been fixed by some recent updates

tambien avatar Mar 10 '22 16:03 tambien

Could you try it on tone@next? I wonder if this might have already been fixed by some recent updates

Running the code on tone@next yields the same result.

jhaavard avatar Mar 11 '22 11:03 jhaavard

Hi, any progress on this? We have tried Tone JS v14.8.40 and the callbacks appear to the happening in the Offline Context, although the main Context appears to be calling back as expected. Tried dropping to .37 and the callbacks on the Offline Context appear to be singular as expected. Haven't done any extensive testing on this, but hope this is useful.

abswiz avatar Aug 27 '22 11:08 abswiz