NumberedPitchClass

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.NumberedPitchClass.NumberedPitchClass" [URL="../api/abjad/pitch/NumberedPitchClass.html#abjad.pitch.NumberedPitchClass.NumberedPitchClass", color=black, fontcolor=white, label="Numbered\nPitch\nClass", target=_top]; "abjad.pitch.PitchClass.PitchClass" [URL="../api/abjad/pitch/PitchClass.html#abjad.pitch.PitchClass.PitchClass", label="Pitch\nClass", shape=oval, style=bold, target=_top]; "abjad.pitch.PitchClass.PitchClass" -> "abjad.pitch.NumberedPitchClass.NumberedPitchClass"; } 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.PitchClass.PitchClass"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.pitch.NumberedPitchClass.NumberedPitchClass(number=0, *, arrow=None)

Numbered pitch-class.

Initializes from number of semitones:

>>> abjad.NumberedPitchClass(13)
NumberedPitchClass(1)

Initializes from pitch name.

>>> abjad.NumberedPitchClass('d')
NumberedPitchClass(2)

Initializes from named pitch.

>>> abjad.NumberedPitchClass(abjad.NamedPitch('g,'))
NumberedPitchClass(7)

Initializes from numbered pitch.

>>> abjad.NumberedPitchClass(abjad.NumberedPitch(15))
NumberedPitchClass(3)

Initializes from named pitch-class.

>>> abjad.NumberedPitchClass(abjad.NamedPitchClass('e'))
NumberedPitchClass(4)

Initializes from pitch-class / octave string:

>>> abjad.NumberedPitchClass('C#5')
NumberedPitchClass(1)

Initializes from other numbered pitch-class:

>>> abjad.NumberedPitchClass(abjad.NumberedPitchClass(9))
NumberedPitchClass(9)

Initializes from note:

>>> abjad.NumberedPitchClass(abjad.Note("a'8."))
NumberedPitchClass(9)

Attributes Summary

__add__ Adds argument to numbered pitch-class.
__copy__ Copies numbered pitch-class.
__eq__ Is true when argument is a numbered pitch-class with pitch-class number equal to that of this numbered pitch-class.
__format__ Formats numbered pitch-class.
__hash__ Hashes numbered pitch-class.
__lt__ Is true when argument is a numbered pitch-class with a pitch number greater than that of this numberd pitch-class.
__neg__ Negates numbered pitch-class.
__radd__ Right-addition not defined on numbered pitch-classes.
__str__ Gets string representation of numbered pitch-class.
__sub__ Subtracts argument from numbered pitch-class.
accidental Gets accidental.
arrow Gets arrow of numbered pitch-class.
invert Inverts numbered pitch-class.
multiply Multiplies pitch-class number by n.
name Gets name of numbered pitch-class.
number Gets number.
pitch_class_label Gets pitch-class / octave label.
transpose Transposes numbered pitch-class by index n.

Special methods

__add__(argument)

Adds argument to numbered pitch-class.

>>> pitch_class = abjad.NumberedPitchClass(9)
>>> pitch_class + abjad.NumberedInterval(0)
NumberedPitchClass(9)
>>> pitch_class + abjad.NumberedInterval(1)
NumberedPitchClass(10)
>>> pitch_class + abjad.NumberedInterval(2)
NumberedPitchClass(11)
>>> pitch_class + abjad.NumberedInterval(3)
NumberedPitchClass(0)

Returns new numbered pitch-class.

__copy__(*arguments)

Copies numbered pitch-class.

>>> import copy
>>> pitch_class = abjad.NumberedPitchClass(9)
>>> copy.copy(pitch_class)
NumberedPitchClass(9)

Returns new numbered pitch-class.

__eq__(argument)

Is true when argument is a numbered pitch-class with pitch-class number equal to that of this numbered pitch-class.

>>> pitch_class_1 = abjad.NumberedPitchClass(0)
>>> pitch_class_2 = abjad.NumberedPitchClass(0)
>>> pitch_class_3 = abjad.NumberedPitchClass(1)
>>> pitch_class_1 == pitch_class_1
True
>>> pitch_class_1 == pitch_class_2
True
>>> pitch_class_1 == pitch_class_3
False
>>> pitch_class_2 == pitch_class_1
True
>>> pitch_class_2 == pitch_class_2
True
>>> pitch_class_2 == pitch_class_3
False
>>> pitch_class_3 == pitch_class_1
False
>>> pitch_class_3 == pitch_class_2
False
>>> pitch_class_3 == pitch_class_3
True

Returns true or false.

(PitchClass).__float__()

Coerce to float.

Returns float.

__format__(format_specification='')

Formats numbered pitch-class.

>>> format(abjad.NumberedPitchClass(13))
'abjad.NumberedPitchClass(1)'

Set format_specification to ‘’, ‘lilypond’ or ‘storage’.

Returns string.

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

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

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

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

__hash__()

Hashes numbered pitch-class.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

(PitchClass).__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 pitch-class with a pitch number greater than that of this numberd pitch-class.

Compares less than:

>>> abjad.NumberedPitchClass(1) < abjad.NumberedPitchClass(2)
True

Does not compare less than:

>>> abjad.NumberedPitchClass(2) < abjad.NumberedPitchClass(1)
False

Raises type error when argument is not a numbered pitch-class.

