Beispiel #1
0
 def playMusic(self):
     #plays the music shown on the piano roll
     if self.midiFile==None:
         self.createTimingTrack()
         self.playNoteTimingTrack()
     else:
         playMidi=PlayMidi(self.midiFile)
         self.noteTimingList=playMidi.combineTracks(self.ticksPerBeat)
         self.playNoteTimingTrack()
Beispiel #2
0
 def importMidiFile(self):
     #takes in midi file through dialog, and displays notes on piano roll
     self.initAnimation()
     self.midiFile=tkFileDialog.askopenfilename(filetypes=[(
                                                 'all files','.mid')])
     slashI=-1 #resets the parameters on piano roll
     for i in xrange(len(self.midiFile)-1,-1,-1):
         if self.midiFile[i]=='/': #finds i of last slash
             slashI=i
             break
     self.fileName=self.midiFile[slashI+1:] #for rewriting name
     self.midi=Midi(self.midiFile)
     playMidi=PlayMidi(self.midiFile)
     self.noteTimingList=playMidi.combineTracks(self.ticksPerBeat)
     self.convertTimingTrackToNoteList()
     self.correctSliderPosition() #new notes, change slider position