pitch

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.Accidental" [URL="../api/abjad/pitch.html#abjad.pitch.Accidental", color=black, fontcolor=white, label=Accidental, target=_top]; "abjad.pitch.Interval" [URL="../api/abjad/pitch.html#abjad.pitch.Interval", color=black, fontcolor=white, label=Interval, target=_top]; "abjad.pitch.NamedInterval" [URL="../api/abjad/pitch.html#abjad.pitch.NamedInterval", color=black, fontcolor=white, label="Named\nInterval", target=_top]; "abjad.pitch.Interval" -> "abjad.pitch.NamedInterval" [minlen=1]; "abjad.pitch.NumberedInterval" [URL="../api/abjad/pitch.html#abjad.pitch.NumberedInterval", color=black, fontcolor=white, label="Numbered\nInterval", target=_top]; "abjad.pitch.Interval" -> "abjad.pitch.NumberedInterval" [minlen=2]; "abjad.pitch.IntervalClass" [URL="../api/abjad/pitch.html#abjad.pitch.IntervalClass", color=black, fontcolor=white, label="Interval\nClass", target=_top]; "abjad.pitch.NamedIntervalClass" [URL="../api/abjad/pitch.html#abjad.pitch.NamedIntervalClass", color=black, fontcolor=white, label="Named\nInterval\nClass", target=_top]; "abjad.pitch.IntervalClass" -> "abjad.pitch.NamedIntervalClass" [minlen=1]; "abjad.pitch.NumberedIntervalClass" [URL="../api/abjad/pitch.html#abjad.pitch.NumberedIntervalClass", color=black, fontcolor=white, label="Numbered\nInterval\nClass", target=_top]; "abjad.pitch.IntervalClass" -> "abjad.pitch.NumberedIntervalClass" [minlen=2]; "abjad.pitch.NamedInversionEquivalentIntervalClass" [URL="../api/abjad/pitch.html#abjad.pitch.NamedInversionEquivalentIntervalClass", color=black, fontcolor=white, label="Named\nInversion\nEquivalent\nInterval\nClass", target=_top]; "abjad.pitch.NamedIntervalClass" -> "abjad.pitch.NamedInversionEquivalentIntervalClass" [minlen=1]; "abjad.pitch.NamedPitch" [URL="../api/abjad/pitch.html#abjad.pitch.NamedPitch", color=black, fontcolor=white, label="Named\nPitch", target=_top]; "abjad.pitch.NamedPitchClass" [URL="../api/abjad/pitch.html#abjad.pitch.NamedPitchClass", color=black, fontcolor=white, label="Named\nPitch\nClass", target=_top]; "abjad.pitch.NumberedInversionEquivalentIntervalClass" [URL="../api/abjad/pitch.html#abjad.pitch.NumberedInversionEquivalentIntervalClass", color=black, fontcolor=white, label="Numbered\nInversion\nEquivalent\nInterval\nClass", target=_top]; "abjad.pitch.NumberedIntervalClass" -> "abjad.pitch.NumberedInversionEquivalentIntervalClass" [minlen=1]; "abjad.pitch.NumberedPitch" [URL="../api/abjad/pitch.html#abjad.pitch.NumberedPitch", color=black, fontcolor=white, label="Numbered\nPitch", target=_top]; "abjad.pitch.NumberedPitchClass" [URL="../api/abjad/pitch.html#abjad.pitch.NumberedPitchClass", color=black, fontcolor=white, label="Numbered\nPitch\nClass", target=_top]; "abjad.pitch.Octave" [URL="../api/abjad/pitch.html#abjad.pitch.Octave", color=black, fontcolor=white, label=Octave, target=_top]; "abjad.pitch.Pitch" [URL="../api/abjad/pitch.html#abjad.pitch.Pitch", color=black, fontcolor=white, label=Pitch, target=_top]; "abjad.pitch.Pitch" -> "abjad.pitch.NamedPitch" [minlen=1]; "abjad.pitch.Pitch" -> "abjad.pitch.NumberedPitch" [minlen=2]; "abjad.pitch.PitchClass" [URL="../api/abjad/pitch.html#abjad.pitch.PitchClass", color=black, fontcolor=white, label="Pitch\nClass", target=_top]; "abjad.pitch.PitchClass" -> "abjad.pitch.NamedPitchClass" [minlen=1]; "abjad.pitch.PitchClass" -> "abjad.pitch.NumberedPitchClass" [minlen=2]; "abjad.pitch.StaffPosition" [URL="../api/abjad/pitch.html#abjad.pitch.StaffPosition", color=black, fontcolor=white, label="Staff\nPosition", target=_top]; } subgraph cluster_builtins { graph [label=builtins]; node [color=2]; "builtins.object" [URL="https://docs.python.org/3.10/library/functions.html#object", label=object, target=_top]; } "builtins.object" -> "abjad.pitch.Accidental" [minlen=1]; "builtins.object" -> "abjad.pitch.Interval"; "builtins.object" -> "abjad.pitch.IntervalClass"; "builtins.object" -> "abjad.pitch.Octave" [minlen=2]; "builtins.object" -> "abjad.pitch.Pitch"; "builtins.object" -> "abjad.pitch.PitchClass"; "builtins.object" -> "abjad.pitch.StaffPosition" [minlen=1]; }


Classes

Accidental

Accidental.

Interval

Abstract interval.

IntervalClass

Abstract interval-class.

NamedInterval

Named interval.

NamedIntervalClass

Named interval-class.

NamedInversionEquivalentIntervalClass

Named inversion-equivalent interval-class.

NamedPitch

Named pitch.

NamedPitchClass

Named pitch-class.

NumberedInterval

Numbered interval.

NumberedIntervalClass

Numbered interval-class.

NumberedInversionEquivalentIntervalClass

Numbered inversion-equivalent interval-class.

NumberedPitch

Numbered pitch.

NumberedPitchClass

Numbered pitch-class.

Octave

Octave.

Pitch

Abstract pitch.

PitchClass

Abstract pitch-class.

StaffPosition

Staff position.

class abjad.pitch.Accidental(name='natural', arrow=False)[source]

Accidental.

>>> abjad.Accidental("ff")
Accidental(name='double flat')
>>> abjad.Accidental("tqf")
Accidental(name='three-quarters flat')
>>> abjad.Accidental("f")
Accidental(name='flat')
>>> abjad.Accidental("")
Accidental(name='natural')
>>> abjad.Accidental("qs")
Accidental(name='quarter sharp')
>>> abjad.Accidental("s")
Accidental(name='sharp')
>>> abjad.Accidental("tqs")
Accidental(name='three-quarters sharp')
>>> abjad.Accidental("ss")
Accidental(name='double sharp')

Generalized accidentals are allowed:

>>> abjad.Accidental("ssss")
Accidental(name='ssss')

Less than is true when argument is an accidental with semitones greater than those of this accidental:

>>> accidental_1 = abjad.Accidental("f")
>>> accidental_2 = abjad.Accidental("f")
>>> accidental_3 = abjad.Accidental("s")
>>> accidental_1 < accidental_1
False
>>> accidental_1 < accidental_2
False
>>> accidental_1 < accidental_3
True
>>> accidental_2 < accidental_1
False
>>> accidental_2 < accidental_2
False
>>> accidental_2 < accidental_3
True
>>> accidental_3 < accidental_1
False
>>> accidental_3 < accidental_2
False
>>> accidental_3 < accidental_3
False
>>> abjad.Accidental("ff").semitones
-2
>>> abjad.Accidental("tqf").semitones
-1.5
>>> abjad.Accidental("f").semitones
-1
>>> abjad.Accidental("").semitones
0
>>> abjad.Accidental("qs").semitones
0.5
>>> abjad.Accidental("s").semitones
1
>>> abjad.Accidental("tqs").semitones
1.5
>>> abjad.Accidental("ss").semitones
2
>>> abjad.Accidental("ff").name
'double flat'
>>> abjad.Accidental("tqf").name
'three-quarters flat'
>>> abjad.Accidental("f").name
'flat'
>>> abjad.Accidental("").name
'natural'
>>> abjad.Accidental("qs").name
'quarter sharp'
>>> abjad.Accidental("s").name
'sharp'
>>> abjad.Accidental("tqs").name
'three-quarters sharp'
>>> abjad.Accidental("ss").name
'double sharp'

Attributes Summary

__add__

Adds argument to accidental.

__call__

Calls accidental on argument.

__eq__

Return self==value.

__ge__

Return a >= b.

__gt__

Return a > b.

__hash__

Return hash(self).

__le__

Return a <= b.

__lt__

Returns true or false.

__neg__

Negates accidental.

__post_init__

__radd__

Raises not implemented error on accidental.

__repr__

Return repr(self).

__str__

Gets string representation of accidental.

__sub__

Subtracts argument from accidental.

symbol

Gets symbol of accidental.


Special methods

__add__(argument)[source]

