python-midi
python-midi copied to clipboard
Eliminate corruption when writing MIDIs due to RunningStatus
When writing midis, a running state is used so that if multiple messages of the same type are used in a row, the message type only has to be specified once. This is fine, except for the fact that MetaEvents and SysexEvents does not cause the state to reset. This can cause the generated midis to be unreadable by some (but not all) software, so here's a quick fix.
Incidentally, I notice the python3 branch instead opts to eliminate the use of RunningStatus entirely, with the following comment:
why in the heeeeeeeeelp would you not write the status message here? doesn't matter if it's the same as last time. the byte needs to be there!