NamedInterval

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.pitch" { graph [label="abjad.pitch"]; node [color=1]; "abjad.pitch.Interval.Interval" [URL="../api/abjad/pitch/Interval.html#abjad.pitch.Interval.Interval", label=Interval, shape=oval, style=bold, target=_top]; "abjad.pitch.NamedInterval.NamedInterval" [URL="../api/abjad/pitch/NamedInterval.html#abjad.pitch.NamedInterval.NamedInterval", color=black, fontcolor=white, label="Named\nInterval", target=_top]; "abjad.pitch.Interval.Interval" -> "abjad.pitch.NamedInterval.NamedInterval"; } subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=2]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/pitch/../system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.AbjadValueObject.AbjadValueObject" [URL="../api/abjad/pitch/../system/AbjadValueObject.html#abjad.system.AbjadValueObject.AbjadValueObject", label="Abjad\nValue\nObject", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.AbjadValueObject.AbjadValueObject"; } subgraph cluster_builtins { graph [label=builtins]; node [color=3]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "abjad.system.AbjadValueObject.AbjadValueObject" -> "abjad.pitch.Interval.Interval"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.pitch.NamedInterval.NamedInterval(name='P1')

Named interval.

Initializes ascending major ninth from string:

>>> abjad.NamedInterval('+M9')
NamedInterval('+M9')

Initializes descending major third from number of semitones:

>>> abjad.NamedInterval(-4)
NamedInterval('-M3')

Initializes from other named interval:

>>> abjad.NamedInterval(abjad.NamedInterval(-4))
NamedInterval('-M3')

Initializes from numbered interval:

>>> abjad.NamedInterval(abjad.NumberedInterval(3))
NamedInterval('+m3')

Initializes from pair of quality and diatonic number:

>>> abjad.NamedInterval(('M', 3))
NamedInterval('+M3')

Attributes Summary

__abs__ Gets absolute value of named interval.
__add__ Adds argument to named interval.
__copy__ Copies named interval.
__eq__ Is true when named interval equal argument.
__float__ Coerce to semitones as float.
__hash__ Hashes named interval.
__lt__ Is true when argument is a named interval with a number greater than that of this named interval.
__mul__ Multiplies named interval by argument.
__neg__ Negates named interval.
__radd__ Adds named interval to argument.
__rmul__ Multiplies argument by named interval.
__str__ Gets string representation of named interval.
__sub__ Subtracts argument from named interval.
direction_number Gets direction number of named interval.
from_pitch_carriers Makes named interval calculated from pitch_carrier_1 to pitch_carrier_2.
interval_class Gets interval class of named interval.
name Gets name of named interval.
number Gets number of named interval.
octaves Gets octaves of interval.
quality Gets quality of named interval.
semitones Gets semitones of named interval.
staff_spaces Gets staff spaces of named interval.
transpose Transposes pitch_carrier by named interval.

Special methods

__abs__()

Gets absolute value of named interval.

>>> abs(abjad.NamedInterval('+M9'))
NamedInterval('+M9')
>>> abs(abjad.NamedInterval('-M9'))
NamedInterval('+M9')

Returns named interval.

__add__(argument)

Adds argument to named interval.

>>> abjad.NamedInterval('M9') + abjad.NamedInterval('M2')
NamedInterval('+M10')

Returns new named interval.

__copy__(*arguments)

Copies named interval.

>>> import copy
>>> copy.copy(abjad.NamedInterval('+M9'))
NamedInterval('+M9')

Returns new named interval.

__eq__(argument)

Is true when named interval equal argument.

>>> interval_1 = abjad.NamedInterval('m2')
>>> interval_2 = abjad.NamedInterval('m2')
>>> interval_3 = abjad.NamedInterval('m9')
>>> interval_1 == interval_1
True
>>> interval_1 == interval_2
True
>>> interval_1 == interval_3
False
>>> interval_2 == interval_1
True
>>> interval_2 == interval_2
True
>>> interval_2 == interval_3
False
>>> interval_3 == interval_1
False
>>> interval_3 == interval_2
False
>>> interval_3 == interval_3
True
__float__()

Coerce to semitones as float.

Returns float.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to '' or 'storage'. Interprets '' equal to 'storage'.

Returns string.

(Interval).__ge__(other, NotImplemented=NotImplemented)

Return a >= b. Computed by @total_ordering from (not a < b).

(Interval).__gt__(other, NotImplemented=NotImplemented)

Return a > b. Computed by @total_ordering from (not a < b) and (a != b).

__hash__()

Hashes named interval.

Returns number.

(Interval).__le__(other, NotImplemented=NotImplemented)

Return a <= b. Computed by @total_ordering from (a < b) or (a == b).

__lt__(argument)

Is true when argument is a named interval with a number greater than that of this named interval.

>>> abjad.NamedInterval('+M9') < abjad.NamedInterval('+M10')
True

