You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,14 @@ This works with with type one midi and type zero midi files. For type zero midi
6
6
(This isn't meant to create or manipulate midi files; it is just to get data from them.)
7
7
8
8
At this point, this script should be able to take a format one midi file that has one channel per track,
9
-
and create Notes with start and stop times. To do this, create a MidiData (ex midiData = MidiData("testMidiFile.mid")).
10
-
All the data should be initialized by the constructor. The number of tracks created can be checked by calling midiData.getNumTracks().
9
+
and create Notes with start and stop times.
11
10
12
-
A TrackData can be retrieved by calling midiData.getTrack(index). If trackData = midiData.getTrack(index) then
13
-
trackData.notes is a list containing the notes for that track, sorted by start time. Each Note has a startTime and endTime field, defined in
11
+
Start by creating a MidiData object with the path to the midi file (ex midiData = MidiData("testMidiFile.mid")). This will parse the midi file and populate the MidiData object.
12
+
By default, when note names are printed, middle c (pitch 60) will be C4. This can be changed to either C3 or C5 by passing it to the MidiData (ex midiData = MidiData("testMidiFile.mid", "C3"))
13
+
The number of tracks created can be checked by calling midiData.getNumTracks().
14
+
15
+
The MidiData contains TrackData objects for each track in the midi file. A TrackData can be retrieved by calling midiData.getTrack(index).
16
+
TrackData objects have a list of notes in their notes field (ex trackData.notes) sorted by start time. Each Note has a startTime and endTime field, defined in
14
17
milliseconds (as well as a length() function that returns the length in milliseconds). Each Note also has a pitch
15
18
field in the range 0 - 127. trackData.name contains the name of the track, which may be the name of the instrument on that track.
16
19
trackData.events contains the midi events in the track, and each event has a startTime field in milliseconds. Midi events are defined in
0 commit comments