NumberedPitch

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

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

Numbered pitch.

Initializes from number:

>>> numbered_pitch = abjad.NumberedPitch(13)
>>> abjad.show(numbered_pitch) 

Initializes from other numbered pitch

>>> numbered_pitch = abjad.NumberedPitch(abjad.NumberedPitch(13))
>>> abjad.show(numbered_pitch) 

Initializes from pitch-class / octave pair:

>>> numbered_pitch = abjad.NumberedPitch((1, 5))
>>> abjad.show(numbered_pitch) 

Attributes Summary

__add__ Adds argument to numbered pitch.
__lt__ Is true when argument can be coerced to a numbered pitch and when this numbered pitch is less than argument.
__neg__ Negates numbered pitch.
__radd__ Adds numbered pitch to argument.
__str__ Gets string representation of numbered pitch.
__sub__ Subtracts argument from numbered pitch.
accidental Gets accidental of numbered pitch.
arrow Gets arrow of numbered pitch.
from_hertz Makes numbered pitch from hertz.
get_name Gets name of numbered pitch name according to locale.
hertz Gets frequency of numbered pitch in Hertz.
interpolate Interpolates between numbered pitch and stop_pitch by fraction.
invert Inverts numbered pitch around axis.
multiply Multiplies numbered pitch by index n.
name Gets name of numbered pitch.
number Gets number of numbered pitch.
octave Gets octave of numbered pitch.
pitch_class Gets pitch-class of numbered pitch.
transpose Tranposes numbered pitch by n semitones.

Special methods

__add__(argument)

Adds argument to numbered pitch.

>>> abjad.NumberedPitch(12) + abjad.NumberedPitch(13)
NumberedPitch(25)
>>> abjad.NumberedPitch(13) + abjad.NumberedPitch(12)
NumberedPitch(25)

Returns new numbered pitch.

