question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple players playing simultaneously

See original GitHub issue

It is currently not possible to have multiple players playing (or even paused) simultaneously because they are implemented using Tone.Transport (see #403, #418). This leads to the following problems:

  • To avoid a bad user experience (playback won’t start if a different player is already playing), one has to keep track of the currently playing player to stop it when needed (as in html-midi-player).
  • A paused player still prevents other players from playing. For this reason I don’t use the pause feature at all, but then I can only seek when the player is playing. In any case, you can seek at most one player at a time, which is clumsy.
  • It also prevents other code from using Tone.Transport.

@tambien suggested using Clock instead of Transport, but that would basically mean re-implementing a Transport. So I think the best would be to just instantiate one Transport for each player. Is something preventing that?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cifkaocommented, Aug 30, 2020

I think I want to push back a little and understand why you need several players so i can give you a qorkaround

It’s not hard to imagine that there will be more than one player on the page, see e.g. my interpolation demo or the html-midi-player demo. I don’t need them playing simultaneously. But the user will try to fiddle with multiple players at the same time and expect some reasonable behavior (ideally the same as with the audio element). I’m OK with my workaround for the first issue (stop the current player before starting another one). For the second issue (seeking while stopped), the workaround would require adding an offset parameter to start().

I’m not sure I understand why just stopping the Part is bad or won’t work. Reimplementing Transport/Part is almost definitely not what we want to do

By that I didn’t mean actually writing a new implementation of Transport. I just meant implementing the scheduling of notes directly using Clock as @tambien suggested earlier, rather than using Transport (which also uses a Clock internally). I think it shouldn’t be too hard.

is it to turn on and off some instruments?

I didn’t have that in mind, but that would be awesome too. In my application, I just disable the instrument checkboxes while playing (which is OK as a workaround, but can be a bit annoying).

0reactions
notwaldorfcommented, Aug 30, 2020

I think I want to push back a little and understand why you need several players so i can give you a qorkaround – is it to turn on and off some instruments? in that case, we can just make some utility methods that concatenate these note sequences into the one “played” one. The complicated part here will be to dynamically add notes to it, but even switching the part that a player is using shouldn’t be thaaaat bad.

I’m not sure I understand why just stopping the Part is bad or won’t work. Reimplementing Transport/Part is almost definitely not what we want to do (whatever problems Tone has we will eventually have, only then we can’t look to @tambien to fix it 😅), so using whatever Tone is giving us is crucial imo

Read more comments on GitHub >

github_iconTop Results From Across the Web

Simultaneous exhibition - Wikipedia
A simultaneous exhibition or simultaneous display is a board game exhibition (commonly chess or Go) in which one player plays multiple games at...
Read more >
Is it possible to have multiple player instances play at the ...
Is it possible to have multiple player instances play at the same time. Yes, this is possible, provided there are enough bandwidth and...
Read more >
12 Free Online Games You Can Play With Friends Anywhere
No sign-up necessary · A maximum of two players · Players play simultaneously · Play with friends online, but on the same PC ......
Read more >
How to Play 2 to 4 Players on Same TV in MultiVersus (Split ...
Do you want to know how to play 2 to 4 players on the Same TV in MultiVersus for split screen or local...
Read more >
How to Play Local Multiplayer in MultiVersus (2-4 Players)
Do you want to know how to play local multiplayer in Multiversus with 2 to 4 players on the same tv or monitor...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found