Please note that I may be wrong, but I'd like a sanity check to make sure I'm right. The variable-length quantity method of storing numbers in MIDI files is very unusual and takes up more space than necessary...what were they thinking?
The example time signature of 500,000 µsec per quarter-note used in the example in the file format document of GM1 RP-001_v1-0_Standard_MIDI_Files_Specification_96-1-4.pdf has an 8-bit per byte hex value of "07 A1 20". However, the example indicates that the variable-length quantity is "07 A1 20" and when I do the math with high bit of all except the last byte set I get "9E C2 20" I just want to double check that the document has it wrong. I spent several hours playing with the sample code as well as several versions of my own code and comparing the example conversions before realizing that the document has must have a mistake. Using the defined "variable-length quantity" specification to store the Tempo is very unusual. It would be nice if someone would at least provide a notice that the example is wrong...if that's the case. Or perhaps a more intuitive code sample than the "clever" way the specification document does it.