Last active
November 7, 2017 22:04
-
-
Save calippo/41cd90e83c055d5c30de3ba7650d2f5c to your computer and use it in GitHub Desktop.
python-midi example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import midi #pip install python-midi (https://github.com/vishnubob/python-midi) | |
pattern = midi.Pattern() | |
track = midi.Track() | |
pattern.append(track) | |
on = midi.NoteOnEvent(tick=0, velocity=100, pitch=60) | |
track.append(on) | |
off = midi.NoteOffEvent(tick=100, pitch=60) | |
track.append(off) | |
eot = midi.EndOfTrackEvent(tick=1) | |
track.append(eot) | |
midi.write_midifile("outfile.mid", pattern) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment