NamedPitchClass

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.NamedPitchClass.NamedPitchClass" [URL="../api/abjad/pitch/NamedPitchClass.html#abjad.pitch.NamedPitchClass.NamedPitchClass", color=black, fontcolor=white, label="Named\nPitch\nClass", target=_top]; "abjad.pitch.PitchClass.PitchClass" [URL="../api/abjad/pitch/PitchClass.html#abjad.pitch.PitchClass.PitchClass", label="Pitch\nClass", shape=oval, style=bold, target=_top]; "abjad.pitch.PitchClass.PitchClass" -> "abjad.pitch.NamedPitchClass.NamedPitchClass"; } subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=2]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/pitch/../system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.AbjadValueObject.AbjadValueObject" [URL="../api/abjad/pitch/../system/AbjadValueObject.html#abjad.system.AbjadValueObject.AbjadValueObject", label="Abjad\nValue\nObject", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.AbjadValueObject.AbjadValueObject"; } subgraph cluster_builtins { graph [label=builtins]; node [color=3]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "abjad.system.AbjadValueObject.AbjadValueObject" -> "abjad.pitch.PitchClass.PitchClass"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.pitch.NamedPitchClass.NamedPitchClass(name='c', *, accidental=None, arrow=None)

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.
__copy__ Copies named pitch-class.
__eq__ Is true when argument can be coerced to a named pitch-class with pitch-class name equal to that of this named pitch-class.
__format__ Formats named pitch-class.
__hash__ Hashes named pitch-class.
__lt__ Is true when argument is a named pitch-class with a pitch number greater than that of this named pitch-class.
__radd__ Right-addition not defined on named pitch-classes.
__str__ Gets string representation of named pitch-class.
__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)

Adds named_interval to named pitch-class.

>>> abjad.NamedPitchClass('cs') + abjad.NamedInterval('+M9')
NamedPitchClass('ds')
>>> abjad.NamedPitchClass('cs') + abjad.NamedInterval('-M9')
NamedPitchClass('b')

Returns new named pitch-class.

__copy__(*arguments)

Copies named pitch-class.

>>> import copy
>>> copy.copy(abjad.NamedPitchClass('cs'))
NamedPitchClass('cs')

Returns new named pitch-class.

__eq__(argument)

Is true when argument can be coerced to a named pitch-class with pitch-class name equal to that of this named pitch-class.

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

Returns true or false.

(PitchClass).__float__()

Coerce to float.

Returns float.

__format__(format_specification='')

Formats named pitch-class.

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

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

Returns string.

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

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

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

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

__hash__()

Hashes named pitch-class.

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

Returns integer.

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

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

__lt__(argument)

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

Compares less than:

>>> abjad.NamedPitchClass('cs') < abjad.NamedPitchClass('d')
True

Does not compare less than:

>>> abjad.NamedPitchClass('d') < abjad.NamedPitchClass('cs')
False

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

__radd__(interval)

Right-addition not defined on named pitch-classes.

>>> abjad.NamedPitchClass("cs").__radd__(1)
Traceback (most recent call last):
    ...
NotImplementedError: right-addition not defined on NamedPitchClass.
(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

__str__()

Gets string representation of named pitch-class.

>>> str(abjad.NamedPitchClass('cs'))
'cs'

Returns string.

__sub__(argument)

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

Returns named inversion-equivalent interval-class.


Methods

invert(axis=None)

Inverts named pitch-class.

Not yet implemented.

multiply(n=1)

Multiplies named pitch-class by n.

>>> abjad.NamedPitchClass('cs').multiply(3)
NamedPitchClass('ef')

Returns new named pitch-class.

transpose(n=0)

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

Returns new named pitch-class.


Read-only properties

accidental

Gets accidental.

>>> abjad.NamedPitchClass('cs').accidental
Accidental('sharp')

Returns accidental.

arrow

Gets arrow of named pitch-class.

Returns up, down or none.

name

Gets name of named pitch-class.

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

Returns string.

number

Gets number.

>>> abjad.NamedPitchClass('cs').number
1

Returns nonnegative integer or float.

pitch_class_label

Gets pitch-class label.

>>> abjad.NamedPitchClass('cs').pitch_class_label
'C#'

Returns string.