Example #1
0
 def _playMIDINow(self, measureList, score):
     if self.kit is None or self._midiOut is None:
         return
     baseTime = 0
     msPerBeat = 60000.0 / score.scoreData.bpm
     self._measureDetails = []
     try:
         for measure, measureIndex in measureList:
             times = list(measure.counter.iterTimesMs(msPerBeat))
             baseTime += times[-1]
             self._measureDetails.append((measureIndex, baseTime))
         self._measureDetails.reverse()
         del self._midiOut
         self._midiOut = None
         midi = StringIO.StringIO()
         exportMidi(measureList, score, midi)
         midi.seek(0, 0)
         pygame.mixer.music.load(midi)
         pygame.mixer.music.play()
         self._songStart = time.clock()
         self._musicPlaying = True
     except:
         self.timer.timeout.emit()
         raise
     self.timer.start(baseTime + 500)
     self._measureTimer.start(0)
Example #2
0
 def _playMIDINow(self, measureList, score):
     if self.kit is None or self._midiOut is None:
         return
     baseTime = 0
     msPerBeat = 60000.0 / score.scoreData.bpm
     self._measureDetails = []
     try:
         for measure, measureIndex in measureList:
             times = list(measure.counter.iterTimesMs(msPerBeat))
             baseTime += times[-1]
             self._measureDetails.append((measureIndex, baseTime))
         self._measureDetails.reverse()
         del self._midiOut
         self._midiOut = None
         midi = StringIO.StringIO()
         exportMidi(measureList, score, midi)
         midi.seek(0, 0)
         pygame.mixer.music.load(midi)
         pygame.mixer.music.play()
         self._songStart = time.clock()
         self._musicPlaying = True
     except:
         self.timer.timeout.emit()
         raise
     self.timer.start(baseTime + 500)
     self._measureTimer.start(0)
Example #3
0
 def _playMIDINow(self, measureList, score):
     if self.kit is None or self._midiOut is None:
         return
     baseTime = 0
     bpm = score.scoreData.bpm
     swing = score.scoreData.swing
     msPerBeat = 60000.0 / bpm
     self._measureDetails = []
     lastMeasureIndex = None
     try:
         for measure, measureIndex in measureList:
             if lastMeasureIndex is None or measureIndex != lastMeasureIndex + 1:
                 bpm = score.bpmAtMeasureByIndex(measureIndex)
             elif measure.newBpm > 0 and bpm != measure.newBpm:
                 bpm = measure.newBpm
             if bpm == 0:
                 bpm = 120
             lastMeasureIndex = measureIndex
             msPerBeat = 60000.0 / bpm
             times = list(measure.counter.iterTimesMs(msPerBeat, swing))
             baseTime += times[-1]
             self._measureDetails.append((measureIndex, baseTime))
         self._measureDetails.reverse()
         del self._midiOut
         self._midiOut = None
         midi = StringIO.StringIO()
         exportMidi(measureList, score, midi)
         midi.seek(0, 0)
         pygame.mixer.music.load(midi)
         pygame.mixer.music.play()
         self._songStart = time.clock()
         self._musicPlaying = True
     except:
         self.timer.timeout.emit()
         raise
     self.timer.start(baseTime + 500)
     self._measureTimer.start(0)
Example #4
0
 def _playMIDINow(self, measureList, score):
     if self.kit is None or self._midiOut is None:
         return
     baseTime = 0
     bpm = score.scoreData.bpm
     msPerBeat = 60000.0 / bpm
     self._measureDetails = []
     lastMeasureIndex = None
     try:
         for measure, measureIndex in measureList:
             if lastMeasureIndex is None or measureIndex != lastMeasureIndex + 1:
                 bpm = score.bpmAtMeasureByIndex(measureIndex)
             elif measure.newBpm > 0 and bpm != measure.newBpm:
                 bpm = measure.newBpm
             if bpm == 0:
                 bpm = 120
             lastMeasureIndex = measureIndex
             msPerBeat = 60000.0 / bpm
             times = list(measure.counter.iterTimesMs(msPerBeat))
             baseTime += times[-1]
             self._measureDetails.append((measureIndex, baseTime))
         self._measureDetails.reverse()
         del self._midiOut
         self._midiOut = None
         midi = StringIO.StringIO()
         exportMidi(measureList, score, midi)
         midi.seek(0, 0)
         pygame.mixer.music.load(midi)
         pygame.mixer.music.play()
         self._songStart = time.clock()
         self._musicPlaying = True
     except:
         self.timer.timeout.emit()
         raise
     self.timer.start(baseTime + 500)
     self._measureTimer.start(0)