Adds argument to accidental.

>>> accidental = abjad.Accidental("qs")
>>> accidental + accidental
Accidental(name='sharp')
>>> accidental + accidental + accidental
Accidental(name='three-quarters sharp')

Returns new accidental.

overridden __call__(argument)[source]

Calls accidental on argument.

>>> accidental = abjad.Accidental("s")

Calls accidental on pitches:

>>> accidental(abjad.NamedPitch("c''"))
NamedPitch("cs''")
>>> accidental(abjad.NamedPitch("cqs''"))
NamedPitch("ctqs''")
>>> accidental(abjad.NumberedPitch(12))
NumberedPitch(13)
>>> accidental(abjad.NumberedPitch(12.5))
NumberedPitch(13.5)

Calls accidental on pitch-classes:

>>> accidental(abjad.NamedPitchClass("c"))
NamedPitchClass('cs')
>>> accidental(abjad.NamedPitchClass("cqs"))
NamedPitchClass('ctqs')
>>> accidental(abjad.NumberedPitchClass(0))
NumberedPitchClass(1)
>>> accidental(abjad.NumberedPitchClass(0.5))
NumberedPitchClass(1.5)

Returns new object of argument type.

overridden __eq__(other)

Return self==value.

overridden __ge__(other)

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

overridden __gt__(other)

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

overridden __hash__()

Return hash(self).

overridden __le__(other)

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

overridden __lt__(argument)[source]

Returns true or false.

__neg__()[source]

Negates accidental.

>>> -abjad.Accidental("ff")
Accidental(name='double sharp')
>>> -abjad.Accidental("tqf")
Accidental(name='three-quarters sharp')
>>> -abjad.Accidental("f")
Accidental(name='sharp')
>>> -abjad.Accidental("")
Accidental(name='natural')
>>> -abjad.Accidental("qs")
Accidental(name='quarter flat')
>>> -abjad.Accidental("s")
Accidental(name='flat')
>>> -abjad.Accidental("tqs")
Accidental(name='three-quarters flat')
>>> -abjad.Accidental("ss")
Accidental(name='double flat')

Returns new accidental.

__post_init__()[source]
__radd__(argument)[source]

Raises not implemented error on accidental.

overridden __repr__()

Return repr(self).

overridden __str__()[source]

Gets string representation of accidental.

>>> str(abjad.Accidental("ff"))
'ff'
>>> str(abjad.Accidental("tqf"))
'tqf'
>>> str(abjad.Accidental("f"))
'f'
>>> str(abjad.Accidental(""))
''
>>> str(abjad.Accidental("qs"))
'qs'
>>> str(abjad.Accidental("s"))
's'
>>> str(abjad.Accidental("tqs"))
'tqs'
>>> str(abjad.Accidental("ss"))
'ss'
Return type:

str

__sub__(argument)[source]

Subtracts argument from accidental.

>>> accidental = abjad.Accidental("qs")
>>> accidental - accidental
Accidental(name='natural')
>>> accidental - accidental - accidental
Accidental(name='quarter flat')

Returns new accidental.


Read-only properties

symbol

Gets symbol of accidental.

>>> abjad.Accidental("ff").symbol
'bb'
>>> abjad.Accidental("tqf").symbol
'b~'
>>> abjad.Accidental("f").symbol
'b'
>>> abjad.Accidental("").symbol
''
>>> abjad.Accidental("qs").symbol
'+'
>>> abjad.Accidental("s").symbol
'#'
>>> abjad.Accidental("tqs").symbol
'#+'
>>> abjad.Accidental("ss").symbol
'##'
class abjad.pitch.Interval(argument)[source]

Abstract interval.


Attributes Summary

__eq__

Compares repr formats.

__ge__

Return a >= b.

__gt__

Return a > b.

__hash__

Hashes interval.

__le__

Return a <= b.

__lt__

Is true when interval is less than argument

cents

Gets cents of interval.

direction_number

Gets direction number of interval

interval_class

Gets interval-class of interval.

number

Gets number of interval.

octaves

Gets octaves of interval.

semitones

Gets semitones of interval.

transpose

Transposes pitch_carrier by interval.


Special methods

overridden __eq__(argument)[source]

Compares repr formats.

Return type:

bool

overridden __ge__(other)

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

overridden __gt__(other)

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

overridden __hash__()[source]

Hashes interval.

Return type:

int

overridden __le__(other)

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

overridden __lt__(argument)[source]

Is true when interval is less than argument

Returns true or false.


Methods

transpose(pitch_carrier)[source]

Transposes pitch_carrier by interval.

Returns new pitch carrier.


Read-only properties

cents

Gets cents of interval.

Returns nonnegative number.

direction_number

Gets direction number of interval

Returns integer.

interval_class

Gets interval-class of interval.

Returns interval-class.

number

Gets number of interval.

Returns integer.

octaves

Gets octaves of interval.

Returns nonnegative number.

semitones

Gets semitones of interval.

Returns integer or float.

class abjad.pitch.IntervalClass(argument)[source]

Abstract interval-class.


Attributes Summary

__abs__

Gets absolute value of interval-class.

__eq__

Compares number.

__ge__

Return a >= b.

__gt__

Return a > b.

__hash__

Hashes interval-class.

__le__

Return a <= b.

__lt__

Compares number.

number

Gets number of interval-class.

transpose

Transposes pitch_carrier by interval-class.


Special methods

__abs__()[source]

Gets absolute value of interval-class.

Returns new interval-class.

overridden __eq__(argument)[source]

Compares number.

Return type:

bool

overridden __ge__(other)

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

overridden __gt__(other)

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

overridden __hash__()[source]

Hashes interval-class.

Return type:

int

overridden __le__(other)

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

overridden __lt__(argument)[source]

Compares number.

Return type:

bool


Methods

transpose(pitch_carrier)[source]

Transposes pitch_carrier by interval-class.

Returns new pitch carrier.


Read-only properties

number

Gets number of interval-class.

Returns number.

class abjad.pitch.NamedInterval(name='P1')[source]

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__

Compares name.

__float__

Coerce to semitones as float.

__hash__

Hashes named interval.

__lt__

Compares semitones.

__mul__

Multiplies named interval by argument

__neg__

Negates named interval.

__radd__

Adds named interval to argument

__repr__

Gets repr.

__rmul__

Multiplies argument by 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 named interval class.

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__()[source]

Gets absolute value of named interval.

>>> abs(abjad.NamedInterval("+M9"))
NamedInterval('+M9')
>>> abs(abjad.NamedInterval("-M9"))
NamedInterval('+M9')
Return type:

NamedInterval

__add__(argument)[source]

Adds argument to named interval.

>>> abjad.NamedInterval("M9") + abjad.NamedInterval("M2")
NamedInterval('+M10')
Return type:

NamedInterval

__copy__(*arguments)[source]

Copies named interval. :rtype: NamedInterval

>>> import copy
>>> copy.copy(abjad.NamedInterval("+M9"))
NamedInterval('+M9')
overridden __eq__(argument)[source]

Compares name.

>>> 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
Return type:

bool

__float__()[source]

Coerce to semitones as float.

Returns float.

(Interval).__ge__(other)

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

(Interval).__gt__(other)

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

overridden __hash__()[source]

Hashes named interval.

Returns number.

(Interval).__le__(other)

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

overridden __lt__(argument)[source]

Compares semitones.

>>> abjad.NamedInterval("+M9") < abjad.NamedInterval("+M10")
True
>>> abjad.NamedInterval("+m9") < abjad.NamedInterval("+M9")
True
>>> abjad.NamedInterval("+M9") < abjad.NamedInterval("+M2")
False
Return type:

bool

__mul__(argument)[source]

Multiplies named interval by argument

>>> 3 * abjad.NamedInterval("+M9")
NamedInterval('+A25')
Return type:

NamedInterval

__neg__()[source]

Negates named interval.

>>> -abjad.NamedInterval("+M9")
NamedInterval('-M9')
>>> -abjad.NamedInterval("-M9")
NamedInterval('+M9')
Return type:

NamedInterval

__radd__(argument)[source]

Adds named interval to argument

>>> abjad.NamedInterval("M9") + abjad.NamedInterval("M2")
NamedInterval('+M10')
Return type:

NamedInterval

overridden __repr__()[source]

Gets repr.

__rmul__(argument)[source]

Multiplies argument by named interval.

>>> abjad.NamedInterval("+M9") * 3
NamedInterval('+A25')
Return type:

NamedInterval

__sub__(argument)[source]

Subtracts argument from named interval.

>>> abjad.NamedInterval("+M9") - abjad.NamedInterval("+M2")
NamedInterval('+P8')
>>> abjad.NamedInterval("+M2") - abjad.NamedInterval("+M9")
NamedInterval('-P8')
Return type:

NamedInterval


Methods

