§
    ƒØj÷  ã                  ó^  — d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ d dlmZ d dlm	Z	 d dlm
Z
 d dlmZ d d	lmZ e
j        e
j        e
j        e
j        e
j        d
œZ G d„ d¦  «        Z G d„ dej        ¦  «        Z G d„ dej        ¦  «        Zedk    rd dlZ ej        e¦  «         dS dS )é    )ÚannotationsN)Úexceptions21)Únote)Úpitch)Úkey)Úscale)Únotation)ÚconvertToPitch)ÚmajorÚminorÚdorianÚphrygianÚhypophrygianc                  óN   — e Zd ZU dZdddœZded<   dd	„Zdd„Zdd„Zdd„Z	d„ Z
d
S )ÚFiguredBassScaleaó  
    Acts as a wrapper for :class:`~music21.scale.Scale`. Used to represent the
    concept of a figured bass scale, with a scale value and mode.

    Accepted scale types: major, minor, dorian, phrygian, and hypophrygian.
    A FiguredBassScaleException is raised if an invalid scale type is provided.

    >>> from music21.figuredBass import realizerScale
    >>> fbScale = realizerScale.FiguredBassScale()
    >>> fbScale.realizerScale
    <music21.scale.MajorScale C major>
    >>> fbScale.keySig
    <music21.key.KeySignature of no sharps or flats>

    >>> fbScale = realizerScale.FiguredBassScale('d', 'minor')
    >>> fbScale.realizerScale
    <music21.scale.MinorScale D minor>
    >>> fbScale.keySig
    <music21.key.KeySignature of 1 flat>
    zj
            A :class:`~music21.scale.Scale` based on the
            desired value and mode.
            zu
            A :class:`~music21.key.KeySignature` corresponding to
            the scale value and mode.
            )ÚrealizerScaleÚkeySigzdict[str, str]Ú	_DOC_ATTRÚCr   c                óÚ   — 	 t           |         } ||¦  «        | _        t          j        t          j        ||¦  «        ¦  «        | _        d S # t          $ r t          d|z   ¦  «        ‚w xY w)NzUnsupported scale type-> )Ú
scaleModesr   r   ÚKeySignatureÚpitchToSharpsr   ÚKeyErrorÚFiguredBassScaleException)ÚselfÚ
scaleValueÚ	scaleModeÚ
scaleClasss       ú–/Users/tedpeters/Documents/Projects/Claude Projects/Misc Tools/notename-sheets/.venv/lib/python3.11/site-packages/music21/figuredBass/realizerScale.pyÚ__init__zFiguredBassScale.__init__@   sz   € ð	UÝ# IÔ.ˆJØ!+ ¨JÑ!7Ô!7ˆDÔÝÔ*­3Ô+<¸ZÈÑ+SÔ+SÑTÔTˆDŒKˆKˆKøÝð 	Uð 	Uð 	UÝ+Ð,GÈ)Ñ,SÑTÔTÐTð	Uøøøs   ‚A	A ÁA*Nc                óN  — t          |¦  «        }| j                             |¦  «        }t          j        |¦  «        }|€§t          j        |¦  «        }t          j        |¦  «        }| j	         
                    |j        j        ¦  «        |j        j        k    r.| j	         
                    |j        j        ¦  «        |j        _        | j                             |j        ¦  «        }g }t          t          |j        ¦  «        ¦  «        D ]l}||j        |         z   dz
  dz  }	| j                             |	¦  «        }
|j        |                              |
j        ¦  «        }|                     |¦  «         Œm|                     |j        ¦  «         |                     ¦   «          |S )ax  
        Takes a bassPitch and notationString and returns a list of corresponding
        pitch names based on the scale value and mode above and inclusive of the
        bassPitch name.

        >>> from music21.figuredBass import realizerScale
        >>> fbScale = realizerScale.FiguredBassScale()
        >>> fbScale.getPitchNames('D3', '6')
        ['D', 'F', 'B']
        >>> fbScale.getPitchNames('G3')
        ['G', 'B', 'D']
        >>> fbScale.getPitchNames('B3', '6,#5')
        ['B', 'D', 'F#', 'G']
        >>> fbScale.getPitchNames('C#3', '-7')  # Fully diminished seventh chord
        ['C#', 'E', 'G', 'B-']
        Né   é   )r
   r   ÚgetScaleDegreeFromPitchr	   ÚNotationÚcopyÚdeepcopyr   ÚNoter   ÚaccidentalByStepr   ÚstepÚ
