コード例 #1
0
ファイル: NumberedPitch.py プロジェクト: tchiwinpiti/abjad
    def invert(self, axis=None):
        r'''Inverts numbered pitch around `axis`.

        ..  container:: example

            Inverts pitch-class about pitch-class 0 explicitly:

            >>> abjad.NumberedPitch(2).invert(0)
            NumberedPitch(-2)

            >>> abjad.NumberedPitch(-2).invert(0)
            NumberedPitch(2)

        ..  container:: example

            Inverts pitch-class about pitch-class 0 implicitly:

            >>> abjad.NumberedPitch(2).invert()
            NumberedPitch(-2)

            >>> abjad.NumberedPitch(-2).invert()
            NumberedPitch(2)

        ..  container:: example

            Inverts pitch-class about pitch-class -3:

            >>> abjad.NumberedPitch(2).invert(-3)
            NumberedPitch(-8)

        Returns new numbered pitch.
        '''
        return Pitch.invert(self, axis=axis)
コード例 #2
0
ファイル: NumberedPitch.py プロジェクト: Alwnikrotikz/abjad
 def __init__(self, expr):
     from abjad.tools import pitchtools
     if hasattr(expr, 'pitch_number'):
         pitch_number = expr.pitch_number
     elif Pitch.is_pitch_number(expr):
         pitch_number = expr
     else:
         pitch_number = pitchtools.NamedPitch(expr).pitch_number
     self._pitch_number = pitch_number
コード例 #3
0
ファイル: NumberedPitch.py プロジェクト: jonathanmarmor/abjad
 def __init__(self, expr=None):
     from abjad.tools import pitchtools
     if hasattr(expr, 'pitch_number'):
         pitch_number = expr.pitch_number
     elif Pitch.is_pitch_number(expr):
         pitch_number = expr
     elif expr is None:
         pitch_number = 0
     else:
         pitch_number = pitchtools.NamedPitch(expr).pitch_number
     self._pitch_number = mathtools.integer_equivalent_number_to_integer(
         pitch_number)
コード例 #4
0
 def __init__(self, pitch_number=None):
     from abjad.tools import pitchtools
     if hasattr(pitch_number, 'pitch_number'):
         pitch_number = pitch_number.pitch_number
     elif Pitch.is_pitch_number(pitch_number):
         pitch_number = pitch_number
     elif pitch_number is None:
         pitch_number = 0
     else:
         pitch_number = pitchtools.NamedPitch(pitch_number).pitch_number
     pitch_number = mathtools.integer_equivalent_number_to_integer(
         pitch_number)
     self._pitch_number = pitch_number
コード例 #5
0
ファイル: NumberedPitch.py プロジェクト: odub/abjad
    def __init__(self, pitch_number=None):
        from abjad.tools import pitchtools

        if hasattr(pitch_number, "pitch_number"):
            pitch_number = pitch_number.pitch_number
        elif Pitch.is_pitch_number(pitch_number):
            pitch_number = pitch_number
        elif pitch_number is None:
            pitch_number = 0
        else:
            pitch_number = pitchtools.NamedPitch(pitch_number).pitch_number
        pitch_number = mathtools.integer_equivalent_number_to_integer(pitch_number)
        self._pitch_number = pitch_number
コード例 #6
0
    def invert(self, axis=None):
        r'''Inverts named pitch around `axis`.

        ..  container:: example

            **Example 1.** Inverts pitch around middle C explicitly:
            
            ::

                >>> NamedPitch("d'").invert("c'")
                NamedPitch('bf')

            ::

                >>> NamedPitch('bf').invert("c'")
                NamedPitch("d'")

            Default behavior.

            **Example 2.** Inverts pitch around middle C implicitly:

            ::

                >>> NamedPitch("d'").invert()
                NamedPitch('bf')

            ::

                >>> NamedPitch('bf').invert()
                NamedPitch("d'")

            Default behavior.

            **Example 3.** Inverts pitch around A3:

            ::

                >>> NamedPitch("d'").invert('a')
                NamedPitch('e')

        Interprets none-valued `axis` equal to middle C.

        Returns new named pitch.
        '''
        return Pitch.invert(self, axis=axis)
コード例 #7
0
    def invert(self, axis=None):
        r'''Inverts numberd pitch around `axis`.

        ..  container:: example

            **Example 1.** Inverts pitch-class about pitch-class 0 explicitly:

            ::

                >>> pitchtools.NumberedPitch(2).invert(0)
                NumberedPitch(-2)

            ::

                >>> pitchtools.NumberedPitch(-2).invert(0)
                NumberedPitch(2)

            Default behavior.

            **Example 2.** Inverts pitch-class about pitch-class 0 implicitly:

            ::

                >>> pitchtools.NumberedPitch(2).invert()
                NumberedPitch(-2)

            ::

                >>> pitchtools.NumberedPitch(-2).invert()
                NumberedPitch(2)

            Default behavior.

            **Example 3.** Inverts pitch-class about pitch-class -3:

            ::

                >>> pitchtools.NumberedPitch(2).invert(-3)
                NumberedPitch(-8)

        Returns new numbered pitch.
        '''
        return Pitch.invert(self, axis=axis)
コード例 #8
0
    def invert(self, axis=None):
        r'''Inverts numberd pitch around `axis`.

        ..  container:: example

            **Example 1.** Inverts pitch-class about pitch-class 0 explicitly:

            ::

                >>> pitchtools.NumberedPitch(2).invert(0)
                NumberedPitch(-2)

            ::

                >>> pitchtools.NumberedPitch(-2).invert(0)
                NumberedPitch(2)

            Default behavior.

            **Example 2.** Inverts pitch-class about pitch-class 0 implicitly:

            ::

                >>> pitchtools.NumberedPitch(2).invert()
                NumberedPitch(-2)

            ::

                >>> pitchtools.NumberedPitch(-2).invert()
                NumberedPitch(2)

            Default behavior.

            **Example 3.** Inverts pitch-class about pitch-class -3:

            ::

                >>> pitchtools.NumberedPitch(2).invert(-3)
                NumberedPitch(-8)

        Returns new numbered pitch.
        '''
        return Pitch.invert(self, axis=axis)