overridden transpose(pitch_carrier)[source]

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)[source]

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(
...     abjad.NamedPitch("ds'"),
...     abjad.NamedPitch("ef''"),
... )
NamedInterval('+d9')
>>> 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')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "d''")
NamedInterval('+M9')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "df''")
NamedInterval('+m9')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "dff''")
NamedInterval('+d9')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "dfff''")
NamedInterval('+dd9')
>>> abjad.NamedInterval.from_pitch_carriers("c'", "dffff''")
NamedInterval('+ddd9')
Return type:

NamedInterval


Read-only properties

(Interval).cents

Gets cents of interval.

Returns nonnegative number.

overridden 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
overridden interval_class

Gets named interval class.

>>> 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')
name

Gets name of named interval.

>>> abjad.NamedInterval("+M9").name
'+M9'
overridden number

Gets number of named interval.

>>> abjad.NamedInterval("+M9").number
9
overridden octaves

Gets octaves of interval.

quality

Gets quality of named interval.

overridden 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
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
class abjad.pitch.NamedIntervalClass(name='P1')[source]

Named interval-class.

Initializes from name:

>>> abjad.NamedIntervalClass("-M9")
NamedIntervalClass('-M2')

Attributes Summary

__abs__

Gets absolute value of named interval-class.

__add__

Adds argument to named interval-class.

__eq__

Is true when argument is a named interval-class with direction number, quality string and number equal to those of this named interval-class.

__float__

Coerce to float.

__hash__

Hashes named interval-class.

__lt__

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

__radd__

Adds interval-class to argument

__repr__

Gets repr.

__sub__

Subtracts argument from named interval-class.

direction_number

Gets direction number of named interval-class.

from_pitch_carriers

Makes named interval-class from pitch_carrier_1 and pitch_carrier_2

name

Gets name of named interval-class.

quality

Gets quality of named interval-class.


Special methods

overridden __abs__()[source]

Gets absolute value of named interval-class.

>>> abs(abjad.NamedIntervalClass("-M9"))
NamedIntervalClass('+M2')

Returns new named interval-class.

__add__(argument)[source]

Adds argument to named interval-class.

Returns new named interval-class.

overridden __eq__(argument)[source]

Is true when argument is a named interval-class with direction number, quality string and number equal to those of this named interval-class.

>>> interval_class_1 = abjad.NamedIntervalClass("P1")
>>> interval_class_2 = abjad.NamedIntervalClass("P1")
>>> interval_class_3 = abjad.NamedIntervalClass("m2")
>>> interval_class_1 == interval_class_1
True
>>> interval_class_1 == interval_class_2
True
>>> interval_class_1 == interval_class_3
False
>>> interval_class_2 == interval_class_1
True
>>> interval_class_2 == interval_class_2
True
>>> interval_class_2 == interval_class_3
False
>>> interval_class_3 == interval_class_1
False
>>> interval_class_3 == interval_class_2
False
>>> interval_class_3 == interval_class_3
True

Returns true or false.

__float__()[source]

Coerce to float.

Returns float.

(IntervalClass).__ge__(other)

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

(IntervalClass).__gt__(other)

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

overridden __hash__()[source]

Hashes named interval-class.

Returns integer.

(IntervalClass).__le__(other)

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

overridden __lt__(argument)[source]

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

>>> interval_class_1 = abjad.NamedIntervalClass("P1")
>>> interval_class_2 = abjad.NamedIntervalClass("P1")
>>> interval_class_3 = abjad.NamedIntervalClass("m2")
>>> interval_class_1 < interval_class_1
False
>>> interval_class_1 < interval_class_2
False
>>> interval_class_1 < interval_class_3
True
>>> interval_class_2 < interval_class_1
False
>>> interval_class_2 < interval_class_2
False
>>> interval_class_2 < interval_class_3
True
>>> interval_class_3 < interval_class_1
False
>>> interval_class_3 < interval_class_2
False
>>> interval_class_3 < interval_class_3
False
Return type:

bool

__radd__(argument)[source]

Adds interval-class to argument

Returns new named interval-class.

overridden __repr__()[source]

Gets repr.

__sub__(argument)[source]

Subtracts argument from named interval-class.

Returns new named interval-class.


Methods

(IntervalClass).transpose(pitch_carrier)

Transposes pitch_carrier by interval-class.

Returns new pitch carrier.


Class & static methods

classmethod from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)[source]

Makes named interval-class from pitch_carrier_1 and pitch_carrier_2

>>> abjad.NamedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(-2),
...     abjad.NamedPitch(12),
... )
NamedIntervalClass('+M2')
>>> abjad.NamedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(0),
...     abjad.NamedPitch(12),
... )
NamedIntervalClass('+P8')
>>> abjad.NamedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(12),
... )
NamedIntervalClass('P1')
>>> abjad.NamedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(-3),
... )
NamedIntervalClass('-m3')
>>> abjad.NamedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(9),
... )
NamedIntervalClass('-m3')

Returns newly constructed named interval-class.


Read-only properties

direction_number

Gets direction number of named interval-class.

>>> abjad.NamedIntervalClass("P1").direction_number
0
>>> abjad.NamedIntervalClass("+M2").direction_number
1
>>> abjad.NamedIntervalClass("-M2").direction_number
-1

Returns -1, 0 or 1.

name

Gets name of named interval-class.

>>> abjad.NamedIntervalClass("-M9").name
'-M2'

Returns string.

(IntervalClass).number

Gets number of interval-class.

Returns number.

quality

Gets quality of named interval-class.

Returns string.

class abjad.pitch.NamedInversionEquivalentIntervalClass(name='P1')[source]

Named inversion-equivalent interval-class.

Initializes from string:

>>> abjad.NamedInversionEquivalentIntervalClass("-m14")
NamedInversionEquivalentIntervalClass('+M2')

Initializes from pair:

>>> abjad.NamedInversionEquivalentIntervalClass(("perfect", 1))
NamedInversionEquivalentIntervalClass('P1')
>>> abjad.NamedInversionEquivalentIntervalClass(("perfect", -1))
NamedInversionEquivalentIntervalClass('P1')
>>> abjad.NamedInversionEquivalentIntervalClass(("augmented", 4))
NamedInversionEquivalentIntervalClass('+A4')
>>> abjad.NamedInversionEquivalentIntervalClass(("augmented", -4))
NamedInversionEquivalentIntervalClass('+A4')
>>> abjad.NamedInversionEquivalentIntervalClass(("augmented", 11))
NamedInversionEquivalentIntervalClass('+A4')
>>> abjad.NamedInversionEquivalentIntervalClass(("augmented", -11))
NamedInversionEquivalentIntervalClass('+A4')

Initializes from other interval-class:

>>> interval_class = abjad.NamedInversionEquivalentIntervalClass("P1")
>>> abjad.NamedInversionEquivalentIntervalClass(interval_class)
NamedInversionEquivalentIntervalClass('P1')

Attributes Summary

__eq__

Compares name.

__hash__

Hashes named inversion-equivalent interval-class.

from_pitch_carriers

Makes named inversion-equivalent interval-class from pitch_carrier_1 and pitch_carrier_2.


Special methods

(NamedIntervalClass).__abs__()

Gets absolute value of named interval-class.

>>> abs(abjad.NamedIntervalClass("-M9"))
NamedIntervalClass('+M2')

Returns new named interval-class.

(NamedIntervalClass).__add__(argument)

Adds argument to named interval-class.

Returns new named interval-class.

overridden __eq__(argument)[source]

Compares name.

>>> class_ = abjad.NamedInversionEquivalentIntervalClass
>>> interval_class_1 = class_("P1")
>>> interval_class_2 = class_("P1")
>>> interval_class_3 = class_("m2")
>>> interval_class_1 == interval_class_1
True
>>> interval_class_1 == interval_class_2
True
>>> interval_class_1 == interval_class_3
False
>>> interval_class_2 == interval_class_1
True
>>> interval_class_2 == interval_class_2
True
>>> interval_class_2 == interval_class_3
False
>>> interval_class_3 == interval_class_1
False
>>> interval_class_3 == interval_class_2
False
>>> interval_class_3 == interval_class_3
True

Returns true or false.

(NamedIntervalClass).__float__()

Coerce to float.

Returns float.

(IntervalClass).__ge__(other)

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

(IntervalClass).__gt__(other)

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

overridden __hash__()[source]

Hashes named inversion-equivalent interval-class.

Returns integer.

(IntervalClass).__le__(other)

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

(NamedIntervalClass).__lt__(argument)

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

>>> interval_class_1 = abjad.NamedIntervalClass("P1")
>>> interval_class_2 = abjad.NamedIntervalClass("P1")
>>> interval_class_3 = abjad.NamedIntervalClass("m2")
>>> interval_class_1 < interval_class_1
False
>>> interval_class_1 < interval_class_2
False
>>> interval_class_1 < interval_class_3
True
>>> interval_class_2 < interval_class_1
False
>>> interval_class_2 < interval_class_2
False
>>> interval_class_2 < interval_class_3
True
>>> interval_class_3 < interval_class_1
False
>>> interval_class_3 < interval_class_2
False
>>> interval_class_3 < interval_class_3
False
Return type:

