コード例 #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 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
コード例 #3
0
ファイル: noteGrouping.py プロジェクト: cuthbertLab/music21
    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