예제 #1
0
파일: hasher.py 프로젝트: willingc/music21
 def _hashIntervalFromLastNote(self, e, thisChord=None):
     """
     returns the interval between last note and current note, if extant
     known issues with first note of every measure in transposed pieces
     returns 0 if things don't work
     """
     try:
         if (isinstance(e, note.Note) 
                 and e.previous('Note', flattenLocalSites=True) is not None):
             previousNote = e.previous('Note', flattenLocalSites=True)
             intFromLastNote = interval.Interval(noteStart=previousNote, 
                                                 noteEnd=e).intervalClass
             return interval.convertGeneric(interval.Interval(intFromLastNote).intervalClass)
     except TypeError:
         return 0
예제 #2
0
 def _hashIntervalFromLastNote(self, e, thisChord=None):
     """
     returns the interval between last note and current note, if extant
     known issues with first note of every measure in transposed pieces
     returns 0 if things don't work
     """
     try:
         if (isinstance(e, note.Note) and e.previous(
                 'Note', flattenLocalSites=True) is not None):
             previousNote = e.previous('Note', flattenLocalSites=True)
             intFromLastNote = interval.Interval(noteStart=previousNote,
                                                 noteEnd=e).intervalClass
             return interval.convertGeneric(
                 interval.Interval(intFromLastNote).intervalClass)
     except TypeError:
         return 0