Mercurial > hg > syncopation-dataset
comparison Syncopation models/readmidi.py @ 25:59906fa4999c
removed degugging print messages from readmidi.py
author | christopherh <christopher.harte@eecs.qmul.ac.uk> |
---|---|
date | Sun, 12 Apr 2015 15:42:47 +0100 |
parents | 08c298f47917 |
children |
comparison
equal
deleted
inserted
replaced
24:08c298f47917 | 25:59906fa4999c |
---|---|
105 event = timeList[i] | 105 event = timeList[i] |
106 i = i + 1 | 106 i = i + 1 |
107 if event.time>=barEndTime: | 107 if event.time>=barEndTime: |
108 break | 108 break |
109 | 109 |
110 # print "event %d, start %d, end %d"%(event.time, barStartTime, barEndTime) | |
111 if event.type=="TIME_SIGNATURE" and event.time>=barStartTime: | 110 if event.type=="TIME_SIGNATURE" and event.time>=barStartTime: |
112 timesig = midi_event_to_time_signature(event) | 111 timesig = midi_event_to_time_signature(event) |
113 event.type = "USED_TIME_SIGNATURE" | 112 event.type = "USED_TIME_SIGNATURE" |
114 # print timesig.to_string() | 113 |
115 # this event has been used now so remove it | |
116 #timeList.remove(event) | |
117 | |
118 if timesig==None: | 114 if timesig==None: |
119 if currentTimeSignature==None: | 115 if currentTimeSignature==None: |
120 timesig = TimeSignature("4/4") | 116 timesig = TimeSignature("4/4") |
121 else: | 117 else: |
122 timesig = currentTimeSignature | 118 timesig = currentTimeSignature |
134 event = timeList[i] | 130 event = timeList[i] |
135 i = i + 1 | 131 i = i + 1 |
136 if event.time>=barEndTime: | 132 if event.time>=barEndTime: |
137 break | 133 break |
138 | 134 |
139 print "event %d, start %d, end %d"%(event.time, barStartTime, barEndTime) | |
140 | |
141 # run through list until we find the most recent tempo | 135 # run through list until we find the most recent tempo |
142 # before the end of the current bar | 136 # before the end of the current bar |
143 if event.type=="SET_TEMPO" and event.time>=barStartTime: | 137 if event.type=="SET_TEMPO" and event.time>=barStartTime: |
144 tempo = midi_event_to_qpm_tempo(event) | 138 tempo = midi_event_to_qpm_tempo(event) |
145 event.type = "USED_TEMPO" | 139 event.type = "USED_TEMPO" |
146 print tempo | |
147 # this event has been used now so remove it | |
148 #timeList.remove(event) | |
149 | |
150 | |
151 | 140 |
152 if tempo==None: | 141 if tempo==None: |
153 if currentTempo==None: | 142 if currentTempo==None: |
154 tempo = 120 | 143 tempo = 120 |
155 else: | 144 else: |
156 tempo = currentTempo | 145 tempo = currentTempo |
157 | 146 |
158 return tempo | 147 return tempo |
159 | 148 |
149 | |
150 | |
160 # get initial time sig and tempo or use defaults | 151 # get initial time sig and tempo or use defaults |
161 timeList = get_time_events(midiFile) | 152 timeList = get_time_events(midiFile) |
162 print timeList | |
163 | 153 |
164 # get notes from the midi file (absolute start times from start of file) | 154 # get notes from the midi file (absolute start times from start of file) |
165 notesList = get_notes_from_event_list(get_note_events(midiFile)) | 155 notesList = get_notes_from_event_list(get_note_events(midiFile)) |
166 | 156 |
167 | 157 |