NumberedInterval

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.NumberedInterval.NumberedInterval" [URL="../api/abjad/pitch/NumberedInterval.html#abjad.pitch.NumberedInterval.NumberedInterval", color=black, fontcolor=white, label="Numbered\nInterval", target=_top]; "abjad.pitch.Interval.Interval" -> "abjad.pitch.NumberedInterval.NumberedInterval"; } 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.NumberedInterval.NumberedInterval(number=0)

Numbered interval.

Initializes from number of semitones:

>>> abjad.NumberedInterval(-14)
NumberedInterval(-14)

Initializes from other numbered interval

>>> abjad.NumberedInterval(abjad.NumberedInterval(-14))
NumberedInterval(-14)

Initializes from named interval:

>>> abjad.NumberedInterval(abjad.NamedInterval('-P4'))
NumberedInterval(-5)

Initializes from interval string:

>>> abjad.NumberedInterval('-P4')
NumberedInterval(-5)

Attributes Summary

__abs__ Absolute value of numbered interval.
__add__ Adds argument to numbered interval.
__copy__ Copies numbered interval.
__eq__ Is true when argument is a numbered interval with number equal to that of this numbered interval.
__float__ Coerce to float.
__hash__ Hashes numbered interval.
__lt__ Is true when argument is a numbered interval with same direction number as this numbered interval and with number greater than that of this numbered interval.
__neg__ Negates numbered interval.
__radd__ Adds numbered interval to argument.
__str__ String representation of numbered interval.
__sub__ Subtracts argument from numbered interval.
direction_number Gets direction number of numbered interval.
from_pitch_carriers Makes numbered interval from pitch_carrier_1 and pitch_carrier_2.
interval_class Gets interval class of numbered interval.
number Gets number of numbered interval.
octaves Gets octaves of interval.
semitones Gets semitones corresponding to numbered interval.
transpose Transposes pitch_carrier.

Special methods

__abs__()

Absolute value of numbered interval.

>>> abs(abjad.NumberedInterval(-14))
NumberedInterval(14)

Returns new numbered interval.

__add__(argument)

Adds argument to numbered interval.

>>> abjad.NumberedInterval(3) + abjad.NumberedInterval(14)
NumberedInterval(17)
>>> abjad.NumberedInterval(3) + abjad.NumberedInterval(-14)
NumberedInterval(-11)

Returns new numbered interval.

__copy__()

Copies numbered interval.

>>> import copy
>>> copy.copy(abjad.NumberedInterval(-14))
NumberedInterval(-14)

Returns new numbered interval.

__eq__(argument)

Is true when argument is a numbered interval with number equal to that of this numbered interval.

>>> interval_1 = abjad.NumberedInterval(12)
>>> interval_2 = abjad.NumberedInterval(12)
>>> interval_3 = abjad.NumberedInterval(13)
>>> 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

Returns true or false.

__float__()

Coerce to 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 numbered interval.

Returns integer.

(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 numbered interval with same direction number as this numbered interval and with number greater than that of this numbered interval.

>>> interval_1 = abjad.NumberedInterval(12)
>>> interval_2 = abjad.NumberedInterval(12)
>>> interval_3 = abjad.NumberedInterval(13)
>>> interval_1 < interval_1
False
>>> interval_1 < interval_2
False
>>> interval_1 < interval_3
True
>>> interval_2 < interval_1
False
>>> interval_2 < interval_2
False
>>> interval_2 < interval_3
True
>>> interval_3 < interval_1
False
>>> interval_3 < interval_2
False
>>> interval_3 < interval_3
False

Returns true or false.

__neg__()

Negates numbered interval.

>>> -abjad.NumberedInterval(-14)
NumberedInterval(14)

Returns new numbered interval.

__radd__(argument)

Adds numbered interval to argument.

>>> interval = abjad.NumberedInterval(14)
>>> abjad.NumberedInterval(3).__radd__(interval)
NumberedInterval(17)
>>> interval = abjad.NumberedInterval(-14)
>>> abjad.NumberedInterval(3).__radd__(interval)
NumberedInterval(-11)

Returns new numbered interval.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

__str__()

String representation of numbered interval.

Returns string.

__sub__(argument)

Subtracts argument from numbered interval.

Returns new numbered interval.


Methods

transpose(pitch_carrier)

Transposes pitch_carrier.

Transposes chord:

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

Returns newly constructed object of pitch_carrier type.


Class & static methods

classmethod from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)

Makes numbered interval from pitch_carrier_1 and pitch_carrier_2.

>>> abjad.NumberedInterval.from_pitch_carriers(
...     abjad.NamedPitch(-2),
...     abjad.NamedPitch(12),
...     )
NumberedInterval(14)
>>> abjad.NumberedInterval.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(12),
...     )
NumberedInterval(0)
>>> abjad.NumberedInterval.from_pitch_carriers(
...     abjad.NamedPitch(9),
...     abjad.NamedPitch(12),
...     )
NumberedInterval(3)
>>> abjad.NumberedInterval.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(9),
...     )
NumberedInterval(-3)
>>> abjad.NumberedInterval.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(-2),
...     )
NumberedInterval(-14)

Returns numbered interval.


Read-only properties

(Interval).cents

Gets cents of interval.

Returns nonnegative number.

direction_number

Gets direction number of numbered interval.

>>> abjad.NumberedInterval(-14).direction_number
-1
>>> abjad.NumberedInterval(0).direction_number
0
>>> abjad.NumberedInterval(6).direction_number
1

Returns integer.

interval_class

Gets interval class of numbered interval.

Returns numbered interval-class.

number

Gets number of numbered interval.

>>> abjad.NumberedInterval(-14).number
-14
>>> abjad.NumberedInterval(-2).number
-2
>>> abjad.NumberedInterval(0).number
0

Returns number.

octaves

Gets octaves of interval.

Returns nonnegative number.

semitones

Gets semitones corresponding to numbered interval.

>>> abjad.NumberedInterval(-14).semitones
-14

Returns nonnegative number.