Tonejs / Tone.js

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

The Tone.Player audio gets out of sync with the Tone.Transport timers. #1261

Open Johnrobmiller opened 1 week ago

Johnrobmiller commented 1 week ago

As the title says, the Tone.Player audio sometimes gets out of sync with the Tone.Transport timers. This could happen when:

There ought to be a way to perfectly synchonize the looping in Tone.Transport with the audio player source. I thought about forking Tone.js and seeing if I can add an onended event listener to the original audio source, but I thought I might make this issue first.

Johnrobmiller commented 1 week ago

As it turns out, the players need to have a sync() method called manually before their times are correct.

I'm reading through the docs -- to know about this, one would have had to read through all the methods in the docs for player until they come across the sync() method and read what it does.

I think there are such things as usability "bugs", and this would be one of them.

Please consider:

  1. the documentation ought to explain these sorts of things up in a paragraph or two up front before all the props/methods are documented. When people go to the docs for things like the Player class, they ought to be taught how to use the class, and this includes all the gotchas and assumptions like this.
  2. Adding tooltips in the IDE which help explain these sort of things
  3. There's probably a way to communicate a better mental model to the user through the design itself, although I wouldn't know how since I still don't have a good mental model of tone.js at this time.