PageRenderTime 303ms CodeModel.GetById 161ms app.highlight 2ms RepoModel.GetById 138ms app.codeStats 0ms

/src/echonest/support/midi/example_print_events.py

http://echo-nest-remix.googlecode.com/
Python | 28 lines | 11 code | 10 blank | 7 comment | 0 complexity | caed742ebafd9302e44a9c5156a636dc MD5 | raw file
 1from MidiToText import MidiToText
 2
 3"""

 4This is an example that uses the MidiToText eventhandler. When an 

 5event is triggered on it, it prints the event to the console.

 6"""
 7
 8midi = MidiToText()
 9
10# non optional midi framework

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

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

25midi.update_time(0)
26midi.end_of_track() # not optional!

27
28midi.eof()