accidentalÚrangeÚlenÚnumbersÚpitchFromDegreeÚ	modifiersÚmodifyPitchNameÚnameÚappendÚreverse)r   Ú	bassPitchÚnotationStringÚbassSDÚntÚbassPitchCopyÚbassNoteÚ
pitchNamesÚiÚpitchSDÚsamplePitchÚ	pitchNames               r    ÚgetPitchNameszFiguredBassScale.getPitchNamesH   sp  € õ" # 9Ñ-Ô-ˆ	ØÔ#×;Ò;¸IÑFÔFˆÝÔ˜~Ñ.Ô.ˆàˆ>Ý œM¨)Ñ4Ô4ˆMÝ”y Ñ/Ô/ˆHØ”×,Ò,¨X¬^Ô-@ÑAÔAØ”~Ô0ò1ð 1à,0¬K×,HÒ,HÈÌÔI\Ñ,]Ô,]�”Ô)ØÔ'×?Ò?ÀÄÑOÔOˆFàˆ
Ý•s˜2œ:‘”Ñ'Ô'ð 	)ð 	)ˆAØ ¤
¨1¤Ñ-°Ñ1°QÑ6ˆGØÔ,×<Ò<¸WÑEÔEˆKØœ Qœ×7Ò7¸Ô8HÑIÔIˆIØ×Ò˜iÑ(Ô(Ð(Ð(à×Ò˜)œ.Ñ)Ô)Ð)Ø×ÒÑÔÐØÐó    c                ó|   — t          |¦  «        }|                     d¦  «        }|                      |||¦  «        }|S )aì  
        Returns all pitches for a bassPitch and notationString within
        an octave of the bassPitch, inclusive of the bassPitch but
        exclusive at the upper bound. In other words, this method
        returns the most compact complete chord implied by the bassPitch
        and its figures.

        >>> from music21.figuredBass import realizerScale
        >>> fbScale = realizerScale.FiguredBassScale()

        >>> fbScale.getSamplePitches('D3', '6')  # First inversion triad
        [<music21.pitch.Pitch D3>, <music21.pitch.Pitch F3>, <music21.pitch.Pitch B3>]

        Root position triad

        >>> [str(p) for p in fbScale.getSamplePitches('G3') ]
        ['G3', 'B3', 'D4']

        First inversion seventh chord

        >>> [str(p) for p in fbScale.getSamplePitches('B3', '6,5') ]
        ['B3', 'D4', 'F4', 'G4']

        Neapolitan chord

        >>> [str(p) for p in fbScale.getSamplePitches('F3', '-6,-') ]
        ['F3', 'A-3', 'D-4']

        Second inversion seventh chord

        >>> [str(p) for p in fbScale.getSamplePitches('C5', '4,3') ]
        ['C5', 'E5', 'F5', 'A5']

        Fully diminished seventh chord

        >>> [str(p) for p in fbScale.getSamplePitches('C#3', '-7') ]
        ['C#3', 'E3', 'G3', 'B-3']
        Úd8)r
   Ú	transposeÚ
getPitches)r   r6   r7   ÚmaxPitchÚsamplePitchess        r    ÚgetSamplePitchesz!FiguredBassScale.getSamplePitchesp   s@   € õN # 9Ñ-Ô-ˆ	Ø×&Ò& tÑ,Ô,ˆàŸš¨	°>À8ÑLÔLˆØÐrB   c                óº  ‡‡— ‰€t          j        d¦  «        Št          ‰¦  «        Št          ‰¦  «        Š|                      ‰|¦  «        }t	          j        |t          ‰j        dz   ¦  «        ¦  «        }t          d„ |¦  «        }t	          j	        ˆfd„|¦  «        }t	          j	        ˆfd„|¦  «        }t          |¦  «        }	|	                     ¦   «          |	S )a$  
        Takes in a bassPitch, a notationString, and a maxPitch representing the highest
        possible pitch that can be returned. Returns a sorted list of pitches which
        correspond to the pitches of each specific pitch name found through getPitchNames
        that fall between the bassPitch and the maxPitch, inclusive of both.

        if maxPitch is None, then B5 s used instead.

        >>> from music21.figuredBass import realizerScale
        >>> fbScale = realizerScale.FiguredBassScale()

        Root position triad

        >>> [str(p) for p in fbScale.getPitches('C3') ]
        ['C3', 'E3', 'G3', 'C4', 'E4', 'G4', 'C5', 'E5', 'G5']

        First inversion triad

        >>> [str(p) for p in fbScale.getPitches('D3', '6') ]
        ['D3', 'F3', 'B3', 'D4', 'F4', 'B4', 'D5', 'F5', 'B5']

        Root position seventh chord, showing MaxPitch

        >>> fbScale.getPitches(pitch.Pitch('G3'), '7', 'F4')
        [<music21.pitch.Pitch G3>, <music21.pitch.Pitch B3>,
         <music21.pitch.Pitch D4>, <music21.pitch.Pitch F4>]
        NÚB5r#   c                ób   — t          j        | d         t          | d         ¦  «        z   ¦  «        S )Nr   r#   )r   ÚPitchÚstr)Úxs    r    ú<lambda>z-FiguredBassScale.getPitches.<locals>.<lambda>À   s#   € �eœk¨!¨A¬$µ°Q°q´T±´Ñ*:Ñ;Ô;€ rB   c                ó   •— ‰| k    S ©N© )r?   r6   s    €r    rP   z-FiguredBassScale.getPitches.<locals>.<lambda>Á   s   ø€ ¸)ÀkÒ:Q€ rB   c                ó   •— | ‰k    S rR   rS   )r?   rG   s    €r    rP   z-FiguredBassScale.getPitches.<locals>.<lambda>Â   s   ø€ ¸+ÈÒ:P€ rB   )r   rM   r
   rA   Ú	itertoolsÚproductr-   ÚoctaveÚmapÚfilterfalseÚlistÚsort)
r   r6   r7   rG   r<   Úiter1Úiter2Úiter3Úiter4Ú
allPitchess
    ` `      r    rF   zFiguredBassScale.getPitches�   sÙ   øø€ ð8 ÐÝ”{ 4Ñ(Ô(ˆHå" 9Ñ-Ô-ˆ	Ý! (Ñ+Ô+ˆØ×'Ò'¨	°>ÑBÔBˆ
ÝÔ! *­e°H´OÀaÑ4GÑ.HÔ.HÑIÔIˆÝÐ;Ð;¸UÑCÔCˆÝÔ%Ð&QÐ&QÐ&QÐ&QÐSXÑYÔYˆÝÔ%Ð&PÐ&PÐ&PÐ&PÐRWÑXÔXˆÝ˜%‘[”[ˆ
Ø�ŠÑÔÐØÐrB   c                ó   — | j         ›S rR   )r   )r   s    r    Ú_reprInternalzFiguredBassScale._reprInternalÇ   s   € ØÔ$Ð(Ð(rB   )r   r   rR   )NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r!   rA   rI   rF   rb   rS   rB   r    r   r       s°   € € € € € € ðð ð*ðð	!ð 	!€Ið 	ð 	ð 	ñ 	ðUð Uð Uð Uð&ð &ð &ð &ðP+ð +ð +ð +ðZ(ð (ð (ð (ðT)ð )ð )ð )ð )rB   r   c                  ó   — e Zd ZdS )r   N©rc   rd   re   rS   rB   r    r   r   Ë   ó   € € € € € Ø€DrB   r   c                  ó   — e Zd ZdS )ÚTestNri   rS   rB   r    rl   rl   Ñ   rj   rB   rl   Ú__main__)Ú
__future__r   r'   rU   ÚunittestÚmusic21r   r   r   r   r   Úmusic21.figuredBassr	   Úmusic21.figuredBass.notationr
   Ú
MajorScaleÚ
MinorScaleÚDorianScaleÚPhrygianScaleÚHypophrygianScaler   r   ÚMusic21Exceptionr   ÚTestCaserl   rc   ÚmainTestrS   rB   r    ú<module>r{      s¡  ðð #Ð "Ð "Ð "Ð "Ð "à €€€Ø Ð Ð Ð Ø €€€à  Ð  Ð  Ð  Ð  Ð  Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø (Ð (Ð (Ð (Ð (Ð (Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7àÔ'ØÔ'ØÔ)ØÔ-Ø#Ô5ð	7ð 7€
ðh)ð h)ð h)ð h)ð h)ñ h)ô h)ð h)ðV	ð 	ð 	ð 	ð 	 Ô =ñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	ˆ8Ôñ 	ô 	ð 	ð ˆzÒÐØ€N€N€NØ€GÔ�TÑÔÐÐÐð ÐrB   