bool

(NamedIntervalClass).__radd__(argument)

Adds interval-class to argument

Returns new named interval-class.

(NamedIntervalClass).__repr__()

Gets repr.

(NamedIntervalClass).__sub__(argument)

Subtracts argument from named interval-class.

Returns new named interval-class.


Methods

(IntervalClass).transpose(pitch_carrier)

Transposes pitch_carrier by interval-class.

Returns new pitch carrier.


Class & static methods

overridden classmethod from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)[source]

Makes named inversion-equivalent interval-class from pitch_carrier_1 and pitch_carrier_2.

>>> class_ = abjad.NamedInversionEquivalentIntervalClass
>>> class_.from_pitch_carriers(
...     abjad.NamedPitch(-2),
...     abjad.NamedPitch(12),
... )
NamedInversionEquivalentIntervalClass('+M2')

Returns new named inversion-equivalent interval-class.


Read-only properties

(NamedIntervalClass).direction_number

Gets direction number of named interval-class.

>>> abjad.NamedIntervalClass("P1").direction_number
0
>>> abjad.NamedIntervalClass("+M2").direction_number
1
>>> abjad.NamedIntervalClass("-M2").direction_number
-1

Returns -1, 0 or 1.

(NamedIntervalClass).name

Gets name of named interval-class.

>>> abjad.NamedIntervalClass("-M9").name
'-M2'

Returns string.

(IntervalClass).number

Gets number of interval-class.

Returns number.

(NamedIntervalClass).quality

Gets quality of named interval-class.

Returns string.

class abjad.pitch.NamedPitch(name="c'", *, accidental=None, arrow=None, octave=None)[source]

Named pitch.

Initializes from pitch name:

>>> abjad.NamedPitch("cs''")
NamedPitch("cs''")

Initializes quartertone from pitch name:

>>> abjad.NamedPitch("aqs")
NamedPitch('aqs')

Initializes from pitch-class / octave string:

>>> abjad.NamedPitch("C#5")
NamedPitch("cs''")

Initializes quartertone from pitch-class / octave string:

>>> abjad.NamedPitch("A+3")
NamedPitch('aqs')
>>> abjad.NamedPitch("Aqs3")
NamedPitch('aqs')

Initializes arrowed pitch:

>>> abjad.NamedPitch("C#5", arrow=abjad.UP)
NamedPitch("cs''", arrow=Vertical.UP)

REGRESSION. Small floats just less than a C initialize in the correct octave:

Initializes c / C3:

>>> abjad.NamedPitch(-12.1)
NamedPitch('c')

Initializes c’ / C4:

>>> abjad.NamedPitch(-0.1)
NamedPitch("c'")

Initializes c’’ / C5:

>>> abjad.NamedPitch(11.9)
NamedPitch("c''")

Attributes Summary

__add__

Adds named pitch to interval.

__copy__

Copies named pitch.

__eq__

Is true when argument is a named pitch equal to this named pitch.

__hash__

Hashes numbered pitch.

__le__

Is true when named pitch is less than or equal to argument.

__lt__

Is true when named pitch is less than argument.

__radd__

Right-addition not defined on named pitches.

__repr__

Gets repr.

__sub__

Subtracts argument from named pitch.

accidental

Gets accidental of named pitch.

arrow

Gets arrow of named pitch.

from_hertz

Makes named pitch from hertz.

get_name

Gets name of named pitch according to locale.

hertz

Gets frequency of named pitch in Hertz.

invert

Inverts named pitch around axis.

multiply

Multiplies named pitch.

name

Gets name of named pitch.

number

Gets number of named pitch.

octave

Gets octave of named pitch.

pitch_class

Gets pitch-class of named pitch.

respell

Respells named pitch with accidental.

simplify

Reduce alteration to between -2 and 2 while maintaining identical pitch number.

transpose

Transposes named pitch by index n.


Special methods

__add__(interval)[source]

Adds named pitch to interval.

>>> abjad.NamedPitch("cs''") + abjad.NamedInterval("-M2")
NamedPitch("b'")
>>> abjad.NamedPitch("cs''") + abjad.NamedInterval("P1")
NamedPitch("cs''")
>>> abjad.NamedPitch("cs''") + abjad.NamedInterval("+M2")
NamedPitch("ds''")
Return type:

NamedPitch

__copy__(*arguments)[source]

Copies named pitch. :rtype: NamedPitch

>>> import copy
>>> copy.copy(abjad.NamedPitch("c''"))
NamedPitch("c''")
>>> copy.copy(abjad.NamedPitch("cs''"))
NamedPitch("cs''")
>>> copy.copy(abjad.NamedPitch("df''"))
NamedPitch("df''")

Copies arrowed pitch:

>>> pitch = abjad.NamedPitch("cs''", arrow=abjad.UP)
>>> copy.copy(pitch)
NamedPitch("cs''", arrow=Vertical.UP)
overridden __eq__(argument)[source]

Is true when argument is a named pitch equal to this named pitch.

>>> pitch_1 = abjad.NamedPitch("fs")
>>> pitch_2 = abjad.NamedPitch("fs")
>>> pitch_3 = abjad.NamedPitch("gf")
>>> pitch_1 == pitch_1
True
>>> pitch_1 == pitch_2
True
>>> pitch_1 == pitch_3
False
>>> pitch_2 == pitch_1
True
>>> pitch_2 == pitch_2
True
>>> pitch_2 == pitch_3
False
>>> pitch_3 == pitch_1
False
>>> pitch_3 == pitch_2
False
>>> pitch_3 == pitch_3
True

Returns true or false.

Return type:

bool

(Pitch).__float__()

Coerce to float.

Returns float.

(Pitch).__ge__(other)

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

(Pitch).__gt__(other)

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

overridden __hash__()[source]

Hashes numbered pitch.

overridden __le__(argument)[source]

Is true when named pitch is less than or equal to argument.

>>> pitch_1 = abjad.NamedPitch("fs")
>>> pitch_2 = abjad.NamedPitch("fs")
>>> pitch_3 = abjad.NamedPitch("gf")
>>> pitch_1 <= pitch_1
True
>>> pitch_1 <= pitch_2
True
>>> pitch_1 <= pitch_3
True
>>> pitch_2 <= pitch_1
True
>>> pitch_2 <= pitch_2
True
>>> pitch_2 <= pitch_3
True
>>> pitch_3 <= pitch_1
False
>>> pitch_3 <= pitch_2
False
>>> pitch_3 <= pitch_3
True
Return type:

bool

overridden __lt__(argument)[source]

Is true when named pitch is less than argument.

>>> pitch_1 = abjad.NamedPitch("fs")
>>> pitch_2 = abjad.NamedPitch("fs")
>>> pitch_3 = abjad.NamedPitch("gf")
>>> 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.

Return type:

bool

__radd__(interval)[source]

Right-addition not defined on named pitches.

