diff --git a/pxtsim/sound/sequencer.ts b/pxtsim/sound/sequencer.ts index 9f1dacffb947..6d53bd2c3842 100644 --- a/pxtsim/sound/sequencer.ts +++ b/pxtsim/sound/sequencer.ts @@ -41,6 +41,7 @@ namespace pxsim.music { dispose() { if (this.metronome) this.metronome.dispose(); + this.metronome = undefined this.stop(); this.currentlyPlaying = undefined; this.listeners = {}; @@ -88,7 +89,7 @@ namespace pxsim.music { stop(sustainCurrentSounds = false) { if (this._state === "stop") return; this._state = "stop"; - this.metronome.stop(); + if (this.metronome) this.metronome.stop(); this.fireStateChange(); if (!sustainCurrentSounds) this.currentCancelToken.cancelled = true;