Accidental

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.Accidental" [URL="../api/abjad/pitch/Accidental.html#abjad.pitch.Accidental.Accidental", color=black, fontcolor=white, label=Accidental, target=_top]; } 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.Accidental.Accidental"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.pitch.Accidental.Accidental(name='', *, arrow=None)

Accidental.

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

Generalized accidentals are allowed:

>>> abjad.Accidental('ssss')
Accidental('ssss')

Attributes Summary

__add__ Adds argument to accidental.
__call__ Calls accidental on argument.
__ge__ Return a >= b.
__gt__ Return a > b.
__le__ Return a <= b.
__lt__ Is true when argument is an accidental with semitones greater than those of this accidental.
__neg__ Negates accidental.
__radd__ Raises not implemented error on accidental.
__str__ Gets string representation of accidental.
__sub__ Subtracts argument from accidental.
arrow Gets arrow of accidental.
name Gets name of accidental.
respell_with_flats Respells selection with flats.
respell_with_sharps Respells selection with sharps.
semitones Gets semitones of accidental.
symbol Gets symbol of accidental.

Special methods

__add__(argument)

Adds argument to accidental.

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

Returns new accidental.

__call__(argument)

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.

(AbjadValueObject).__copy__(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(argument)

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

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to '' or 'storage'. Interprets '' equal to 'storage'.

Returns string.

__ge__(other, NotImplemented=NotImplemented)

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

__gt__(other, NotImplemented=NotImplemented)

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

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

__le__(other, NotImplemented=NotImplemented)

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

__lt__(argument)

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

Returns true or false.

__neg__()

Negates accidental.

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

Returns new accidental.

__radd__(argument)

Raises not implemented error on accidental.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

__str__()

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'

Returns string.

__sub__(argument)

Subtracts argument from accidental.

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

Returns new accidental.


Class & static methods

static respell_with_flats(selection)

Respells selection with flats.

Respells notes in staff:

>>> staff = abjad.Staff("c'8 cs'8 d'8 ef'8 e'8 f'8")
>>> abjad.show(staff) 
>>> abjad.Accidental.respell_with_flats(staff)
>>> abjad.show(staff) 

Returns none.

static respell_with_sharps(selection)

Respells selection with sharps.

Respells notes in staff:

>>> staff = abjad.Staff("c'8 cs'8 d'8 ef'8 e'8 f'8")
>>> abjad.show(staff) 
>>> abjad.Accidental.respell_with_sharps(staff)
>>> abjad.show(staff) 

Returns none.


Read-only properties

arrow

Gets arrow of accidental.

Most accidentals carry no arrow:

>>> abjad.Accidental('sharp').arrow is None
True

Sharp with up-arrow:

>>> abjad.Accidental('sharp', arrow=abjad.Up).arrow
Up

Sharp with down-arrow:

>>> abjad.Accidental('sharp', arrow=abjad.Down).arrow
Down

Arrow property is currently a stub in the object model. You can set the property but accidental math and formatting currently ignore the setting.

Returns up, down or none.

name

Gets name of accidental.

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

Returns string.

semitones

Gets semitones of accidental.

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

Returns number.

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

Returns string.