Closed stevebarakat closed 2 years ago
+1
Now that I have a better understanding of the use case for Tone.Players
, I understand why there is no Players.startAll()
method. Tone.Players
is an API for making sampler instruments, for example:
const players = new Tone.Players({
url:{
"c0": "../samples/c0.wav",
"c#0": "../samples/c#0.wav",
"d0": "../samples/d0.wav",
"d#0": "../samples/d#0.wav",
"e0": "../samples/e0.wav",
//...
}
})
So you obviously wouldn't want to start playing every note on the instrument simultaneously.
In the case of making an audio mixer with multiple tracks that need to start simultaneously, use the sync
method. https://tonejs.github.io/docs/14.7.77/Player#sync
That makes sense!
I'm using it for a simple audio player for a text game (I want to apply effects to tracks on the fly e.g. sound from inside a room and outside it behind a door).
I also wanted it to play looped tracks and then other tracks at random intervals depending on a chance paramater (like the random creepy sounds in minecraft)
I've coded a simple implementation for my use case which was easy enough to implement using Tone and it's effects, filters and players. It makes sense not to have the playAll method based on what you've outlined above :)
Players.startAll()
There's currently a
Players.stopAll()
method. Why noPlayers.startAll()
? It seems so obvious, I'm surprised it doesn't already exist. For example, I'm making an audio mixer that has 12 channels, playing 12 audio files simultaneously. I'm able to start all the track simultaneously using multipleTone.Player
methods but can't get it working withTone.Players
.