>>> abjad.NamedPitch("cs'").__radd__(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/trevor/abjad/abjad/pitch.py", line 4777, in __radd__
    raise NotImplementedError(message)
NotImplementedError: right-addition not defined on NamedPitch.
overridden __repr__()[source]

Gets repr.

__sub__(argument)[source]

Subtracts argument from named pitch.

>>> abjad.NamedPitch("cs''") - abjad.NamedPitch("b'")
NamedInterval('-M2')
>>> abjad.NamedPitch("cs''") - abjad.NamedPitch("fs''")
NamedInterval('+P4')
Return type:

NamedInterval


Methods

overridden get_name(locale=None)[source]

Gets name of named pitch according to locale.

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

Set locale to 'us' or none.

Return type:

str

overridden invert(axis=None)[source]

Inverts named pitch around axis.

Inverts pitch around middle C explicitly:

>>> abjad.NamedPitch("d'").invert("c'")
NamedPitch('bf')
>>> abjad.NamedPitch("bf").invert("c'")
NamedPitch("d'")

Inverts pitch around middle C implicitly:

>>> abjad.NamedPitch("d'").invert()
NamedPitch('bf')
>>> abjad.NamedPitch("bf").invert()
NamedPitch("d'")

Inverts pitch around A3:

>>> abjad.NamedPitch("d'").invert("a")
NamedPitch('e')

Interprets none-valued axis equal to middle C.

Return type:

NamedPitch

overridden multiply(n=1)[source]

Multiplies named pitch.

>>> abjad.NamedPitch("d'").multiply(1)
NamedPitch("d'")
>>> abjad.NamedPitch("d'").multiply(3)
NamedPitch("fs'")
>>> abjad.NamedPitch("d'").multiply(6)
NamedPitch("c''")
>>> abjad.NamedPitch("d'").multiply(6.5)
NamedPitch("cs''")
Return type:

NamedPitch

respell(accidental='sharps')[source]

Respells named pitch with accidental.

>>> abjad.NamedPitch("cs").respell(accidental="flats")
NamedPitch('df')
>>> abjad.NamedPitch("df").respell(accidental="sharps")
NamedPitch('cs')
simplify()[source]

Reduce alteration to between -2 and 2 while maintaining identical pitch number. :rtype: NamedPitch

>>> abjad.NamedPitch("cssqs'").simplify()
NamedPitch("dqs'")
>>> abjad.NamedPitch("cfffqf'").simplify()
NamedPitch('aqf')
>>> float(abjad.NamedPitch("cfffqf'").simplify()) == float(abjad.NamedPitch("aqf"))
True

Note

LilyPond by default only supports accidentals from double-flat to double-sharp.

Returns named pitch.

overridden transpose(n=0)[source]

Transposes named pitch by index n.

Transposes C4 up a minor second:

>>> abjad.NamedPitch("c'").transpose(n="m2")
NamedPitch("df'")

Transposes C4 down a major second:

>>> abjad.NamedPitch("c'").transpose(n="-M2")
NamedPitch('bf')
Return type:

NamedPitch


Class & static methods

overridden classmethod from_hertz(hertz)[source]

Makes named pitch from hertz.

>>> abjad.NamedPitch.from_hertz(440)
NamedPitch("a'")

REGRESSION. Returns c’’ (C5) and not c’ (C4):

>>> abjad.NamedPitch.from_hertz(519)
NamedPitch("c''")
Return type:

NamedPitch


Read-only properties

accidental

Gets accidental of named pitch.

>>> abjad.NamedPitch("c''").accidental
Accidental(name='natural')
>>> abjad.NamedPitch("cs''").accidental
Accidental(name='sharp')
>>> abjad.NamedPitch("df''").accidental
Accidental(name='flat')
overridden arrow

Gets arrow of named pitch.

>>> abjad.NamedPitch("cs''").arrow is None
True
>>> abjad.NamedPitch("cs''", arrow=abjad.UP).arrow
<Vertical.UP: 1>
>>> abjad.NamedPitch("cs''", arrow=abjad.DOWN).arrow
<Vertical.DOWN: -1>

Displays arrow in interpreter representation:

>>> abjad.NamedPitch("cs''", arrow=abjad.DOWN)
NamedPitch("cs''", arrow=Vertical.DOWN)

Returns up, down or none.

overridden hertz

Gets frequency of named pitch in Hertz.

>>> abjad.NamedPitch("c''").hertz
523.2511306011972
>>> abjad.NamedPitch("cs''").hertz
554.3652619537442
>>> abjad.NamedPitch("df''").hertz
554.3652619537442
overridden name

Gets name of named pitch.

>>> abjad.NamedPitch("c''").name
"c''"
>>> abjad.NamedPitch("cs''").name
"cs''"
>>> abjad.NamedPitch("df''").name
"df''"
overridden number

Gets number of named pitch.

>>> abjad.NamedPitch("c''").number
12
>>> abjad.NamedPitch("cs''").number
13
>>> abjad.NamedPitch("df''").number
13
>>> abjad.NamedPitch("cf'").number
-1
overridden octave

Gets octave of named pitch.

>>> abjad.NamedPitch("c''").octave
Octave(number=5)
>>> abjad.NamedPitch("cs''").octave
Octave(number=5)
>>> abjad.NamedPitch("df''").octave
Octave(number=5)
overridden pitch_class

Gets pitch-class of named pitch.

>>> abjad.NamedPitch("c''").pitch_class
NamedPitchClass('c')
>>> abjad.NamedPitch("cs''").pitch_class
NamedPitchClass('cs')
>>> abjad.NamedPitch("df''").pitch_class
NamedPitchClass('df')
class abjad.pitch.NamedPitchClass(name='c', *, accidental=None, arrow=None)[source]

Named pitch-class.

Initializes from pitch-class name:

>>> abjad.NamedPitchClass("cs")
NamedPitchClass('cs')
>>> abjad.NamedPitchClass("cqs")
NamedPitchClass('cqs')

Initializes from number of semitones:

>>> abjad.NamedPitchClass(14)
NamedPitchClass('d')
>>> abjad.NamedPitchClass(14.5)
NamedPitchClass('dqs')

Initializes from named pitch:

>>> abjad.NamedPitchClass(abjad.NamedPitch("d"))
NamedPitchClass('d')
>>> abjad.NamedPitchClass(abjad.NamedPitch("dqs"))
NamedPitchClass('dqs')

Initializes from numbered pitch:

>>> abjad.NamedPitchClass(abjad.NumberedPitch(14))
NamedPitchClass('d')
>>> abjad.NamedPitchClass(abjad.NumberedPitch(14.5))
NamedPitchClass('dqs')

Initializes from numbered pitch-class:

>>> abjad.NamedPitchClass(abjad.NumberedPitchClass(2))
NamedPitchClass('d')
>>> abjad.NamedPitchClass(abjad.NumberedPitchClass(2.5))
NamedPitchClass('dqs')

Initializes from pitch-class / octave-number string:

>>> abjad.NamedPitchClass("C#5")
NamedPitchClass('cs')
>>> abjad.NamedPitchClass("Cs5")
NamedPitchClass('cs')

Initializes quartertone from pitch-class / octave-number string:

>>> abjad.NamedPitchClass("C+5")
NamedPitchClass('cqs')
>>> abjad.NamedPitchClass("Cqs5")
NamedPitchClass('cqs')

Initializes from pitch-class string:

>>> abjad.NamedPitchClass("C#")
NamedPitchClass('cs')
>>> abjad.NamedPitchClass("Cs")
NamedPitchClass('cs')
>>> abjad.NamedPitchClass("cs")
NamedPitchClass('cs')

Initializes quartertone from pitch-class string

>>> abjad.NamedPitchClass("C+")
NamedPitchClass('cqs')
>>> abjad.NamedPitchClass("Cqs")
NamedPitchClass('cqs')
>>> abjad.NamedPitchClass("cqs")
NamedPitchClass('cqs')

Initializes from note:

>>> abjad.NamedPitchClass(abjad.Note("d''8."))
NamedPitchClass('d')
>>> abjad.NamedPitchClass(abjad.Note("dqs''8."))
NamedPitchClass('dqs')

Attributes Summary

__add__

Adds named_interval to named pitch-class.

__eq__

Compares string formats.

__hash__

Hashes named pitch-class.

__lt__

Compares number.

__radd__

Right-addition not defined on named pitch-classes.

__repr__

Gets repr.

__sub__

Subtracts argument from named pitch-class.

accidental

Gets accidental.

arrow

Gets arrow of named pitch-class.

invert

Inverts named pitch-class.

multiply

Multiplies named pitch-class by n.

name

Gets name of named pitch-class.

number

Gets number.

pitch_class_label

Gets pitch-class label.

transpose

Transposes named pitch-class by index named interval n.


Special methods

__add__(named_interval)[source]

Adds named_interval to named pitch-class.

>>> abjad.NamedPitchClass("cs") + abjad.NamedInterval("+M9")
NamedPitchClass('ds')
>>> abjad.NamedPitchClass("cs") + abjad.NamedInterval("-M9")
NamedPitchClass('b')
Return type:

NamedPitchClass

overridden __eq__(argument)[source]

Compares string formats.

>>> pitch_class_1 = abjad.NamedPitchClass("cs")
>>> pitch_class_2 = abjad.NamedPitchClass("cs")
>>> pitch_class_3 = abjad.NamedPitchClass("df")
>>> 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
Return type:

bool

(PitchClass).__float__()

Coerce to float.

Returns float.

(PitchClass).__ge__(other)

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

(PitchClass).__gt__(other)

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

overridden __hash__()[source]

Hashes named pitch-class.

Returns integer.

(PitchClass).__le__(other)

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

overridden __lt__(argument)[source]

Compares number.

>>> abjad.NamedPitchClass("cs") < abjad.NamedPitchClass("d")
True
>>> abjad.NamedPitchClass("d") < abjad.NamedPitchClass("cs")
False
Return type:

bool

__radd__(interval)[source]

Right-addition not defined on named pitch-classes.

>>> abjad.NamedPitchClass("cs").__radd__(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/trevor/abjad/abjad/pitch.py", line 3686, in __radd__
    raise NotImplementedError(message)
NotImplementedError: right-addition not defined on NamedPitchClass.
overridden __repr__()[source]

Gets repr.

__sub__(argument)[source]

Subtracts argument from named pitch-class.

>>> abjad.NamedPitchClass("cs") - abjad.NamedPitchClass("g")
NamedInversionEquivalentIntervalClass('+A4')
>>> abjad.NamedPitchClass("c") - abjad.NamedPitchClass("cf")
NamedInversionEquivalentIntervalClass('+A1')
>>> abjad.NamedPitchClass("cf") - abjad.NamedPitchClass("c")
NamedInversionEquivalentIntervalClass('+A1')
Return type:

NamedInversionEquivalentIntervalClass


Methods

overridden invert(axis=None)[source]

Inverts named pitch-class.

Return type:

NamedPitchClass

overridden multiply(n=1)[source]

Multiplies named pitch-class by n.

>>> abjad.NamedPitchClass("cs").multiply(3)
NamedPitchClass('ef')
Return type:

NamedPitchClass

overridden transpose(n=0)[source]

Transposes named pitch-class by index named interval n.

>>> interval = abjad.NamedInterval("-M2")
>>> abjad.NamedPitchClass("cs").transpose(interval)
NamedPitchClass('b')
>>> interval = abjad.NamedInterval("P1")
>>> abjad.NamedPitchClass("cs").transpose(interval)
NamedPitchClass('cs')
>>> interval = abjad.NamedInterval("+M2")
>>> abjad.NamedPitchClass("cs").transpose(interval)
NamedPitchClass('ds')
Return type:

NamedPitchClass


Read-only properties

overridden accidental

Gets accidental.

>>> abjad.NamedPitchClass("cs").accidental
Accidental(name='sharp')
arrow

Gets arrow of named pitch-class.

Returns up, down or none.

name

Gets name of named pitch-class.

>>> abjad.NamedPitchClass("cs").name
'cs'
number

Gets number.

>>> abjad.NamedPitchClass("cs").number
1
overridden pitch_class_label

Gets pitch-class label.

>>> abjad.NamedPitchClass("cs").pitch_class_label
'C#'
class abjad.pitch.NumberedInterval(number=0)[source]

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__

Compares number.

__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

__repr__

Gets repr.

__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 numbered interval class.

number

Gets number of numbered interval.

octaves

Gets octaves of interval.

semitones

Gets semitones corresponding to numbered interval.

signed_string

Gets signed string.

transpose

Transposes pitch_carrier


Special methods

__abs__()[source]

Absolute value of numbered interval.

>>> abs(abjad.NumberedInterval(-14))
NumberedInterval(14)
Return type:

NumberedInterval

__add__(argument)[source]

Adds argument to numbered interval.

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

NumberedInterval

__copy__()[source]

Copies numbered interval. :rtype: NumberedInterval

>>> import copy
>>> copy.copy(abjad.NumberedInterval(-14))
NumberedInterval(-14)
overridden __eq__(argument)[source]

Compares number.

>>> 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
Return type:

bool

__float__()[source]

Coerce to float.

Returns float.

(Interval).__ge__(other)

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

(Interval).__gt__(other)

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

overridden __hash__()[source]

Hashes numbered interval.

Returns integer.

(Interval).__le__(other)

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

overridden __lt__(argument)[source]

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.

Return type:

bool

__neg__()[source]

Negates numbered interval.

>>> -abjad.NumberedInterval(-14)
NumberedInterval(14)
Return type:

NumberedInterval

__radd__(argument)[source]

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)
Return type:

NumberedInterval

overridden __repr__()[source]

Gets repr.

__sub__(argument)[source]

Subtracts argument from numbered interval.

Return type:

NumberedInterval


Methods

overridden transpose(pitch_carrier)[source]

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)[source]

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)
Return type:

