colxi / midi-parser-js

JSON Human readable MIDI sequences. Read from ArrayBuffers, Base64 encoded strings, or FileInput Element in Browsers.
GNU General Public License v3.0
225 stars 30 forks source link

Please checke tempo meta event description - there may be a fault #12

Open DF9TS opened 4 years ago

DF9TS commented 4 years ago

In https://github.com/colxi/midi-parser-js/wiki/MIDI-File-Format-Specifications the tempo meta event says: 0xFF 0x51 then 3 bytes for tempo value

When you check in other docs you will find it's 0xFF 0x51 0x03 then 3 bytes for tempo value e.g. here https://www.cs.cmu.edu/~music/cmsip/readings/Standard-MIDI-file-format-updated.pdf

.. and my MIDI player crashes if I generate a MIDI file without the 03 in set tempo

colxi commented 4 years ago

Sorry for the delay, i've been very busy lately. I'll try to take a look

masi commented 4 years ago

I cannot see a fault in the docs provided by colxi. For "set tempo" it says "length: 3" followed by the tempo. Perhaps you are missing that any mentioned length is represented by a byte value in the file. All meta events have a length byte following the type:

These events are defined by an event type value of 0xFF and have a variable size of parameter data which is defined after the event type.