Also true when argument is a named interval with a number equal to this named interval and with semitones greater than this named interval:

>>> abjad.NamedInterval('+m9') < abjad.NamedInterval('+M9')
True

Otherwise false:

>>> abjad.NamedInterval('+M9') < abjad.NamedInterval('+M2')
False

Returns true or false.

__mul__(argument)

Multiplies named interval by argument.

>>> 3 * abjad.NamedInterval('+M9')
NamedInterval('+A25')

Returns new named interval.

__neg__()

Negates named interval.

>>> -abjad.NamedInterval('+M9')
NamedInterval('-M9')
>>> -abjad.NamedInterval('-M9')
NamedInterval('+M9')

Returns new named interval.

__radd__(argument)

Adds named interval to argument.

>>> abjad.NamedInterval('M9') + abjad.NamedInterval('M2')
NamedInterval('+M10')

Returns new named interval.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

__rmul__(argument)

Multiplies argument by named interval.

>>> abjad.NamedInterval('+M9') * 3
NamedInterval('+A25')

Returns new named interval.

__str__()

Gets string representation of named interval.

>>> str(abjad.NamedInterval('+M9'))
'+M9'

Returns string.

__sub__(argument)

Subtracts argument from named interval.

>>> abjad.NamedInterval('+M9') - abjad.NamedInterval('+M2')
NamedInterval('+P8')
>>> abjad.NamedInterval('+M2') - abjad.NamedInterval('+M9')
NamedInterval('-P8')

Returns new named interval.


Methods

transpose(pitch_carrier)

Transposes pitch_carrier by named interval.

Transposes chord:

>>> chord = abjad.Chord("<c' e' g'>4")
>>> interval = abjad.NamedInterval('+m2')
>>> interval.transpose(chord)
Chord("<df' f' af'>4")

Returns new (copied) object of pitch_carrier type.


Class & static methods

classmethod from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)

Makes named interval calculated from pitch_carrier_1 to pitch_carrier_2.

>>> abjad.NamedInterval.from_pitch_carriers(
...     abjad.NamedPitch(-2),
...     abjad.NamedPitch(12),
...     )
NamedInterval('+M9')
>>> abjad.NamedInterval.from_pitch_carriers(
...     abjad.NamedPitch("css'"),
...     abjad.NamedPitch("cff'"),
...     )
NamedInterval('-AAAA1')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "cs'''")
NamedInterval('+A15')
>>> abjad.NamedInterval.from_pitch_carriers('c', 'cqs')
NamedInterval('+P+1')
>>> abjad.NamedInterval.from_pitch_carriers("cf'", 'bs')
NamedInterval('-dd2')
>>> abjad.NamedInterval.from_pitch_carriers("cff'", 'aqs')
NamedInterval('-ddd+3')
>>> abjad.NamedInterval.from_pitch_carriers("cff'", 'atqs')
NamedInterval('-dddd+3')

Returns named interval.


Read-only properties

(Interval).cents

Gets cents of interval.

Returns nonnegative number.

direction_number

Gets direction number of named interval.

>>> abjad.NamedInterval('+M9').direction_number
1
>>> abjad.NamedInterval('+dim2').direction_number
1
>>> abjad.NamedInterval('+A1').direction_number
1
>>> abjad.NamedInterval('P1').direction_number
0
>>> abjad.NamedInterval('-m3').direction_number
-1

Returns -1, 0 or 1.

interval_class

Gets interval class of named interval.

>>> abjad.NamedInterval('+M9').interval_class
NamedIntervalClass('+M2')
>>> abjad.NamedInterval('-M9').interval_class
NamedIntervalClass('-M2')
>>> abjad.NamedInterval('P1').interval_class
NamedIntervalClass('P1')
>>> abjad.NamedInterval('+P8').interval_class
NamedIntervalClass('+P8')

Returns named interval-class.

name

Gets name of named interval.

>>> abjad.NamedInterval('+M9').name
'+M9'

Returns string.

number

Gets number of named interval.

>>> abjad.NamedInterval('+M9').number
9

Returns nonnegative number.

octaves

Gets octaves of interval.

Returns nonnegative number.

quality

Gets quality of named interval.

Returns string.

semitones

Gets semitones of named interval.

>>> abjad.NamedInterval('+M9').semitones
14
>>> abjad.NamedInterval('-M9').semitones
-14
>>> abjad.NamedInterval('P1').semitones
0
>>> abjad.NamedInterval('+P8').semitones
12
>>> abjad.NamedInterval('-P8').semitones
-12

Returns number.

staff_spaces

Gets staff spaces of named interval.

>>> abjad.NamedInterval('+M9').staff_spaces
8
>>> abjad.NamedInterval('-M9').staff_spaces
-8
>>> abjad.NamedInterval('P1').staff_spaces
0
>>> abjad.NamedInterval('+P8').staff_spaces
7
>>> abjad.NamedInterval('-P8').staff_spaces
-7

Returns nonnegative integer.