Can anyone explain why the below doesn't work? I'm essentially doing note_on()'s out of order, but the resulting out-put .mid file doesn't seem to take notice of the out-of-order-notes.
For example, I first do: (abstracted some non-important details away)
Can anyone explain why the below doesn't work? I'm essentially doing note_on()'s out of order, but the resulting out-put .mid file doesn't seem to take notice of the out-of-order-notes.
For example, I first do: (abstracted some non-important details away)
update_time(0)
note_on(note="C4")
note_on(note="G4")
update_time(200)
note_off(note="C4")
note_off(note="G4")
The above is all fine and dandy - however, say I add the following line in:
update_time(0, relative=0) # To make it absolute-time
note_on(note="E4")
The resulting output file doesn't have the E! What am I doing wrong?
Thanks!
====== If you want, here's the whole file:
from MidiOutFile import MidiOutFile
out_file = 'midiout/newtest_type0.mid'
m = MidiOutFile(out_file)
# non optional midi framework
m.header()
m.start_of_track()
# musical events
m.start_of_track(1)
m.sequence_name('Piano')
m.instrument_name('Piano')
m.update_time(0)
m.note_on(channel=1, note=0x3C)
m.note_on(channel=1, note=0x43)
m.update_time(150)
m.note_off(channel=1, note=0x3C)
m.note_off(channel=1, note=0x40)
m.note_off(channel=1, note=0x43)
m.update_time(0,relative=0)
m.note_on(channel=1, note=0x40)
# non optional midi framework
m.update_time(0)
m.end_of_track() # not optional!
m.eof()