__neg__()

Negates numbered pitch-class.

>>> pitch_class = abjad.NumberedPitchClass(9)
>>> -pitch_class
NumberedPitchClass(3)

Returns new numbered pitch-class.

__radd__(argument)

Right-addition not defined on numbered pitch-classes.

>>> 1 + abjad.NumberedPitchClass(9)
Traceback (most recent call last):
    ...
NotImplementedError: right-addition not defined on NumberedPitchClass.

Raises not implemented error.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

__str__()

Gets string representation of numbered pitch-class.

Returns string.

__sub__(argument)

Subtracts argument from numbered pitch-class.

Subtraction is defined against both numbered intervals and against other pitch-classes.

>>> abjad.NumberedPitchClass(6) - abjad.NumberedPitchClass(6)
NumberedInversionEquivalentIntervalClass(0)
>>> abjad.NumberedPitchClass(6) - abjad.NumberedPitchClass(7)
NumberedInversionEquivalentIntervalClass(1)
>>> abjad.NumberedPitchClass(7) - abjad.NumberedPitchClass(6)
NumberedInversionEquivalentIntervalClass(1)
>>> abjad.NumberedPitchClass(6) - abjad.NumberedInterval(-1)
NumberedPitchClass(5)
>>> abjad.NumberedPitchClass(6) - abjad.NumberedInterval(0)
NumberedPitchClass(6)
>>> abjad.NumberedPitchClass(6) - abjad.NumberedInterval(1)
NumberedPitchClass(5)

Returns numbered inversion-equivalent interval-class.


Methods

invert(axis=None)

Inverts numbered pitch-class.

>>> for n in range(12):
...     pitch_class = abjad.NumberedPitchClass(n)
...     print(repr(pitch_class), repr(pitch_class.invert()))
...
NumberedPitchClass(0) NumberedPitchClass(0)
NumberedPitchClass(1) NumberedPitchClass(11)
NumberedPitchClass(2) NumberedPitchClass(10)
NumberedPitchClass(3) NumberedPitchClass(9)
NumberedPitchClass(4) NumberedPitchClass(8)
NumberedPitchClass(5) NumberedPitchClass(7)
NumberedPitchClass(6) NumberedPitchClass(6)
NumberedPitchClass(7) NumberedPitchClass(5)
NumberedPitchClass(8) NumberedPitchClass(4)
NumberedPitchClass(9) NumberedPitchClass(3)
NumberedPitchClass(10) NumberedPitchClass(2)
NumberedPitchClass(11) NumberedPitchClass(1)

Interprets axis of inversion equal to pitch-class 0.

Returns new numbered pitch-class.

multiply(n=1)

Multiplies pitch-class number by n.

>>> for n in range(12):
...     pitch_class = abjad.NumberedPitchClass(n)
...     print(repr(pitch_class), repr(pitch_class.multiply(5)))
...
NumberedPitchClass(0) NumberedPitchClass(0)
NumberedPitchClass(1) NumberedPitchClass(5)
NumberedPitchClass(2) NumberedPitchClass(10)
NumberedPitchClass(3) NumberedPitchClass(3)
NumberedPitchClass(4) NumberedPitchClass(8)
NumberedPitchClass(5) NumberedPitchClass(1)
NumberedPitchClass(6) NumberedPitchClass(6)
NumberedPitchClass(7) NumberedPitchClass(11)
NumberedPitchClass(8) NumberedPitchClass(4)
NumberedPitchClass(9) NumberedPitchClass(9)
NumberedPitchClass(10) NumberedPitchClass(2)
NumberedPitchClass(11) NumberedPitchClass(7)

Returns new numbered pitch-class.

transpose(n=0)

Transposes numbered pitch-class by index n.

>>> for n in range(12):
...     pitch_class = abjad.NumberedPitchClass(n)
...     print(repr(pitch_class), repr(pitch_class.transpose(-13)))
...
NumberedPitchClass(0) NumberedPitchClass(11)
NumberedPitchClass(1) NumberedPitchClass(0)
NumberedPitchClass(2) NumberedPitchClass(1)
NumberedPitchClass(3) NumberedPitchClass(2)
NumberedPitchClass(4) NumberedPitchClass(3)
NumberedPitchClass(5) NumberedPitchClass(4)
NumberedPitchClass(6) NumberedPitchClass(5)
NumberedPitchClass(7) NumberedPitchClass(6)
NumberedPitchClass(8) NumberedPitchClass(7)
NumberedPitchClass(9) NumberedPitchClass(8)
NumberedPitchClass(10) NumberedPitchClass(9)
NumberedPitchClass(11) NumberedPitchClass(10)

Returns new numbered pitch-class.


Read-only properties

accidental

Gets accidental.

>>> abjad.NumberedPitchClass(1).accidental
Accidental('sharp')

Returns accidental.

arrow

Gets arrow of numbered pitch-class.

Returns up, down or none.

name

Gets name of numbered pitch-class.

>>> abjad.NumberedPitchClass(13).name
'cs'

Returns string.

number

Gets number.

>>> abjad.NumberedPitchClass(1).number
1
>>> abjad.NumberedPitchClass(13).number
1
pitch_class_label

Gets pitch-class / octave label.

>>> abjad.NumberedPitchClass(13).pitch_class_label
'C#'

Returns string.