NumberedInterval

class pitchtools.NumberedInterval(arg=None)

Numbered interval.

Example 1. Initializes from number of semitones:

>>> numbered_interval = pitchtools.NumberedInterval(-14)
>>> numbered_interval
NumberedInterval(-14)

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" [color=1, group=0, label=AbjadValueObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.abctools.AbjadValueObject.AbjadValueObject"; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_pitchtools { graph [label=pitchtools]; "abjad.tools.pitchtools.Interval.Interval" [color=3, group=2, label=Interval, shape=oval, style=bold]; "abjad.tools.pitchtools.NumberedInterval.NumberedInterval" [color=black, fontcolor=white, group=2, label=<<B>NumberedInterval</B>>, shape=box, style="filled, rounded"]; "abjad.tools.pitchtools.Interval.Interval" -> "abjad.tools.pitchtools.NumberedInterval.NumberedInterval"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" -> "abjad.tools.pitchtools.Interval.Interval"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

cents Cents of interval.
direction_number Direction sign of numbered interval.
direction_string Direction string of named interval.
from_pitch_carriers(class_, pitch_carrier_1, ...) Makes numbered interval from pitch_carrier_1 and pitch_carrier_2.
is_named_interval_abbreviation(expr) Is true when expr is a named interval abbreviation.
is_named_interval_quality_abbreviation(expr) Is true when expr is a named-interval quality abbreviation.
number Number of numbered interval.
numbered_interval_number Number of numbered interval.
semitones Semitones corresponding to numbered interval.
to_named_interval(staff_positions) Changes numbered interval to named interval that encompasses staff_positions.
__abs__() Absolute value of numbered interval.
__add__(arg) Adds arg to numbered interval.
__copy__() Copies numbered interval.
__eq__(arg) Is true when arg is a numbered interval with number equal to that of this numbered interval.
__float__() Changes numbered interval to float.
__format__([format_specification]) Formats Abjad object.
__ge__(other[, NotImplemented]) Return a >= b.
__gt__(other[, NotImplemented]) Return a > b.
__hash__() Hashes numbered interval.
__int__() Changes numbered interval to integer.
__le__(other[, NotImplemented]) Return a <= b.
__lt__(arg) Is true when arg is a numbered interval with same direction number as this numbered interval and with number greater than that of this numbered interval.
__ne__(arg) Is true when interval does not equal arg.
__neg__() Negates numbered interval.
__repr__() Gets interpreter representation of Abjad object.
__str__() String representation of numbered interval.
__sub__(arg) Subtracts arg from numbered interval.

Read-only properties

(Interval).cents

Cents of interval.

Returns nonnegative number.

NumberedInterval.direction_number

Direction sign of numbered interval.

>>> pitchtools.NumberedInterval(-14).direction_number
-1

Returns integer.

NumberedInterval.direction_string

Direction string of named interval.

>>> pitchtools.NumberedInterval(-14).direction_string
'descending'

Returns 'ascending', 'descending' or none.

NumberedInterval.number

Number of numbered interval.

Returns number.

NumberedInterval.numbered_interval_number

Number of numbered interval.

>>> pitchtools.NumberedInterval(-14).numbered_interval_number
-14

Returns integer or float.

NumberedInterval.semitones

Semitones corresponding to numbered interval.

Returns nonnegative number.

Methods

NumberedInterval.to_named_interval(staff_positions)

Changes numbered interval to named interval that encompasses staff_positions.

>>> numbered_interval = pitchtools.NumberedInterval(1)
>>> numbered_interval.to_named_interval(2)
NamedInterval('+m2')

Returns named interval.

Class & static methods

classmethod NumberedInterval.from_pitch_carriers(class_, pitch_carrier_1, pitch_carrier_2)

Makes numbered interval from pitch_carrier_1 and pitch_carrier_2.

>>> pitchtools.NumberedInterval.from_pitch_carriers(
...     NamedPitch(-2),
...     NamedPitch(12),
...     )
NumberedInterval(14)

Returns numbered interval.

(Interval).is_named_interval_abbreviation(expr)

Is true when expr is a named interval abbreviation. Otherwise false:

>>> pitchtools.Interval.is_named_interval_abbreviation('+M9')
True

The regex ^([+,-]?)(M|m|P|aug|dim)(\d+)$ underlies this predicate.

Returns true or false.

(Interval).is_named_interval_quality_abbreviation(expr)

Is true when expr is a named-interval quality abbreviation. Otherwise false:

>>> pitchtools.Interval.is_named_interval_quality_abbreviation('aug')
True

The regex ^M|m|P|aug|dim$ underlies this predicate.

Returns true or false.

Special methods

NumberedInterval.__abs__()

Absolute value of numbered interval.

Returns new numbered interval.

NumberedInterval.__add__(arg)

Adds arg to numbered interval.

Returns new numbered interval.

NumberedInterval.__copy__()

Copies numbered interval.

Returns new numbered interval.

NumberedInterval.__eq__(arg)

Is true when arg is a numbered interval with number equal to that of this numbered interval. Otherwise false.

Returns true or false.

NumberedInterval.__float__()

Changes numbered interval to float.

Returns float.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

NumberedInterval.__ge__(other, NotImplemented=NotImplemented)

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

NumberedInterval.__gt__(other, NotImplemented=NotImplemented)

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

NumberedInterval.__hash__()

Hashes numbered interval.

Returns integer.

NumberedInterval.__int__()

Changes numbered interval to integer.

Returns integer.

NumberedInterval.__le__(other, NotImplemented=NotImplemented)

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

NumberedInterval.__lt__(arg)

Is true when arg is a numbered interval with same direction number as this numbered interval and with number greater than that of this numbered interval. Otherwise false.

Returns true or false.

(Interval).__ne__(arg)

Is true when interval does not equal arg.

Returns true or false.

NumberedInterval.__neg__()

Negates numbered interval.

Returns new numbered interval.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

NumberedInterval.__str__()

String representation of numbered interval.

Returns string.

NumberedInterval.__sub__(arg)

Subtracts arg from numbered interval.

Returns new numbered interval.