Ejemplo n.º 1
0
    def named_interval_class(self):
        r'''Named interval class of named interval.

        ::

            >>> interval.named_interval_class
            NamedInversionEquivalentIntervalClass('+M2')

        Returns named inversion-equivalent interval-class.
        '''
        from abjad.tools import pitchtools
        quality_string, number = self._quality_string, self.number
        return pitchtools.NamedInversionEquivalentIntervalClass(
            quality_string, number)
Ejemplo n.º 2
0
    def __sub__(self, arg):
        r'''Subtracts `arg` from named pitch-class.

        ::

            >>> pitch_class - pitchtools.NamedPitchClass('g')
            NamedInversionEquivalentIntervalClass('+aug4')

        Returns named inversion-equivalent interval-class.
        '''
        if not isinstance(arg, type(self)):
            message = 'must be named pitch-class: {!r}.'
            message = message.format(arg)
            raise TypeError(message)
        from abjad.tools import pitchtools
        pitch_1 = pitchtools.NamedPitch(self, 4)
        pitch_2 = pitchtools.NamedPitch(arg, 4)
        mdi = pitchtools.NamedInterval.from_pitch_carriers(pitch_1, pitch_2)
        dic = pitchtools.NamedInversionEquivalentIntervalClass(
            mdi.quality_string, mdi.number)
        return dic
Ejemplo n.º 3
0
def instantiate_pitch_and_interval_test_collection():
    r'''Instantiate pitch and interval test collection:

    ::

        >>> for x in pitchtools.instantiate_pitch_and_interval_test_collection(): x
        ...
        NumberedInversionEquivalentIntervalClass(1)
        NamedInversionEquivalentIntervalClass('+M2')
        NumberedInterval(1)
        NumberedIntervalClass(1)
        NamedInterval('+M2')
        NamedIntervalClass('+M2')
        NamedPitch('c')
        NamedPitchClass('c')
        NumberedPitch(1)
        NumberedPitchClass(1)

    Use to test pitch and interval interface consistency.

    Returns list.
    '''
    from abjad.tools import pitchtools

    result = []
    result.append(pitchtools.NumberedInversionEquivalentIntervalClass(1))
    result.append(pitchtools.NamedInversionEquivalentIntervalClass('M2'))
    result.append(pitchtools.NumberedInterval(1))
    result.append(pitchtools.NumberedIntervalClass(1))
    result.append(pitchtools.NamedInterval('M2'))
    result.append(pitchtools.NamedIntervalClass('M2'))
    result.append(pitchtools.NamedPitch('c'))
    result.append(pitchtools.NamedPitchClass('c'))
    result.append(pitchtools.NumberedPitch(1))
    result.append(pitchtools.NumberedPitchClass(1))
    return result
Ejemplo n.º 4
0
def inventory_named_inversion_equivalent_interval_classes():
    '''Inventories named inversion-equivalent interval-classes.

    ::

        >>> for dic in pitchtools.inventory_named_inversion_equivalent_interval_classes():
        ...     dic
        ...
        NamedInversionEquivalentIntervalClass('P1')
        NamedInversionEquivalentIntervalClass('aug1')
        NamedInversionEquivalentIntervalClass('+m2')
        NamedInversionEquivalentIntervalClass('+M2')
        NamedInversionEquivalentIntervalClass('+aug2')
        NamedInversionEquivalentIntervalClass('+dim3')
        NamedInversionEquivalentIntervalClass('+m3')
        NamedInversionEquivalentIntervalClass('+M3')
        NamedInversionEquivalentIntervalClass('+dim4')
        NamedInversionEquivalentIntervalClass('+P4')
        NamedInversionEquivalentIntervalClass('+aug4')

    There are 11 named inversion-equivalent interval-classes.

    It is an open question as to whether octaves should be included.

    Returns list of named inversion-equivalent interval-classes.
    '''
    from abjad.tools import pitchtools

    return [
        pitchtools.NamedInversionEquivalentIntervalClass('perfect', 1),
        pitchtools.NamedInversionEquivalentIntervalClass('augmented', 1),
        pitchtools.NamedInversionEquivalentIntervalClass('minor', 2),
        pitchtools.NamedInversionEquivalentIntervalClass('major', 2),
        pitchtools.NamedInversionEquivalentIntervalClass('augmented', 2),
        pitchtools.NamedInversionEquivalentIntervalClass('diminished', 3),
        pitchtools.NamedInversionEquivalentIntervalClass('minor', 3),
        pitchtools.NamedInversionEquivalentIntervalClass('major', 3),
        pitchtools.NamedInversionEquivalentIntervalClass('diminished', 4),
        pitchtools.NamedInversionEquivalentIntervalClass('perfect', 4),
        pitchtools.NamedInversionEquivalentIntervalClass('augmented', 4),
    ]