You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
523 B
Python
29 lines
523 B
Python
15 years ago
|
from MidiToText import MidiToText
|
||
|
|
||
|
"""
|
||
|
This is an example that uses the MidiToText eventhandler. When an
|
||
|
event is triggered on it, it prints the event to the console.
|
||
|
"""
|
||
|
|
||
|
midi = MidiToText()
|
||
|
|
||
|
# non optional midi framework
|
||
|
midi.header()
|
||
|
midi.start_of_track()
|
||
|
|
||
|
|
||
|
# musical events
|
||
|
|
||
|
midi.update_time(0)
|
||
|
midi.note_on(channel=0, note=0x40)
|
||
|
|
||
|
midi.update_time(192)
|
||
|
midi.note_off(channel=0, note=0x40)
|
||
|
|
||
|
|
||
|
# non optional midi framework
|
||
|
midi.update_time(0)
|
||
|
midi.end_of_track() # not optional!
|
||
|
|
||
|
midi.eof()
|