The following code should create a MIDI file whose duration is 1 hour (1000*3600 milliseconds):
messages = [mido.Message('note_on', note = 100, time = 1000), mido.Message('note_off', note = 100, time = 1000*3600)]
midi.tracks.append(mido.MidiTrack(messages))
midi.save('test.mid')
However, the resulting file is 2.5 minutes longer. Why is that?
Same problem if there are more notes. It seems that the MIDI file is slower than it should be.