(AbjadValueObject).__copy__(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(argument)

Is true when all initialization values of Abjad value object equal the initialization values of argument.

Returns true or false.

(Pitch).__float__()

Coerce to float.

Returns float.

(Pitch).__format__(format_specification='')

Formats pitch.

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

Returns string.

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

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

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

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

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

(Pitch).__illustrate__()

Illustrates pitch.

Returns LilyPond file.

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

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

__lt__(argument)

Is true when argument can be coerced to a numbered pitch and when this numbered pitch is less than argument.

>>> pitch_1 = abjad.NumberedPitch(12)
>>> pitch_2 = abjad.NumberedPitch(12)
>>> pitch_3 = abjad.NumberedPitch(13)
>>> pitch_1 < pitch_1
False
>>> pitch_1 < pitch_2
False
>>> pitch_1 < pitch_3
True
>>> pitch_2 < pitch_1
False
>>> pitch_2 < pitch_2
False
>>> pitch_2 < pitch_3
True
>>> pitch_3 < pitch_1
False
>>> pitch_3 < pitch_2
False
>>> pitch_3 < pitch_3
False

Returns true or false.

__neg__()

Negates numbered pitch.

>>> -abjad.NumberedPitch(13.5)
NumberedPitch(-13.5)
>>> -abjad.NumberedPitch(-13.5)
NumberedPitch(13.5)

Returns new numbered pitch.

__radd__(argument)

Adds numbered pitch to argument.

>>> pitch = abjad.NumberedPitch(13)
>>> abjad.NumberedPitch(12).__radd__(pitch)
NumberedPitch(25)
>>> pitch = abjad.NumberedPitch(12)
>>> abjad.NumberedPitch(13).__radd__(pitch)
NumberedPitch(25)

Returns new numbered pitch.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

__str__()

Gets string representation of numbered pitch.

Returns string.

__sub__(argument)

Subtracts argument from numbered pitch.

>>> abjad.NumberedPitch(12) - abjad.NumberedPitch(12)
NumberedInterval(0)
>>> abjad.NumberedPitch(12) - abjad.NumberedPitch(13)
NumberedInterval(1)
>>> abjad.NumberedPitch(13) - abjad.NumberedPitch(12)
NumberedInterval(-1)

Returns numbered interval.


Methods

get_name(locale=None)

Gets name of numbered pitch name according to locale.

>>> abjad.NumberedPitch(13).get_name()
"cs''"
>>> abjad.NumberedPitch(13).get_name(locale='us')
'C#5'

Set locale to ‘us’ or none.

Returns string.

interpolate(stop_pitch, fraction)

Interpolates between numbered pitch and stop_pitch by fraction.

Interpolates from C4 to C5:

>>> start_pitch = abjad.NumberedPitch(0)
>>> stop_pitch = abjad.NumberedPitch(12)
>>> start_pitch.interpolate(stop_pitch, abjad.Fraction(0))
NumberedPitch(0)
>>> start_pitch.interpolate(stop_pitch, abjad.Fraction(1, 4))
NumberedPitch(3)
>>> start_pitch.interpolate(stop_pitch, abjad.Fraction(1, 2))
NumberedPitch(6)
>>> start_pitch.interpolate(stop_pitch, abjad.Fraction(3, 4))
NumberedPitch(9)
>>> start_pitch.interpolate(stop_pitch, abjad.Fraction(1))
NumberedPitch(12)

Interpolates from C5 to C4:

>>> start_pitch = abjad.NumberedPitch(12)
>>> stop_pitch = abjad.NumberedPitch(0)
>>> start_pitch.interpolate(stop_pitch, abjad.Fraction(0))
NumberedPitch(12)
>>> start_pitch.interpolate(stop_pitch, abjad.Fraction(1, 4))
NumberedPitch(9)
>>> start_pitch.interpolate(stop_pitch, abjad.Fraction(1, 2))
NumberedPitch(6)
>>> start_pitch.interpolate(stop_pitch, abjad.Fraction(3, 4))
NumberedPitch(3)
>>> start_pitch.interpolate(stop_pitch, abjad.Fraction(1))
NumberedPitch(0)

Returns new numbered pitch.

invert(axis=None)

Inverts numbered pitch around axis.

Inverts pitch-class about pitch-class 0 explicitly:

>>> abjad.NumberedPitch(2).invert(0)
NumberedPitch(-2)
>>> abjad.NumberedPitch(-2).invert(0)
NumberedPitch(2)

Inverts pitch-class about pitch-class 0 implicitly:

>>> abjad.NumberedPitch(2).invert()
NumberedPitch(-2)
>>> abjad.NumberedPitch(-2).invert()
NumberedPitch(2)

Inverts pitch-class about pitch-class -3:

>>> abjad.NumberedPitch(2).invert(-3)
NumberedPitch(-8)

Returns new numbered pitch.

multiply(n=1)

Multiplies numbered pitch by index n.

>>> abjad.NumberedPitch(14).multiply(3)
NumberedPitch(42)

Returns new numbered pitch.

transpose(n=0)

Tranposes numbered pitch by n semitones.

>>> abjad.NumberedPitch(13).transpose(1)
NumberedPitch(14)

Returns new numbered pitch.


Class & static methods

classmethod from_hertz(hertz)

Makes numbered pitch from hertz.

>>> abjad.NumberedPitch.from_hertz(440)
NumberedPitch(9)

REGRESSION. Returns 12 (not 0):

>>> abjad.NumberedPitch.from_hertz(519)
NumberedPitch(12)

Returns newly constructed numbered pitch.


Read-only properties

accidental

Gets accidental of numbered pitch.

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

Returns accidental.

arrow

Gets arrow of numbered pitch.

Gets no arrow:

>>> abjad.NumberedPitch(13).arrow is None
True

Gets up-arrow:

>>> abjad.NumberedPitch(13, arrow=abjad.Up).arrow
Up

Gets down-arrow:

>>> abjad.NumberedPitch(13, arrow=abjad.Down).arrow
Down

Returns up, down or none.

hertz

Gets frequency of numbered pitch in Hertz.

>>> abjad.NumberedPitch(9).hertz
440.0
>>> abjad.NumberedPitch(0).hertz
261.6255653005986
>>> abjad.NumberedPitch(12).hertz
523.2511306011972

Returns float.

name

Gets name of numbered pitch.

>>> abjad.NumberedPitch(13).name
"cs''"

Returns string

number

Gets number of numbered pitch.

>>> abjad.NumberedPitch(13).number
13

Returns number.

octave

Gets octave of numbered pitch.

>>> abjad.NumberedPitch(13).octave
Octave(5)

Returns octave.

pitch_class

Gets pitch-class of numbered pitch.

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

Returns numbered pitch-class.