From 530a997a079e894c4091030c2e4fc47a12256d42 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Wed, 23 Sep 2020 22:01:03 -0400 Subject: [PATCH] compute the start of the next tick using the tickDuration instead of getTimeOfTick fixes #706 --- Tone/core/clock/Transport.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tone/core/clock/Transport.ts b/Tone/core/clock/Transport.ts index bf735000..1f460a43 100644 --- a/Tone/core/clock/Transport.ts +++ b/Tone/core/clock/Transport.ts @@ -569,7 +569,8 @@ export class Transport extends ToneWithContext implements Emit if (this.state === "started") { const ticks = this._clock.getTicksAtTime(now); // schedule to start on the next tick, #573 - const time = this._clock.getTimeOfTick(Math.ceil(ticks)); + const remainingTick = this._clock.frequency.getDurationOfTicks(Math.ceil(ticks) - ticks, now); + const time = now + remainingTick; this.emit("stop", time); this._clock.setTicksAtTime(t, time); // restart it with the new time