示例#1
0
    def translateChord(self, currentChord):
        try:
            allNotes = sorted(currentChord._notes, key=lambda n: n.pitch)
        except AttributeError:
            raise BrailleBasicException(
                "If you're getting this exception, " +
                "the '_notes' attribute for a music21 Chord probably " +
                "became 'notes'. If that's the case, change it and life will be great."
            )
        if self.brailleElementGrouping.descendingChords:
            currentNote = allNotes[-1]
        else:
            currentNote = allNotes[0]
        if self.previousNote is None:
            doShowOctave = self.showLeadingOctave
        else:
            doShowOctave = basic.showOctaveWithNote(self.previousNote,
                                                    currentNote)

        descendingChords = self.brailleElementGrouping.descendingChords
        brailleChord = basic.chordToBraille(currentChord,
                                            descending=descendingChords,
                                            showOctave=doShowOctave)
        self.previousNote = currentNote
        return brailleChord
示例#2
0
 def translateNote(self, currentNote):
     if self.previousNote is None:
         doShowOctave = self.showLeadingOctave
     else:
         doShowOctave = basic.showOctaveWithNote(self.previousNote, currentNote)
     brailleNote = basic.noteToBraille(currentNote,
                                       showOctave=doShowOctave,
                                       upperFirstInFingering=self.upperFirstInFingering)
     self.previousNote = currentNote
     return brailleNote
示例#3
0
 def translateNote(self, currentNote):
     if self.previousNote is None:
         doShowOctave = self.showLeadingOctave
     else:
         doShowOctave = basic.showOctaveWithNote(self.previousNote, currentNote)
     brailleNote = basic.noteToBraille(currentNote,
                                       showOctave=doShowOctave,
                                       upperFirstInFingering=self.upperFirstInFingering)
     self.previousNote = currentNote
     return brailleNote
示例#4
0
    def translateChord(self, currentChord):
        allNotes = sorted(currentChord.notes, key=lambda n: n.pitch)

        if self.brailleElementGrouping.descendingChords:
            currentNote = allNotes[-1]
        else:
            currentNote = allNotes[0]
        if self.previousNote is None:
            doShowOctave = self.showLeadingOctave
        else:
            doShowOctave = basic.showOctaveWithNote(self.previousNote, currentNote)

        descendingChords = self.brailleElementGrouping.descendingChords
        brailleChord = basic.chordToBraille(currentChord,
                                            descending=descendingChords,
                                            showOctave=doShowOctave)
        self.previousNote = currentNote
        return brailleChord
示例#5
0
    def translateChord(self, currentChord):
        try:
            allNotes = sorted(currentChord._notes, key=lambda n: n.pitch)
        except AttributeError:
            raise BrailleBasicException(
                    "If you're getting this exception, " +
                    "the '_notes' attribute for a music21 Chord probably " +
                    "became 'notes'. If that's the case, change it and life will be great.")
        if self.brailleElementGrouping.descendingChords:
            currentNote = allNotes[-1]
        else:
            currentNote = allNotes[0]
        if self.previousNote is None:
            doShowOctave = self.showLeadingOctave
        else:
            doShowOctave = basic.showOctaveWithNote(self.previousNote, currentNote)

        descendingChords = self.brailleElementGrouping.descendingChords
        brailleChord = basic.chordToBraille(currentChord,
                                          descending=descendingChords,
                                          showOctave=doShowOctave)
        self.previousNote = currentNote
        return brailleChord