NumberedInterval


Read-only properties

(Interval).cents

Gets cents of interval.

Returns nonnegative number.

overridden 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
overridden interval_class

Gets numbered interval class.

overridden number

Gets number of numbered interval.

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

Gets octaves of interval.

overridden semitones

Gets semitones corresponding to numbered interval.

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

Gets signed string.

class abjad.pitch.NumberedIntervalClass(number=0)[source]

Numbered interval-class.

Initializes from integer:

>>> abjad.NumberedIntervalClass(-14)
NumberedIntervalClass(-2)

Initializes from float:

>>> abjad.NumberedIntervalClass(-14.5)
NumberedIntervalClass(-2.5)

Initializes from string:

>>> abjad.NumberedIntervalClass("-14.5")
NumberedIntervalClass(-2.5)
>>> abjad.NumberedIntervalClass("P8")
NumberedIntervalClass(12)
>>> abjad.NumberedIntervalClass("-P8")
NumberedIntervalClass(-12)

Attributes Summary

__abs__

Gets absolute value of numbered interval-class.

__add__

Adds argument to numbered interval-class.

__eq__

Compares number.

__float__

Coerce to semitones as float.

__hash__

Hashes numbered interval-class.

__lt__

Compares number.

__radd__

Adds argument to numbered interval-class.

__repr__

Gets repr.

__sub__

Subtracts argument from numbered interval-class.

direction_number

Gets direction number of numbered interval-class.

from_pitch_carriers

Makes numbered interval-class from pitch_carrier_1 and pitch_carrier_2

signed_string

Gets signed string.


Special methods

overridden __abs__()[source]

Gets absolute value of numbered interval-class.

Returns new numbered interval-class.

__add__(argument)[source]

Adds argument to numbered interval-class.

Returns new numbered interval-class.

overridden __eq__(argument)[source]

Compares number.

>>> interval_class_1 = abjad.NumberedIntervalClass(0)
>>> interval_class_2 = abjad.NumberedIntervalClass(0)
>>> interval_class_3 = abjad.NumberedIntervalClass(1)
>>> interval_class_1 == interval_class_1
True
>>> interval_class_1 == interval_class_2
True
>>> interval_class_1 == interval_class_3
False
>>> interval_class_2 == interval_class_1
True
>>> interval_class_2 == interval_class_2
True
>>> interval_class_2 == interval_class_3
False
>>> interval_class_3 == interval_class_1
False
>>> interval_class_3 == interval_class_2
False
>>> interval_class_3 == interval_class_3
True
Return type:

bool

__float__()[source]

Coerce to semitones as float.

Returns float.

(IntervalClass).__ge__(other)

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

(IntervalClass).__gt__(other)

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

overridden __hash__()[source]

Hashes numbered interval-class.

Returns integer.

(IntervalClass).__le__(other)

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

overridden __lt__(argument)[source]

Compares number.

>>> interval_class_1 = abjad.NumberedIntervalClass(0)
>>> interval_class_2 = abjad.NumberedIntervalClass(0)
>>> interval_class_3 = abjad.NumberedIntervalClass(1)
>>> interval_class_1 < interval_class_1
False
>>> interval_class_1 < interval_class_2
False
>>> interval_class_1 < interval_class_3
True
>>> interval_class_2 < interval_class_1
False
>>> interval_class_2 < interval_class_2
False
>>> interval_class_2 < interval_class_3
True
>>> interval_class_3 < interval_class_1
False
>>> interval_class_3 < interval_class_2
False
>>> interval_class_3 < interval_class_3
False

Returns true or false.

__radd__(argument)[source]

Adds argument to numbered interval-class.

Returns new numbered interval-class.

overridden __repr__()[source]

Gets repr.

__sub__(argument)[source]

Subtracts argument from numbered interval-class.

Returns new numbered interval-class.


Methods

(IntervalClass).transpose(pitch_carrier)

Transposes pitch_carrier by interval-class.

Returns new pitch carrier.


Class & static methods

classmethod from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)[source]

Makes numbered interval-class from pitch_carrier_1 and pitch_carrier_2

>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(-2),
...     abjad.NamedPitch(12),
... )
NumberedIntervalClass(2)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(0),
...     abjad.NamedPitch(12),
... )
NumberedIntervalClass(12)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(9),
...     abjad.NamedPitch(12),
... )
NumberedIntervalClass(3)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(9),
... )
NumberedIntervalClass(-3)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(12),
... )
NumberedIntervalClass(0)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(24),
...     abjad.NamedPitch(0),
... )
NumberedIntervalClass(-12)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(-2),
... )
NumberedIntervalClass(-2)

Returns numbered interval-class.

Return type:

NumberedIntervalClass


Read-only properties

direction_number

Gets direction number of numbered interval-class.

Returns -1, 0 or 1.

(IntervalClass).number

Gets number of interval-class.

Returns number.

signed_string

Gets signed string.

class abjad.pitch.NumberedInversionEquivalentIntervalClass(number=0)[source]

Numbered inversion-equivalent interval-class.

Initializes from integer:

>>> abjad.NumberedInversionEquivalentIntervalClass(0)
NumberedInversionEquivalentIntervalClass(0)
>>> abjad.NumberedInversionEquivalentIntervalClass(1)
NumberedInversionEquivalentIntervalClass(1)

Initializes from float:

>>> abjad.NumberedInversionEquivalentIntervalClass(1.5)
NumberedInversionEquivalentIntervalClass(1.5)

Initializes from string:

>>> abjad.NumberedInversionEquivalentIntervalClass("1")
NumberedInversionEquivalentIntervalClass(1)

Attributes Summary

__abs__

Gets absolute value of numbered inversion-equivalent interval-class.

__lt__

Compares number.

__neg__

Negates numbered inversion-equivalent interval-class.

__repr__

Gets repr.


Special methods

overridden __abs__()[source]

Gets absolute value of numbered inversion-equivalent interval-class.

>>> abs(abjad.NumberedInversionEquivalentIntervalClass(0))
NumberedInversionEquivalentIntervalClass(0)
>>> abs(abjad.NumberedInversionEquivalentIntervalClass(1.5))
NumberedInversionEquivalentIntervalClass(1.5)

Returns new numbered inversion-equivalent interval-class.

(NumberedIntervalClass).__add__(argument)

Adds argument to numbered interval-class.

Returns new numbered interval-class.

(NumberedIntervalClass).__eq__(argument)

Compares number.

>>> interval_class_1 = abjad.NumberedIntervalClass(0)
>>> interval_class_2 = abjad.NumberedIntervalClass(0)
>>> interval_class_3 = abjad.NumberedIntervalClass(1)
>>> interval_class_1 == interval_class_1
True
>>> interval_class_1 == interval_class_2
True
>>> interval_class_1 == interval_class_3
False
>>> interval_class_2 == interval_class_1
True
>>> interval_class_2 == interval_class_2
True
>>> interval_class_2 == interval_class_3
False
>>> interval_class_3 == interval_class_1
False
>>> interval_class_3 == interval_class_2
False
>>> interval_class_3 == interval_class_3
True
Return type:

bool

(NumberedIntervalClass).__float__()

Coerce to semitones as float.

Returns float.

(IntervalClass).__ge__(other)

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

(IntervalClass).__gt__(other)

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

(NumberedIntervalClass).__hash__()

Hashes numbered interval-class.

Returns integer.

(IntervalClass).__le__(other)

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

overridden __lt__(argument)[source]

Compares number.

__neg__()[source]

Negates numbered inversion-equivalent interval-class.

>>> -abjad.NumberedInversionEquivalentIntervalClass(0)
NumberedInversionEquivalentIntervalClass(0)
>>> -abjad.NumberedInversionEquivalentIntervalClass(1.5)
NumberedInversionEquivalentIntervalClass(1.5)

Returns new numbered inversion-equivalent interval-class.

(NumberedIntervalClass).__radd__(argument)

Adds argument to numbered interval-class.

Returns new numbered interval-class.

overridden __repr__()[source]

Gets repr.

(NumberedIntervalClass).__sub__(argument)

Subtracts argument from numbered interval-class.

Returns new numbered interval-class.


Methods

(IntervalClass).transpose(pitch_carrier)

Transposes pitch_carrier by interval-class.

Returns new pitch carrier.


Class & static methods

classmethod (NumberedIntervalClass).from_pitch_carriers(pitch_carrier_1, pitch_carrier_2)

Makes numbered interval-class from pitch_carrier_1 and pitch_carrier_2

>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(-2),
...     abjad.NamedPitch(12),
... )
NumberedIntervalClass(2)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(0),
...     abjad.NamedPitch(12),
... )
NumberedIntervalClass(12)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(9),
...     abjad.NamedPitch(12),
... )
NumberedIntervalClass(3)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(9),
... )
NumberedIntervalClass(-3)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(12),
... )
NumberedIntervalClass(0)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(24),
...     abjad.NamedPitch(0),
... )
NumberedIntervalClass(-12)
>>> abjad.NumberedIntervalClass.from_pitch_carriers(
...     abjad.NamedPitch(12),
...     abjad.NamedPitch(-2),
... )
NumberedIntervalClass(-2)

Returns numbered interval-class.

Return type:

NumberedIntervalClass


Read-only properties

(NumberedIntervalClass).direction_number

Gets direction number of numbered interval-class.

Returns -1, 0 or 1.

(IntervalClass).number

Gets number of interval-class.

Returns number.

(NumberedIntervalClass).signed_string

Gets signed string.

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

Numbered pitch.

Initializes from number:

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

Initializes from other numbered pitch:

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

Initializes from pitch-class / octave pair:

>>> abjad.NumberedPitch((1, 5))
NumberedPitch(13)

Attributes Summary

__add__

Adds argument to numbered pitch.

__eq__

Is true when argument is a numbered pitch with number the same as this numbered pitch.

__hash__

Hashes numbered pitch.

__le__

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

__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.

__repr__

Gets repr.

__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)[source]

Adds argument to numbered pitch.

>>> abjad.NumberedPitch(12) + abjad.NumberedPitch(13)
NumberedPitch(25)
>>> abjad.NumberedPitch(13) + abjad.NumberedPitch(12)
NumberedPitch(25)
Return type:

NumberedPitch

overridden __eq__(argument)[source]

Is true when argument is a numbered pitch with number the same as this numbered pitch.

Return type:

bool

(Pitch).__float__()

Coerce to float.

Returns float.

(Pitch).__ge__(other)

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

(Pitch).__gt__(other)

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

overridden __hash__()[source]

Hashes numbered pitch.

overridden __le__(argument)[source]

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

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

bool

overridden __lt__(argument)[source]

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
Return type:

bool

__neg__()[source]

Negates numbered pitch.

>>> -abjad.NumberedPitch(13.5)
NumberedPitch(-13.5)
>>> -abjad.NumberedPitch(-13.5)
NumberedPitch(13.5)
Return type:

NumberedPitch

__radd__(argument)[source]

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)
Return type:

NumberedPitch

overridden __repr__()[source]

Gets repr.

__sub__(argument)[source]

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)
Return type:

NumberedInterval


Methods

overridden get_name(locale=None)[source]

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.

Return type:

str

interpolate(stop_pitch, fraction)[source]

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, 0)
NumberedPitch(0)
>>> start_pitch.interpolate(stop_pitch, (1, 4))
NumberedPitch(3)
>>> start_pitch.interpolate(stop_pitch, (1, 2))
NumberedPitch(6)
>>> start_pitch.interpolate(stop_pitch, (3, 4))
NumberedPitch(9)
>>> start_pitch.interpolate(stop_pitch, 1)
NumberedPitch(12)

Interpolates from C5 to C4:

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

NumberedPitch

overridden invert(axis=None)[source]

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)
Return type:

NumberedPitch

overridden multiply(n=1)[source]

Multiplies numbered pitch by index n.

>>> abjad.NumberedPitch(14).multiply(3)
NumberedPitch(42)
Return type:

NumberedPitch

overridden transpose(n=0)[source]

Tranposes numbered pitch by n semitones.

>>> abjad.NumberedPitch(13).transpose(1)
NumberedPitch(14)
Return type:

NumberedPitch


Class & static methods

overridden classmethod from_hertz(hertz)[source]

Makes numbered pitch from hertz.

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

REGRESSION. Returns 12 (not 0):

>>> abjad.NumberedPitch.from_hertz(519)
NumberedPitch(12)
Return type:

NumberedPitch


Read-only properties

accidental

Gets accidental of numbered pitch.

>>> abjad.NumberedPitchClass(13).accidental
Accidental(name='sharp')
overridden arrow

Gets arrow of numbered pitch.

>>> abjad.NumberedPitch(13).arrow is None
True
>>> abjad.NumberedPitch(13, arrow=abjad.UP).arrow
<Vertical.UP: 1>
>>> abjad.NumberedPitch(13, arrow=abjad.DOWN).arrow
<Vertical.DOWN: -1>

Returns up, down or none.

overridden 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
overridden name

Gets name of numbered pitch.

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

Gets number of numbered pitch.

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

Gets octave of numbered pitch.

>>> abjad.NumberedPitch(13).octave
Octave(number=5)
overridden pitch_class

Gets pitch-class of numbered pitch.

>>> abjad.NumberedPitch(13).pitch_class
NumberedPitchClass(1)
class abjad.pitch.NumberedPitchClass(number=0, *, arrow=None)[source]

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__

Compares number.

__hash__

Hashes numbered pitch-class.

__lt__

Compares number.

__neg__

Negates numbered pitch-class.

__radd__

Right-addition not defined on numbered pitch-classes.

__repr__

Gets repr.

__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)[source]

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)
Return type:

NumberedPitchClass

__copy__(*arguments)[source]

Copies numbered pitch-class.

>>> import copy
>>> pitch_class = abjad.NumberedPitchClass(9)
>>> copy.copy(pitch_class)
NumberedPitchClass(9)
Return type:

NumberedPitchClass

overridden __eq__(argument)[source]

Compares number.

>>> 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
(PitchClass).__float__()

Coerce to float.

Returns float.

(PitchClass).__ge__(other)

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

(PitchClass).__gt__(other)

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

overridden __hash__()[source]

Hashes numbered pitch-class.

Returns integer.

(PitchClass).__le__(other)

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

overridden __lt__(argument)[source]

Compares number.

>>> abjad.NumberedPitchClass(1) < abjad.NumberedPitchClass(2)
True
>>> abjad.NumberedPitchClass(2) < abjad.NumberedPitchClass(1)
False
Return type:

bool

__neg__()[source]

Negates numbered pitch-class.

>>> pitch_class = abjad.NumberedPitchClass(9)
>>> -pitch_class
NumberedPitchClass(3)
Return type:

NumberedPitchClass

__radd__(argument)[source]

Right-addition not defined on numbered pitch-classes.

>>> 1 + abjad.NumberedPitchClass(9)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/trevor/abjad/abjad/pitch.py", line 4056, in __radd__
    raise NotImplementedError(message)
NotImplementedError: right-addition not defined on NumberedPitchClass.

Raises not implemented error.

overridden __repr__()[source]

Gets repr.

__sub__(argument)[source]

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)
Return type:

Union[NumberedPitchClass, NumberedInversionEquivalentIntervalClass]


Methods

overridden invert(axis=None)[source]

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.

Return type:

NumberedPitchClass

overridden multiply(n=1)[source]

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)
Return type:

NumberedPitchClass

overridden transpose(n=0)[source]

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)
Return type:

NumberedPitchClass


Read-only properties

overridden accidental

Gets accidental.

>>> abjad.NumberedPitchClass(1).accidental
Accidental(name='sharp')
arrow

Gets arrow of numbered pitch-class.

Returns up, down or none.

name

Gets name of numbered pitch-class.

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

Gets number.

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

Gets pitch-class / octave label.

>>> abjad.NumberedPitchClass(13).pitch_class_label
'C#'
class abjad.pitch.Octave(number=4)[source]

Octave.

Initializes octave from integer:

>>> abjad.Octave(4)
Octave(number=4)

Initializes octave from named pitch:

>>> abjad.Octave(abjad.NamedPitch("cs''"))
Octave(number=5)

Initializes octave from other octave:

>>> abjad.Octave(abjad.Octave(2))
Octave(number=2)
>>> octave_1 = abjad.Octave(4)
>>> octave_2 = abjad.Octave(4)
>>> octave_3 = abjad.Octave(5)
>>> octave_1 == octave_1
True
>>> octave_1 == octave_2
True
>>> octave_1 == octave_3
False
>>> octave_2 == octave_1
True
>>> octave_2 == octave_2
True
>>> octave_2 == octave_3
False
>>> octave_3 == octave_1
False
>>> octave_3 == octave_2
False
>>> octave_3 == octave_3
True

Attributes Summary

__eq__

Return self==value.

__float__

Get octave number as float.

__ge__

Return self>=value.

__gt__

Return self>value.

__hash__

Return hash(self).

__int__

Get octave number integer.

__le__

Return self<=value.

__lt__

Return self<value.

__post_init__

__repr__

Return repr(self).

from_pitch

Makes octave from pitch.

from_ticks

Makes octave from ticks string.

pitch_number

Gets pitch number of first note in octave.

ticks

Gets LilyPond octave tick string.


Special methods

overridden __eq__(other)

Return self==value.

__float__()[source]

Get octave number as float.

Returns float.

overridden __ge__(other)

Return self>=value.

overridden __gt__(other)

Return self>value.

overridden __hash__()

Return hash(self).

__int__()[source]

Get octave number integer.

Returns integer.

overridden __le__(other)

Return self<=value.

overridden __lt__(other)

Return self<value.

__post_init__()[source]
overridden __repr__()

Return repr(self).


Class & static methods

classmethod from_pitch(pitch)[source]

Makes octave from pitch.

>>> abjad.Octave.from_pitch("cs")
Octave(number=3)
>>> abjad.Octave.from_pitch("cs'")
Octave(number=4)
>>> abjad.Octave.from_pitch(1)
Octave(number=4)
>>> abjad.Octave.from_pitch(13)
Octave(number=5)
Return type:

Octave

classmethod from_ticks(ticks)[source]

Makes octave from ticks string.

>>> abjad.Octave.from_ticks("'")
Octave(number=4)
>>> abjad.Octave.from_ticks(",,")
Octave(number=1)
Return type:

Octave


Read-only properties

pitch_number

Gets pitch number of first note in octave.

>>> abjad.Octave(4).pitch_number
0
>>> abjad.Octave(5).pitch_number
12
>>> abjad.Octave(3).pitch_number
-12
ticks

Gets LilyPond octave tick string.

>>> for i in range(-1, 9):
...     print(i, abjad.Octave(i).ticks)
... 
-1 ,,,,
0 ,,,
1 ,,
2 ,
3 
4 '
5 ''
6 '''
7 ''''
8 '''''
class abjad.pitch.Pitch(argument, accidental=None, arrow=None, octave=None)[source]

Abstract pitch.


Attributes Summary

__float__

Coerce to float.

__ge__

Return a >= b.

__gt__

Return a > b.

__hash__

Hashes pitch.

__le__

Return a <= b.

__lt__

Is true when pitch is less than argument.

arrow

Gets arrow of pitch.

from_hertz

Creates pitch from hertz.

get_name

Gets name of pitch according to locale.

hertz

Gets frequency of pitch in Hertz.

invert

Inverts pitch about axis.

multiply

Multiplies pitch by n.

name

Gets name of pitch.

number

Gets number of pitch.

octave

Gets octave of pitch.

pitch_class

Gets pitch-class of pitch.

transpose

Transposes pitch by index n.


Special methods

__float__()[source]

Coerce to float.

Returns float.

overridden __ge__(other)

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

overridden __gt__(other)

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

overridden __hash__()[source]

Hashes pitch.

Return type:

int

overridden __le__(other)

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

overridden __lt__(argument)[source]

Is true when pitch is less than argument.

Returns true or false.


Methods

get_name(locale=None)[source]

Gets name of pitch according to locale.

Returns string.

invert(axis=None)[source]

Inverts pitch about axis.

Interprets axis of none equal to middle C.

Returns new pitch.

multiply(n=1)[source]

Multiplies pitch by n.

Returns new pitch.

transpose(n)[source]

Transposes pitch by index n.

Returns new pitch.


Class & static methods

classmethod from_hertz(hertz)[source]

Creates pitch from hertz.

Returns new pitch.


Read-only properties

arrow

Gets arrow of pitch.

hertz

Gets frequency of pitch in Hertz.

name

Gets name of pitch.

Returns string.

number

Gets number of pitch.

Returns number.

octave

Gets octave of pitch.

Returns octave.

pitch_class

Gets pitch-class of pitch.

Returns pitch-class.

class abjad.pitch.PitchClass(argument)[source]

Abstract pitch-class.


Attributes Summary

__eq__

Compares reprs.

__float__

Coerce to float.

__ge__

Return a >= b.

__gt__

Return a > b.

__hash__

Hashes pitch-class.

__le__

Return a <= b.

__lt__

Is true when pitch-class is less than argument.

accidental

Gets accidental of pitch-class.

invert

Inverts pitch-class about axis.

multiply

Multiplies pitch-class by n.

pitch_class_label

Gets pitch-class label of pitch-class.

transpose

Transposes pitch-class by index n.


Special methods

overridden __eq__(argument)[source]

Compares reprs.

Return type:

bool

__float__()[source]

Coerce to float.

Returns float.

overridden __ge__(other)

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

overridden __gt__(other)

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

overridden __hash__()[source]

Hashes pitch-class.

Return type:

int

overridden __le__(other)

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

overridden __lt__(argument)[source]

Is true when pitch-class is less than argument.

Returns true or false.


Methods

accidental()[source]

Gets accidental of pitch-class.

invert(axis=None)[source]

Inverts pitch-class about axis.

Returns new pitch-class.

multiply(n=1)[source]

Multiplies pitch-class by n.

Returns new pitch-class.

pitch_class_label()[source]

Gets pitch-class label of pitch-class.

transpose(n=0)[source]

Transposes pitch-class by index n.

Returns new pitch-class.

class abjad.pitch.StaffPosition(number=0)[source]

Staff position.

Middle line of staff:

>>> abjad.StaffPosition(0)
StaffPosition(number=0)

One space below middle line of staff:

>>> abjad.StaffPosition(-1)
StaffPosition(number=-1)

One line below middle line of staff:

>>> abjad.StaffPosition(-2)
StaffPosition(number=-2)

Attributes Summary

__delattr__

Implement delattr(self, name).

__eq__

Return self==value.

__ge__

Return self>=value.

__gt__

Return self>value.

__hash__

Return hash(self).

__le__

Return self<=value.

__lt__

Return self<value.

__post_init__

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).


Special methods

overridden __delattr__(name)

Implement delattr(self, name).

overridden __eq__(other)

Return self==value.

overridden __ge__(other)

Return self>=value.

overridden __gt__(other)

Return self>value.

overridden __hash__()

Return hash(self).

overridden __le__(other)

Return self<=value.

overridden __lt__(other)

Return self<value.

__post_init__()[source]
overridden __repr__()

Return repr(self).

overridden __setattr__(name, value)

Implement setattr(self, name, value).