-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
25 additions
and
36 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import midi | ||
# Instantiate a MIDI Pattern (contains a list of tracks) | ||
pattern = midi.Pattern() | ||
# Instantiate a MIDI Track (contains a list of MIDI events) | ||
track = midi.Track() | ||
# Append the track to the pattern | ||
pattern.append(track) | ||
# Instantiate a MIDI note on event, append it to the track | ||
on = midi.NoteOnEvent(tick=0, velocity=20, pitch=midi.G_3) | ||
track.append(on) | ||
# Instantiate a MIDI note off event, append it to the track | ||
off = midi.NoteOffEvent(tick=100, pitch=midi.G_3) | ||
track.append(off) | ||
# Add the end of track event, append it to the track | ||
eot = midi.EndOfTrackEvent(tick=1) | ||
track.append(eot) | ||
# Print out the pattern | ||
print pattern | ||
# Save the pattern to disk | ||
midi.write_midifile("example.mid", pattern) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import midi | ||
pattern = midi.read_midifile("test.mid") | ||
print pattern |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
This file was deleted.
Oops, something went wrong.