示例#1
0
    def resolveAugmentedSixthSegment(self, segmentB):
        '''
        Can resolve a Segment whose :attr:`~music21.figuredBass.segment.Segment.segmentChord` 
        spells out a 
        French, German, or Swiss augmented sixth chord. Italian augmented sixth Segments 
        are solved as an
        ordinary Segment using :meth:`~music21.figuredBass.possibility.couldBeItalianA6Resolution`. 
        If no
        applicable method in :mod:`~music21.figuredBass.resolution` can be used, the Segment 
        is resolved
        as an ordinary Segment.
        
        
        >>> from music21.figuredBass import segment
        >>> from music21 import note
        >>> segmentA = segment.Segment(bassNote = note.Note("A-2"), notationString = "#6,b5,3")
        >>> segmentA.pitchNamesInChord # spell out a Gr+6 chord
        ['A-', 'C', 'E-', 'F#']
        >>> allAugSixthPossib = segmentA.allCorrectSinglePossibilities()
        >>> allAugSixthPossibList = list(allAugSixthPossib)
        >>> len(allAugSixthPossibList)
        7
        
        >>> allAugSixthPossibList[1]
        (<music21.pitch.Pitch C4>, <music21.pitch.Pitch F#3>, <...E-3>, <...A-2>)
        >>> allAugSixthPossibList[4]
        (<music21.pitch.Pitch C5>, <music21.pitch.Pitch F#4>, <...E-4>, <...A-2>)
        
        
        >>> segmentB = segment.Segment(bassNote = note.Note("G2"), notationString = "")
        >>> allAugResPossibPairs = segmentA.resolveAugmentedSixthSegment(segmentB)
        >>> allAugResPossibPairsList = list(allAugResPossibPairs)
        >>> len(allAugResPossibPairsList)
        7
        >>> allAugResPossibPairsList[1]
        ((<...C4>, <...F#3>, <...E-3>, <...A-2>), (<...B3>, <...G3>, <...D3>, <...G2>))
        >>> allAugResPossibPairsList[4]
        ((<...C5>, <...F#4>, <...E-4>, <...A-2>), (<...B4>, <...G4>, <...D4>, <...G2>))
        '''
        augSixthChord = self.segmentChord
        if not augSixthChord.isAugmentedSixth():
            #Put here for stand-alone purposes.
            raise SegmentException(
                "Augmented sixth resolution: Not an augmented sixth Segment.")
        if augSixthChord.isItalianAugmentedSixth():
            return self._resolveOrdinarySegment(segmentB)
        elif augSixthChord.isFrenchAugmentedSixth():
            augSixthType = 1
        elif augSixthChord.isGermanAugmentedSixth():
            augSixthType = 2
        elif augSixthChord.isSwissAugmentedSixth():
            augSixthType = 3
        else:
            self._environRules.warn(
                "Augmented sixth resolution: " +
                "Augmented sixth type not supported. Executing ordinary resolution."
            )
            return self._resolveOrdinarySegment(segmentB)

        tonic = resolution._transpose(augSixthChord.bass(), 'M3')
        majorScale = scale.MajorScale(tonic)
        #minorScale = scale.MinorScale(tonic)
        resChord = segmentB.segmentChord
        augSixthChordInfo = _unpackSeventhChord(augSixthChord)

        augmentedSixthResolutionMethods = [
            ((resChord.inversion() == 2 and resChord.root().name == tonic.name
              and resChord.isMajorTriad()),
             resolution.augmentedSixthToMajorTonic,
             [augSixthType, augSixthChordInfo]),
            ((resChord.inversion() == 2 and resChord.root().name == tonic.name
              and resChord.isMinorTriad()),
             resolution.augmentedSixthToMinorTonic,
             [augSixthType, augSixthChordInfo]),
            ((majorScale.pitchFromDegree(5).name == resChord.bass().name
              and resChord.isMajorTriad()),
             resolution.augmentedSixthToDominant,
             [augSixthType, augSixthChordInfo])
        ]

        try:
            return self._resolveSpecialSegment(
                segmentB, augmentedSixthResolutionMethods)
        except SegmentException:
            self._environRules.warn(
                "Augmented sixth resolution: No proper resolution available. "
                + "Executing ordinary resolution.")
            return self._resolveOrdinarySegment(segmentB)
