jasmid icon indicating copy to clipboard operation
jasmid copied to clipboard

Parsing tempo event results in invalid microsecondsPerBeat

Open Tails opened this issue 9 years ago • 0 comments

This code

case 0x51:
    event.subtype = 'setTempo';
    if (length != 3) throw "Expected length for setTempo event is 3, got " + length;
    event.microsecondsPerBeat = (
        (stream.readInt8() << 16)
        + (stream.readInt8() << 8)
        + stream.readInt8()
        )
    return event;

will sometimes result in a microsecondsPerBeat of zero which results in a beatsPerMinute of Infinity, and a secondsToGenerate of 0, resulting in a perceived MIDI file length of 0.

See mudcube/MIDI.js#134

Tails avatar Jul 01 '15 12:07 Tails