PageRenderTime 313ms CodeModel.GetById 173ms app.highlight 2ms RepoModel.GetById 137ms app.codeStats 0ms

/src/echonest/support/midi/example_mimimal_type0.py

http://echo-nest-remix.googlecode.com/
Python | 29 lines | 12 code | 10 blank | 7 comment | 0 complexity | 1f990056ef5a552661d98609961cc427 MD5 | raw file
 1from MidiOutFile import MidiOutFile
 2
 3"""

 4This is an example of the smallest possible type 0 midi file, where 

 5all the midi events are in the same track.

 6"""
 7
 8out_file = 'midiout/minimal_type0.mid'
 9midi = MidiOutFile(out_file)
10
11# non optional midi framework

12midi.header()
13midi.start_of_track() 
14
15
16# musical events

17
18midi.update_time(0)
19midi.note_on(channel=0, note=0x40)
20
21midi.update_time(192)
22midi.note_off(channel=0, note=0x40)
23
24
25# non optional midi framework

26midi.update_time(0)
27midi.end_of_track()
28
29midi.eof()