d8d184269473cd8eee795b706f13d16ef12b4339
[minwii.git] / src / mxmMidi / example_mimimal_type0.py
1 from MidiOutFile import MidiOutFile
2
3 """
4 This is an example of the smallest possible type 0 midi file, where
5 all the midi events are in the same track.
6 """
7
8 out_file = 'midiout/minimal_type0.mid'
9 midi = MidiOutFile(out_file)
10
11 # non optional midi framework
12 midi.header()
13 midi.start_of_track()
14
15
16 # musical events
17
18 midi.update_time(0)
19 midi.note_on(channel=0, note=0x40)
20
21 midi.update_time(192)
22 midi.note_off(channel=0, note=0x40)
23
24
25 # non optional midi framework
26 midi.update_time(0)
27 midi.end_of_track()
28
29 midi.eof()