Tone.js Transport Stop and Restart Scheduled Events

When working with web audio in Tone.js, understanding how the timeline behaves during playback control is essential. This article explains what happens to scheduled events when Tone.Transport is stopped and subsequently restarted, highlighting how event scheduling persists on the timeline and how the playhead position changes.

Scheduled Events Persist in Memory

When you schedule an event using Tone.Transport.schedule(), Tone.Transport.scheduleRepeat(), or Tone.Transport.scheduleOnce(), the event is bound to a specific time or tick on the Transport’s timeline.

Stopping and restarting the Transport does not delete or clear these scheduled events. They remain in the Transport’s queue until you explicitly remove them using Tone.Transport.clear(id) or clear the entire timeline using Tone.Transport.cancel().

What Happens When You Call Tone.Transport.stop()?

Calling Tone.Transport.stop() affects the timeline and playing events in the following ways:

What Happens When You Call Tone.Transport.start()?

When you restart the Transport after stopping it, the timeline behaves as follows:

Stopping vs. Pausing

It is important to distinguish between stopping and pausing, as they handle scheduled events differently upon restart: