
    rhCn                       S r SSKJr  SSKrSSKrSSKJr  SSKJr  SSKJ	r	  SSKJ
r
  \
R                  " S5      r " S	 S
\R                  5      rS rSS jrSS jrSS jrS rSS jrS r    SS jrSS jrS rS S jrS!S jrS rS r " S S\R:                  5      r\\\\\\\\\\\\\/r\ S:X  a  SSKr\RB                  " \5        gg)"z
This module defines the L, P, and R objects and their
related transformations as called on a :class:`~music21.chord.Chord`,
according to Neo-Riemannian theory.
    )annotationsN)exceptions21)chord)enharmonics)environmentzanalysis.neoRiemannianc                      \ rS rSrSrg)LRPException!    N)__name__
__module____qualname____firstlineno____static_attributes__r       X/home/james-whalen/.local/lib/python3.13/site-packages/music21/analysis/neoRiemannian.pyr	   r	   !   s    r   r	   c                    U R                    Vs/ s H  oR                  PM     nn[        R                  " U5      nUR	                  5       n[
        R                  " U 5      nXEl         U$ s  snf )au  
Returns a copy of chord `c` with pitches simplified.

Uses `:meth:music21.analysis.enharmonics.EnharmonicSimplifier.bestPitches`

>>> c = chord.Chord('B# F- G')
>>> c2 = analysis.neoRiemannian._simplerEnharmonics(c)
>>> c2
<music21.chord.Chord C E G>
>>> c3 = analysis.neoRiemannian._simplerEnharmonics(c2)

Returns a copy even if nothing has changed.

>>> c2 is c3
False
)pitchesnameWithOctaver   EnharmonicSimplifierbestPitchescopydeepcopy)cp	pitchListes
newPitchesnewChords         r   _simplerEnharmonicsr    $   sZ    $ ,-9959a!!9I5		)	))	4B!J}}QH!O 6s   A*c                    U R                  5       (       a  SnU R                  5       nO6U R                  5       (       a  SnU R                  nOUSL a  [	        S5      eU $ [        XU5      nU R                  Ul        U$ )a  
L transforms a major or minor triad through the 'Leading-Tone exchange'.
A C major chord, under L, will return an E minor chord, by transforming the root
to its leading tone, B.

>>> c1 = chord.Chord('C4 E4 G4')
>>> c2 = analysis.neoRiemannian.L(c1)
>>> c2.pitches
(<music21.pitch.Pitch B3>, <music21.pitch.Pitch E4>, <music21.pitch.Pitch G4>)

Chords must be major or minor triads:

>>> c3 = chord.Chord('C4 D4 E4')
>>> analysis.neoRiemannian.L(c3)
Traceback (most recent call last):
music21.analysis.neoRiemannian.LRPException: Cannot perform L on this chord:
    not a major or minor triad

If `raiseException` is `False` then the original chord is returned.

>>> c4 = analysis.neoRiemannian.L(c3, raiseException=False)
>>> c4 is c3
True

Accepts any music21 chord, with or without octave specified:

>>> noOctaveChord = chord.Chord([0, 3, 7])
>>> chordL = analysis.neoRiemannian.L(noOctaveChord)
>>> chordL.pitches
(<music21.pitch.Pitch C>, <music21.pitch.Pitch E->, <music21.pitch.Pitch A->)
z-m2m2Tz:Cannot perform L on this chord: not a major or minor triad)isMajorTriadrootisMinorTriadfifthr	   _singlePitchTransformquarterLengthr   raiseExceptiontransposeIntervalchangingPitchoutChords        r   Lr.   =   su    B 	~~!	
		 T![\\$Q=IH__HOr   c                    U R                  5       (       a  SnU R                  nO6U R                  5       (       a  SnU R                  nOUSL a  [        S5      eU $ [	        XU5      nU R
                  Ul        U$ )ad  
P transforms a major or minor triad chord to its 'parallel':
i.e. to the chord of the same diatonic name but opposite model.

Example: A C major chord, under P, will return an C minor chord

>>> c2 = chord.Chord('C4 E4 G4')
>>> c3 = analysis.neoRiemannian.P(c2)
>>> c3.pitches
(<music21.pitch.Pitch C4>, <music21.pitch.Pitch E-4>, <music21.pitch.Pitch G4>)

See :func:`~music21.analysis.neoRiemannian.L` for further details about error handling.

OMIT_FROM_DOCS

>>> c3 = chord.Chord('C4 D4 E4')
>>> analysis.neoRiemannian.P(c3)
Traceback (most recent call last):
music21.analysis.neoRiemannian.LRPException...
z-A1A1Tz:Cannot perform P on this chord: not a Major or Minor triad)r#   thirdr%   r	   r'   r(   r)   s        r   Pr2   n   sr    * 	~~!	
		 T![\\$Q=IH__HOr   c                    U R                  5       (       a  SnU R                  nO:U R                  5       (       a  SnU R                  5       nOUSL a  [	        S5      eU $ [        XU5      nU R                  Ul        U$ )ag  
R transforms a major or minor triad to its relative, i.e. if
major, to its relative minor and if minor, to its relative major.

Example 1: A C major chord, under R, will return an A minor chord

>>> c1 = chord.Chord('C4 E4 G4')
>>> c2 = analysis.neoRiemannian.R(c1)
>>> c2.pitches
(<music21.pitch.Pitch C4>, <music21.pitch.Pitch E4>, <music21.pitch.Pitch A4>)

See :func:`~music21.analysis.neoRiemannian.L` for further details about error handling.

OMIT_FROM_DOCS

>>> c3 = chord.Chord('C4 D4 E4')
>>> analysis.neoRiemannian.R(c3)
Traceback (most recent call last):
music21.analysis.neoRiemannian.LRPException...
M2z-M2Tz:Cannot perform R on this chord: not a Major or Minor triad)r#   r&   r%   r$   r	   r'   r(   r)   s        r   Rr5      st    * 	~~ 	
		!T![\\$Q=IH__HOr   c                   [         R                  " U5      n[         R                  " U 5      n[        [        UR                  5      5       H]  nSUR                  U   l        UR                  UR                  U   R                  :X  d  M@  UR                  U   R                  USS9  M_     [        R                  " UR                  5      $ )zp
Performs a neoRiemannian transformation on c that involves transposing `changingPitch` by
`transposeInterval`.
FT)inPlace)
r   r   rangelenr   spellingIsInferredname	transposer   Chord)r   r+   r,   changingPitchCopyr   is         r   r'   r'      s    
 m4}}QH3x''()16.!!X%5%5a%8%=%==Q))*;T)J * ;;x''((r   c                $   UR                   nU H~  nUS:X  a  [        U 5      nUR                   U:X  a    gM(  US:X  a  [        U 5      nUR                   U:X  a    gMM  US:X  a  [        U 5      nUR                   U:X  a    gMr  [	        U S35      e   g)aV  
Tests if two chords are related by a single L, P, R transformation,
and returns that transform if so (otherwise, False).

>>> c1 = chord.Chord('C4 E4 G4')
>>> c2 = chord.Chord('B3 E4 G4')
>>> analysis.neoRiemannian.isNeoR(c1, c2)
'L'

>>> c1 = chord.Chord('C4 E4 G4')
>>> c2 = chord.Chord('C4 E-4 G4')
>>> analysis.neoRiemannian.isNeoR(c1, c2)
'P'

>>> c1 = chord.Chord('C4 E4 G4')
>>> c2 = chord.Chord('C4 E4 A4')
>>> analysis.neoRiemannian.isNeoR(c1, c2)
'R'

>>> c1 = chord.Chord('C4 E4 G4')
>>> c2 = chord.Chord('C-4 E-4 A-4')
>>> analysis.neoRiemannian.isNeoR(c1, c2)
False

Option to limit to the search to only 1-2 transforms ('L', 'R', 'P', 'LR', 'LP', 'RP'). So:

>>> c3 = chord.Chord('C4 E-4 G4')
>>> analysis.neoRiemannian.isNeoR(c1, c3)
'P'

... but not if P is excluded ...

>>> analysis.neoRiemannian.isNeoR(c1, c3, transforms='LR')
False
r.   r5   r2   3 is not a NeoRiemannian transformation (L, R, or P)F)normalOrderr.   r5   r2   r	   )c1c2
transformsc2NOr?   r   s         r   isNeoRrG      s    L >>D8"A}}$ %#X"A}}$ %#X"A}}$ % !$WXYY   r   c                p    / SQnUR                   nU H   n[        XS9nUR                   U:X  d  M  Us  $    g)au  
Tests if there is a chromatic mediant relation between two chords
and returns the type if so (otherwise, False).

>>> c1 = chord.Chord('C4 E4 G4')
>>> c2 = chord.Chord('A-3 C4 E-4')
>>> analysis.neoRiemannian.isChromaticMediant(c1, c2)
'LFM'

>>> c3 = chord.Chord('C4 E4 G4')
>>> c4 = chord.Chord('C-4 E-4 A-4')
>>> analysis.neoRiemannian.isChromaticMediant(c3, c4)
False
UFMUSMLFMLSMtransformationF)rB   chromaticMediants)rC   rD   transformListrF   	transform	thisChords         r   isChromaticMediantrT     s?    " 1M>>D"	%bC	  D( #
 r   c                   U R                  5       (       d+  U R                  5       (       d  USL a  [        SU  S35      eU $ U(       a  USSS2   n/ nU H  nUS:X  a;  [        U 5      n U(       a'  UR	                  [
        R                  " U 5      5        MB  MD  US:X  a;  [        U 5      n U(       a'  UR	                  [
        R                  " U 5      5        M  M  US:X  a;  [        U 5      n U(       a'  UR	                  [
        R                  " U 5      5        M  M  [        U S	35      e   U(       a%  U(       d  U$ U Vs/ s H  n[        U5      PM     sn$ U(       d  U $ [        U 5      $ s  snf )
a
  
LRP_combinations takes a major or minor triad, transforms it according to the
list of L, R, and P transformations in the given transformationString, and
returns the result in triad.
Certain combinations, such as LPLPLP, are cyclical, and therefore
will return a copy of the original chord if `simplifyEnharmonics` = `True` (see
:func:`~music21.analysis.neoRiemannian.completeHexatonic`, below).

`leftOrdered` allows a user to work with their preferred function notation (left or right
orthography).

By default, `leftOrdered` is False, so transformations progress towards the right.
Thus, 'LPR' will start by transforming the chord by L, then P, then R.

If `leftOrdered` is True, the operations work in the opposite direction (right to left), so
'LPR' indicates the result of the chord transformed by R, then P, then L.

`simplifyEnharmonics` replaces multiple sharps and flats where they arise from
combined transformations with the simpler enharmonic equivalent (e.g. C for D--).
If simplifyEnharmonics is True, the resulting chord will be simplified
to a collection of notes with at most 1 flat or 1 sharp, in their most common form.

>>> c1 = chord.Chord('C4 E4 G4')
>>> c2 = analysis.neoRiemannian.LRP_combinations(c1, 'LP')
>>> c2
<music21.chord.Chord B3 E4 G#4>

>>> c2b = analysis.neoRiemannian.LRP_combinations(c1, 'LP', leftOrdered=True)
>>> c2b
<music21.chord.Chord C4 E-4 A-4>

>>> c3 = chord.Chord('C4 E4 G4 C5 E5')
>>> c4 = analysis.neoRiemannian.LRP_combinations(c3, 'RLP')
>>> c4
<music21.chord.Chord C4 F4 A-4 C5 F5>

>>> c5 = chord.Chord('B4 D#5 F#5')
>>> c6 = analysis.neoRiemannian.LRP_combinations(c5,
...                        'LPLPLP', leftOrdered=True, simplifyEnharmonics=True)
>>> c6
<music21.chord.Chord B4 D#5 F#5>
>>> c5 = chord.Chord('C4 E4 G4')
>>> c6 = analysis.neoRiemannian.LRP_combinations(c5, 'LPLPLP', leftOrdered=True)
>>> c6
<music21.chord.Chord D--4 F-4 A--4>
>>> c5 = chord.Chord('A-4 C4 E-5')
>>> c6 = analysis.neoRiemannian.LRP_combinations(c5, 'LPLPLP')
>>> c6
<music21.chord.Chord G#4 B#3 D#5>

Optionally: return all chords creating by the given string in order.

>>> c7 = chord.Chord('C4 E4 G4')
>>> c8 = analysis.neoRiemannian.LRP_combinations(
...            c7, 'LPLPLP', simplifyEnharmonics=True, eachOne=True)
>>> c8
[<music21.chord.Chord B3 E4 G4>,
<music21.chord.Chord B3 E4 G#4>,
<music21.chord.Chord B3 D#4 G#4>,
<music21.chord.Chord C4 E-4 A-4>,
<music21.chord.Chord C4 E-4 G4>,
<music21.chord.Chord C4 E4 G4>]

On that particular case of LPLPLP, see more in
:func:`~music21.analysis.neoRiemannian.completeHexatonic`.
Tz(Cannot perform transformations on chord z: not a major or minor triadNr.   r5   r2   rA   )
r#   r%   r	   r.   appendr   r   r5   r2   r    )	r   transformationStringr*   leftOrderedsimplifyEnharmonicseachOne	chordListr?   xs	            r   LRP_combinationsr^     sK   T >>ANN$4$4T!:1#=YZ\ \3DbD9I!8!A  q!12 #X!A  q!12 #X!A  q!12  !$WXYY "  "4=>Iq'*I>>"H&q)) ?s   >E*c                    U R                   S:X  aZ  / nU n[        [        [        [        [        [        /nU H.  nU" U5      nU(       a  [        U5      nUR	                  U5        M0     U$ USL a  [        S5      eg)a  
completeHexatonic returns the list of six triads generated by the operation PLPLPL.
This six-part operation cycles between major and minor triads, ultimately returning to the
input triad (or its enharmonic equivalent).
This functions returns those six triads, ending with the original triad.

`simplifyEnharmonics` is False, by default, giving double flats at the end.

>>> c1 = chord.Chord('C4 E4 G4')
>>> analysis.neoRiemannian.completeHexatonic(c1)
[<music21.chord.Chord C4 E-4 G4>,
 <music21.chord.Chord C4 E-4 A-4>,
 <music21.chord.Chord C-4 E-4 A-4>,
 <music21.chord.Chord C-4 F-4 A-4>,
 <music21.chord.Chord C-4 F-4 A--4>,
 <music21.chord.Chord D--4 F-4 A--4>]

`simplifyEnharmonics` can be set to True in order to avoid this.

>>> c2 = chord.Chord('C4 E4 G4')
>>> analysis.neoRiemannian.completeHexatonic(c2, simplifyEnharmonics=True)
[<music21.chord.Chord C4 E-4 G4>,
 <music21.chord.Chord C4 E-4 A-4>,
 <music21.chord.Chord B3 D#4 G#4>,
 <music21.chord.Chord B3 E4 G#4>,
 <music21.chord.Chord B3 E4 G4>,
 <music21.chord.Chord C4 E4 G4>]
z3-11TzHCannot perform transformations on this chord: not a major or minor triadN)forteClassTnIr2   r.   r    rW   r	   )r   rZ   r*   hexatonicList	lastChord
operations	operations          r   completeHexatonicre     s    : 	& 	Aq!Q'
#I!),I"/	:	  +	 $
 T!Z\ \ "r   c                    U R                  5       nUR                  n1 SkS41 SkS41 SkS41 SkS4/nU H  u  pEX$;   d  M  Us  $    [        S	5      e)
aX  
Returns a lowercase string representing the
"hexatonic system" that the chord `c` belongs to
as classified by Richard Cohn, "Maximally Smooth Cycles,
Hexatonic Systems, and the Analysis of Late-Romantic
Triadic Progressions," *Music Analysis*, 15.1 (1996), 9-40,
at p. 17.  Possible values are 'northern', 'western', 'eastern', or 'southern'

>>> cMaj = chord.Chord('C E G')
>>> analysis.neoRiemannian.hexatonicSystem(cMaj)
'northern'

>>> gMin = chord.Chord('G B- D')
>>> analysis.neoRiemannian.hexatonicSystem(gMin)
'western'

Each chord in the :func:`~music21.analysis.neoRiemannian.completeHexatonic` of that chord
is in the same hexatonic system, by definition or tautology.

>>> for ch in analysis.neoRiemannian.completeHexatonic(cMaj):
...     print(analysis.neoRiemannian.hexatonicSystem(ch))
northern
northern
northern
northern
northern
northern

Note that the classification looks only at the
pitch class of the root of the chord.  Seventh chords,
diminished triads, etc. will also be classified.

>>> dDom65 = chord.Chord('F#4 D5 A5 C6')
>>> analysis.neoRiemannian.hexatonicSystem(dDom65)
'southern'
>   r         northern>         	   eastern>         
   southern>            westernz'Odd pitch class that is not in 0 to 11!)r$   
pitchClassr	   )r   r$   rootPCmappingspcSetpoleNames         r   hexatonicSystemr{     sf    L 668D__FJ'I&Z(Y'H
 $?O $ @
AAr   c                   / SQnX;  a  [        SU 35      eSnUS:X  a  SnOUS:X  a  SnOUS:X  a  S	nU R                  5       (       a  S
nO#U R                  5       (       a  SnO[        S5      e[        XUS9n [	        U 5      $ )a  
Transforms a chord into the given chromatic mediant. Options:
UFM = Upper Flat Mediant;
USM = Upper Sharp Mediant;
LFM = Lower Flat Mediant ;
LSM = Lower Sharp Mediant;

Each of these transformations
is mode-preserving;
involves root motion by a third;
entails exactly one common-tone.

>>> cMaj = chord.Chord('C5 E5 G5')
>>> UFMcMaj = analysis.neoRiemannian.chromaticMediants(cMaj, transformation='UFM')
>>> UFMcMaj.normalOrder
[3, 7, 10]

>>> USMcMaj = analysis.neoRiemannian.chromaticMediants(cMaj, transformation='USM')
>>> USMcMaj.normalOrder
[4, 8, 11]

>>> LFMcMaj = analysis.neoRiemannian.chromaticMediants(cMaj, transformation='LFM')
>>> [x.nameWithOctave for x in LFMcMaj.pitches]
['C5', 'E-5', 'A-5']

>>> LSMcMaj = analysis.neoRiemannian.chromaticMediants(cMaj, transformation='LSM')
>>> [x.nameWithOctave for x in LSMcMaj.pitches]
['C#5', 'E5', 'A5']

Fine to call on a chord with multiple enharmonics,
but will always simplify the output chromatic mediant.

>>> cMajEnh = chord.Chord('D--5 F-5 A--5')
>>> USM = analysis.neoRiemannian.chromaticMediants(cMaj, transformation='USM')
>>> [x.nameWithOctave for x in USM.pitches]
['B4', 'E5', 'G#5']
>>> USM.normalOrder == USMcMaj.normalOrder
True
rI   zTransformation must be one of PRrK   LPrL   PLrM   RPTFChord must be major or minorrY   )
ValueErrorr%   r#   r^   r    )r   rO   optionsrX   LOs        r   rP   rP     s    R +G$9'CDD#	5	 #	5	 #~~	
		788bAAq!!r   c                    SS/nX;  a  [        SU 35      eSnU R                  5       (       a	  US:X  a  SnO)U R                  5       (       a	  US:X  a  SnO[        S5      e[        X5      n [	        U 5      $ )a  
Transforms a chord into the upper or lower disjunct mediant.
These transformations involve:
root motion by a non-diatonic third;
mode-change;
no common-tones.

>>> cMaj = chord.Chord('C5 E5 G5')
>>> upr = analysis.neoRiemannian.disjunctMediants(cMaj, upperOrLower='upper')
>>> [x.name for x in upr.pitches]
['B-', 'E-', 'G-']
>>> lwr = analysis.neoRiemannian.disjunctMediants(cMaj, upperOrLower='lower')
>>> [x.name for x in lwr.pitches]
['B', 'D#', 'G#']
upperlowerzupperOrLower must be one of PRPPLPr   )r   r#   r%   r^   r    )r   upperOrLowerr   rX   s       r   disjunctMediantsr   4  s    "  G"7yABB ~~7"#( 	
		7"#( 7881Aq!!r   c                    [        U SSS9$ )a  
Slide transform connecting major and minor triads with the third as the single common tone
(i.e. with the major triad root a semi-tone below the minor). So:
root motion by a semi-tone;
mode-change;
one common-tones.
Slide is equivalent to 'LPR'.

>>> cMaj = chord.Chord('C5 E5 G5')
>>> slideUp = analysis.neoRiemannian.S(cMaj)
>>> [x.name for x in slideUp.pitches]
['C#', 'E', 'G#']

>>> aMin = chord.Chord('A4 C5 E5')
>>> slideDown = analysis.neoRiemannian.S(aMin)
>>> [x.name for x in slideDown.pitches]
['A-', 'C', 'E-']
LPRFrZ   r^   r   s    r   Sr   X  s    ( Au%@@r   c                    [        U SSS9$ )a  
The 'Neberverwandt' ('fifth-change') transform connects
a minor triad with its major dominant, and so also
a major triad with its minor sub-dominant,
with one common tone in each case.
This is equivalent to 'RLP'.

>>> cMaj = chord.Chord('C5 E5 G5')
>>> n1 = analysis.neoRiemannian.N(cMaj)
>>> [x.name for x in n1.pitches]
['C', 'F', 'A-']

>>> aMin = chord.Chord('A4 C5 E5')
>>> n2 = analysis.neoRiemannian.N(aMin)
>>> [x.name for x in n2.pitches]
['G#', 'B', 'E']
RLPFr   r   r   s    r   Nr   n  s    & Au%@@r   c                  8    \ rS rSrS rS rS rS rS rS r	Sr
g	)
Testi  c                   [         R                  " S5      n[        U5      n[        U5      nU R	                  [        U5      S5        U R                  U[         R                  5        U R	                  [        U5      S5        [         R                  " S5      n[        R                  " U5      n[        S5       H  n[        U5      nM     U R	                  UR                  UR                  5        [         R                  " S5      n[        R                  " U5      n[        S5       H  n[        U5      nM     U R	                  UR                  UR                  5        [         R                  " S5      n[        R                  " U5      n[        S5       H  n[        U5      nM     U R	                  UR                  UR                  5        g )N	C4 E-4 G4z <music21.chord.Chord C4 E-4 A-4>z<music21.chord.Chord C4 E4 G4>zC4 E4 G4 C5 C5 G5rg   zC4 E4 G4 C5 E5 G5)r   r=   r.   r2   assertEqualstrassertIsInstancer   r   r8   r   r5   )selfrD   c2_Lc2_Pc5copyC5r?   s          r    testNeoRiemannianTransformations%Test.testNeoRiemannianTransformations  sD   [[%uuT$FGdEKK0T$DE[[,-r"qA2B 4[[,-r"qA2B 4[[,-r"qA2B 4r   c                   [         R                  " S5      n[        US5      nU R                  [	        U5      S5        [         R                  " S5      n[        US5      nU R                  [	        U5      S5        [         R                  " S5      n[        USSS9nU R                  [	        U5      S	5        [         R                  " S
5      n[        US5      nU R                  [	        U5      S5        [         R                  " S5      n	[        U	SSS9n
U R                  X5        U R                  [        5         [        U	SSS9  S S S 5        [         R                  " S5      nU R                  [        5         [        USSS9  S S S 5        [         R                  " S5      n[        USSS9nU R                  [         R                  " S5      R                  UR                  5        g ! , (       d  f       N= f! , (       d  f       N{= f)NC4 E4 G4r~   z<music21.chord.Chord B3 E4 G#4>zC4 E4 G4 C5 E5r   z%<music21.chord.Chord C4 F4 A-4 C5 F5>Tr   z'<music21.chord.Chord C4 E-4 A-4 C5 E-5>C-4 E-4 G-4z <music21.chord.Chord B-3 E-4 G4>zB- D# F#F)r*   zB# F G#B# E# G#zC# E G#)	r   r=   r^   r   r   assertIsassertRaisesr	   r   )r   r   c5_Tc6c6_Tc7c7_Tc8c8_Td_sharp_min_misspelledd_sharp_min_transformedf_min_misspellede_sharp_mine_sharp_min_transformeds                 r   testNeoRiemannianCombinations"Test.testNeoRiemannianCombinations  s   [[$D)T$EF[[)*E*T$KL[[)*Dd;T$MN[['D)T$FG!&Z!8"23I4BG#I,F|,3T$O - !;;y1|,-tDI - kk*-"2;UY"ZY/779P9X9XY -, -,s   ;G*:G;*
G8;
H	c                d   [         R                  " S5      n[         R                  " S5      n[        X5      nU R                  US5        [         R                  " S5      n[        X5      nU R                  US5        [        XSS9nU R	                  U5        [         R                  " S5      n[        X5      nU R                  US	5        [         R                  " S
5      n[        X5      n	U R                  U	S5        [         R                  " S5      n
[        X5      n[        X5      nU R	                  U5        U R	                  U5        [         R                  " S5      n[         R                  " S5      n[        X5      n[        X5      nU R	                  U5        U R                  US5        g )Nr   zB3 E4 G4r.   r   r2   LR)rE   zC4 E4 A4r5   z
C4 E-4 A-4rL   zC-4 E-4 A-4r   zC-4 E--4 A--4)r   r=   rG   r   assertFalserT   )r   rC   rD   ans1c3ans2c4ans3r   ans4r   ans5ans6r   r   ans7ans8s                    r   
testIsNeoRTest.testIsNeoR  sQ   [[$[[$b~s#[[%b~s#b.[[$b~s#[[&!")u%[['b~!")[['[[)b~!")u%r   c                4   [         R                  " S5      n[         R                  " S5      n[        USS9nU R                  UR                  / SQ5        [        USS9nU R                  UR                  / SQ5        [        USS9nU R                  UR
                   Vs/ s H  ofR                  PM     sn/ S	Q5        [        US
S9nU R                  UR
                   Vs/ s H  ofR                  PM     sn/ SQ5        [        USS9nU R                  UR
                   Vs/ s H  ofR                  PM     sn/ SQ5        [        USS9n	U R                  U	R
                   Vs/ s H  ofR                  PM     sn/ SQ5        g s  snf s  snf s  snf s  snf )NC5 E5 G5zC#5 E#5 G#5rJ   rN   )rr   rs   rp   rK   )rg   rh   rt   rL   )C5zE-5zA-5rM   )zC#5E5A5r   )r   )BEGr   )r   r   r   )	r   r=   rP   r   rB   r   r   r   r;   )
r   c9c9aUFMcMajUSMcMajLFMcMajr]   LSMcMajupChromaticdownChromatics
             r   testMediantsTest.testMediants  sP   [[$kk-(#Bu=,,j9#Bu=,,j9#Bu=GOODOq**ODFZ[#Bu=GOODOq**ODFYZ&sA+*=*=>*=Q&&*=>P(7CM4I4IJ4Iq**4IJ+	- E E ? Ks    F"F$F&Fc                   [         R                  " S5      n[         R                  " S5      n[        U5      nU R                  UR                   Vs/ s H  oDR
                  PM     sn/ SQ5        [        U5      nU R                  UR                   Vs/ s H  oDR
                  PM     sn/ SQ5        [        U5      nU R                  UR                   Vs/ s H  oDR
                  PM     sn/ SQ5        [        U5      nU R                  UR                   Vs/ s H  oDR
                  PM     sn/ SQ5        g s  snf s  snf s  snf s  snf )Nr   zA4 C5 E5)zC#r   G#)A-CzE-)r   Fr   )r   r   r   )r   r=   r   r   r   r;   r   )r   c10c11slideUpr]   	slideDownN1N2s           r   testSnNTest.testSnN  s    kk*%kk*%C&'//:/Q&&/:<MNcF	)*;*;<*;Q&&*;<>OPsV"**5*Q&&*57GHsV"**5*Q&&*57GH ; = 6 6s   D:D?EE	c                8   [        [        R                  " S5      5      n[        [        R                  " / SQ5      5      nU R                  UR                  UR                  5        U R                  UR                  [        R                  " S5      R                  5        [        R                  " S5      n[        USSS9n[        R                  " / SQ5      n[        USSS9nU R                  UR                  S	   R                  5        UR                   H  nU R                  UR                  5        M      U R                  UR                  UR                  5        U R                  UR                  [        R                  " S
5      R                  5        g )NzC# E# G#)rj   rk   rh   r   zB D# F#r~   Fr   )rt   rr   ro   r   z	A# D# F##)	r.   r   r=   r   r   r^   
assertTruer:   r   )r   c_sharp_maj_named_transformed%c_sharp_maj_pitch_classes_transformedb_maj_namedb_maj_named_transformedb_maj_pitch_classesb_maj_pitch_classes_transformedr   s           r   testInstantiatingChordPCNumbers$Test.testInstantiatingChordPCNumbers  sI   ()%++j*A(B%01%++i2H0I-6>>>FF	H>FFZ088	: kk),"2;GL#N#kk*5*:;NPTOT+V'+33A6IIJ088AQ112 9 	0888@@	B8@@[199	;r   r   N)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r     s$    54Z@"&H-0I";r   r   __main__)T)LRP)TFFF)FT)rJ   )r   )"__doc__
__future__r   r   unittestmusic21r   r   music21.analysisr   r   EnvironmentenvironLocalMusic21Exceptionr	   r    r.   r2   r5   r'   rG   rT   r^   re   r{   rP   r   r   r   TestCaser   
_DOC_ORDERr   mainTestr   r   r   <module>r      s  
 #      ( &&'?@
	<00 	2/b#J#J)8t@ %)!&)."n*`*\X2Br>"@""HA,A._;8 _;H q!Q6',)	
 zT r   