Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Johnrobmiller opened this issue Jun 26, 2024 · 1 comment

Comments

@Johnrobmiller
Copy link

Johnrobmiller commented Jun 26, 2024

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

  • changing player.playbackRate
  • there is lag in the program
  • the duration of Tone.Transport.loopEnd is not equal to the duration of the player's audio buffer.

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
Copy link
Author

Johnrobmiller commented Jun 26, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant