
    3j                        d Z ddlmZ ddlZej
                  rddlmZ ddlmZ ddZ	e
dk(  rddlZ ej                          yy)	zt
Chord utilities too obscure to go on the Chord object, yet still helpful
enough to go in the music21 core library.
    )annotationsN)chord)pitchc                    | j                         j                  }i }| j                  D ]!  }|j                  |z
  dz  dz   }||vs|||<   # |S )a  
    Return a dictionary of all chordSteps in the chord.
    If more than one pitch shares the same chordStep such as the third
    in (C, E-, E, G), then only the first will appear in the dictionary.

    The dictionary will be ordered by the order of pitches in the Chord.

    More efficient than calling [getChordStep(x) for x in range(1, 8)]
    which would be O(n^2) on number of pitches.

    Requires `root()` to be defined.

    >>> ch = chord.Chord('C4 E4 G4 B4 C5 D5')
    >>> chord.tools.allChordSteps(ch)
    {1: <music21.pitch.Pitch C4>,
     3: <music21.pitch.Pitch E4>,
     5: <music21.pitch.Pitch G4>,
     7: <music21.pitch.Pitch B4>,
     2: <music21.pitch.Pitch D5>}
          )rootdiatonicNoteNumpitches)croot_dnnout_map	thisPitchdiatonicDistances        @/DATA/.local/lib/python3.12/site-packages/music21/chord/tools.pyallChordStepsr      s]    * vvx''H&(GYY	&66AQF!K7*(1G$%  N    __main__)r   zchord.Chordreturnzdict[int, pitch.Pitch])__doc__
__future__r   typingtTYPE_CHECKINGmusic21r   r   r   __name__mainTest r   r   <module>r      sD    # ??< zG r   