示例#2
0
    def resolveAugmentedSixthSegment(self, segmentB):
        '''
        Can resolve a Segment whose :attr:`~music21.figuredBass.segment.Segment.segmentChord` 
        spells out a 
        French, German, or Swiss augmented sixth chord. Italian augmented sixth Segments 
        are solved as an
        ordinary Segment using :meth:`~music21.figuredBass.possibility.couldBeItalianA6Resolution`. 
        If no
        applicable method in :mod:`~music21.figuredBass.resolution` can be used, the Segment 
        is resolved
        as an ordinary Segment.
        
        
        >>> from music21.figuredBass import segment
        >>> from music21 import note
        >>> segmentA = segment.Segment(bassNote = note.Note("A-2"), notationString = "#6,b5,3")
        >>> segmentA.pitchNamesInChord # spell out a Gr+6 chord
        ['A-', 'C', 'E-', 'F#']
        >>> allAugSixthPossib = segmentA.allCorrectSinglePossibilities()
        >>> allAugSixthPossibList = list(allAugSixthPossib)
        >>> len(allAugSixthPossibList)
        7
        
        >>> allAugSixthPossibList[1]
        (<music21.pitch.Pitch C4>, <music21.pitch.Pitch F#3>, <...E-3>, <...A-2>)
        >>> allAugSixthPossibList[4]
        (<music21.pitch.Pitch C5>, <music21.pitch.Pitch F#4>, <...E-4>, <...A-2>)
        
        
        >>> segmentB = segment.Segment(bassNote = note.Note("G2"), notationString = "")
        >>> allAugResPossibPairs = segmentA.resolveAugmentedSixthSegment(segmentB)
        >>> allAugResPossibPairsList = list(allAugResPossibPairs)
        >>> len(allAugResPossibPairsList)
        7
        >>> allAugResPossibPairsList[1]
        ((<...C4>, <...F#3>, <...E-3>, <...A-2>), (<...B3>, <...G3>, <...D3>, <...G2>))
        >>> allAugResPossibPairsList[4]
        ((<...C5>, <...F#4>, <...E-4>, <...A-2>), (<...B4>, <...G4>, <...D4>, <...G2>))
        '''
        augSixthChord = self.segmentChord
        if not augSixthChord.isAugmentedSixth():
            #Put here for stand-alone purposes.
            raise SegmentException("Augmented sixth resolution: Not an augmented sixth Segment.")
        if augSixthChord.isItalianAugmentedSixth():
            return self._resolveOrdinarySegment(segmentB)
        elif augSixthChord.isFrenchAugmentedSixth():
            augSixthType = 1
        elif augSixthChord.isGermanAugmentedSixth():
            augSixthType = 2
        elif augSixthChord.isSwissAugmentedSixth():
            augSixthType = 3
        else:
            self._environRules.warn("Augmented sixth resolution: " + 
                    "Augmented sixth type not supported. Executing ordinary resolution.")
            return self._resolveOrdinarySegment(segmentB)

        tonic = resolution._transpose(augSixthChord.bass(), 'M3')
        majorScale = scale.MajorScale(tonic)
        #minorScale = scale.MinorScale(tonic)
        resChord = segmentB.segmentChord
        augSixthChordInfo = _unpackSeventhChord(augSixthChord)

        augmentedSixthResolutionMethods = [
         ((resChord.inversion() == 2 and 
                resChord.root().name == tonic.name and 
                resChord.isMajorTriad()), 
          resolution.augmentedSixthToMajorTonic, [augSixthType, augSixthChordInfo]),
         ((resChord.inversion() == 2 and 
                resChord.root().name == tonic.name and 
                resChord.isMinorTriad()), 
          resolution.augmentedSixthToMinorTonic, 
          [augSixthType, augSixthChordInfo]),
         ((majorScale.pitchFromDegree(5).name == resChord.bass().name and 
                resChord.isMajorTriad()), 
          resolution.augmentedSixthToDominant, 
          [augSixthType, augSixthChordInfo])
        ]
        
        try:
            return self._resolveSpecialSegment(segmentB, augmentedSixthResolutionMethods)
        except SegmentException:
            self._environRules.warn(
                "Augmented sixth resolution: No proper resolution available. " + 
                "Executing ordinary resolution.")
            return self._resolveOrdinarySegment(segmentB)