Accidental

class pitchtools.Accidental(arg='')

Accidental.

Example 1. Sharp:

>>> pitchtools.Accidental('s')
Accidental('s')

Example 2. Quarter-sharp:

>>> pitchtools.Accidental('qs')
Accidental('qs')

Accidentals are immutable.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" [color=1, group=0, label=AbjadValueObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.abctools.AbjadValueObject.AbjadValueObject"; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_pitchtools { graph [label=pitchtools]; "abjad.tools.pitchtools.Accidental.Accidental" [color=black, fontcolor=white, group=2, label=<<B>Accidental</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" -> "abjad.tools.pitchtools.Accidental.Accidental"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

abbreviation Abbreviation of accidental.
is_abbreviation(expr) Is true when expr is an alphabetic accidental abbrevation.
is_adjusted True for all accidentals equal to a nonzero number of semitones.
is_symbolic_string(expr) Is true when expr is a symbolic accidental string.
name Name of accidental.
semitones Semitones of accidental.
symbolic_string Symbolic string of accidental.
__add__(arg) Adds arg to accidental.
__copy__(\*args) Copies Abjad value object.
__eq__(expr) Is true when all initialization values of Abjad value object equal the initialization values of expr.
__format__([format_specification]) Formats Abjad object.
__ge__(arg) Is true when arg is an accidental with semitones less than or equal to those of this accidental.
__gt__(arg) Is true when arg is an accidental with semitones less than those of this accidental.
__hash__() Hashes Abjad value object.
__le__(arg) Is true when arg is an accidental with semitones greater than or equal to those of this accidental.
__lt__(arg) Is true when arg is an accidental with semitones greater than those of this accidental.
__ne__(arg) Is true when accidental does not equal arg.
__neg__() Negates accidental.
__nonzero__() Defined equal to true.
__repr__() Gets interpreter representation of Abjad object.
__str__() String representation of accidental.
__sub__(arg) Subtracts arg from accidental.

Read-only properties

Accidental.abbreviation

Abbreviation of accidental.

>>> accidental = pitchtools.Accidental('s')
>>> accidental.abbreviation
's'

Returns string.

Accidental.is_adjusted

True for all accidentals equal to a nonzero number of semitones. Otherwise false:

>>> accidental = pitchtools.Accidental('s')
>>> accidental.is_adjusted
True

Returns true or false.

Accidental.name

Name of accidental.

>>> accidental = pitchtools.Accidental('s')
>>> accidental.name
'sharp'

Returns string.

Accidental.semitones

Semitones of accidental.

>>> accidental = pitchtools.Accidental('s')
>>> accidental.semitones
1

Returns number.

Accidental.symbolic_string

Symbolic string of accidental.

>>> accidental = pitchtools.Accidental('s')
>>> accidental.symbolic_string
'#'

Returns string.

Class & static methods

static Accidental.is_abbreviation(expr)

Is true when expr is an alphabetic accidental abbrevation. Otherwise false:

>>> pitchtools.Accidental.is_abbreviation('tqs')
True

The regex ^([s]{1,2}|[f]{1,2}|t?q?[fs])!?$ underlies this predicate.

Returns true or false.

static Accidental.is_symbolic_string(expr)

Is true when expr is a symbolic accidental string. Otherwise false:

>>> pitchtools.Accidental.is_symbolic_string('#+')
True

True on empty string.

The regex ^([#]{1,2}|[b]{1,2}|[#]?[+]|[b]?[~]|)$ underlies this predicate.

Returns true or false.

Special methods

Accidental.__add__(arg)

Adds arg to accidental.

Returns new accidental.

(AbjadValueObject).__copy__(*args)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(expr)

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

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

Accidental.__ge__(arg)

Is true when arg is an accidental with semitones less than or equal to those of this accidental. Otherwise false.

Returns true or false.

Accidental.__gt__(arg)

Is true when arg is an accidental with semitones less than those of this accidental. Otherwise false.

Returns true or false.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

Accidental.__le__(arg)

Is true when arg is an accidental with semitones greater than or equal to those of this accidental. Otherwise false.

Returns true or false.

Accidental.__lt__(arg)

Is true when arg is an accidental with semitones greater than those of this accidental. Otherwise false.

Returns true or false.

Accidental.__ne__(arg)

Is true when accidental does not equal arg. Otherwise false.

Returns true or false.

Accidental.__neg__()

Negates accidental.

Returns new accidental.

Accidental.__nonzero__()

Defined equal to true.

Returns true.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

Accidental.__str__()

String representation of accidental.

Returns string.

Accidental.__sub__(arg)

Subtracts arg from accidental.

Returns new accidental.