The Rests in the melody seemed to be missing. This is the fix. Relocate the getTime().
music.prototype.play=function(note){
// console.log(note,this.Spkr);
if (this.onoff>0) return;
console.log(note,midi2tone(note));
var octave=Math.log(2);
var halftone=octave/12;
this.start=getTime(); //moved this from below
if(note===null)return; // a rest
note=note-60;
var tone=Math.exp(note*halftone);
this.freq(261.63*tone); //C4 Middle C Midi note 60
// this.start=getTime(); //move this from here
};//end play
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Oops
The Rests in the melody seemed to be missing. This is the fix. Relocate the getTime().