<p>您可以根据<a href="http://www.sonicspot.com/guide/midifiles.html" rel="nofollow noreferrer">http://www.sonicspot.com/guide/midifiles.html</a>编辑文件</p>
<p>虽然可能已经有了一个MIDI读/写库。事实上,这是一个看到相关问题的问题:<a href="https://stackoverflow.com/questions/569321/simple-cross-platform-midi-library-for-python">Simple, Cross Platform MIDI Library for Python</a></p>
<blockquote>
<p>Set Tempo </p>
<p>This meta event sets the
sequence tempo in terms of
microseconds per quarter-note which is
encoded in three bytes. It usually is
found in the first track chunk,
time-aligned to occur at the same time
as a MIDI clock message to promote
more accurate synchronization. If no
set tempo event is present, 120 beats
per minute is assumed. The following
formula's can be used to translate the
tempo from microseconds per
quarter-note to beats per minute and
back.</p>
</blockquote>
<pre>
MICROSECONDS_PER_MINUTE = 60000000
BPM = MICROSECONDS_PER_MINUTE / MPQN
MPQN = MICROSECONDS_PER_MINUTE / BPM
</pre>
<pre>
Meta Event Type Length Microseconds/Quarter-Note
255 (0xFF) 81 (0x51) 3 0-8355711
</pre>