Accidental

class pitchtools.Accidental(argument=None)

Accidental.

Sharp:

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

Quarter-sharp:

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

Three-quarters-flat:

>>> pitchtools.Accidental('tqf')
Accidental('tqf')

Three-quarters-sharp:

>>> pitchtools.Accidental('#+')
Accidental('tqs')

Flat:

>>> pitchtools.Accidental('flat')
Accidental('f')

Double-sharp:

>>> pitchtools.Accidental(2)
Accidental('ss')

Four-and-a-half-sharps:

>>> pitchtools.Accidental('ssssqs')
Accidental('ssssqs')

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 Gets abbreviation of accidental.
is_abbreviation(argument) Is true when argument is an alphabetic accidental abbreviation.
is_adjusted Is true for all accidentals equal to a nonzero number of semitones.
is_symbolic_string(argument) Is true when argument is a symbolic accidental string.
name Gets name of accidental.
semitones Gets semitones of accidental.
symbolic_string Gets symbolic string of accidental.
__add__(argument) Adds argument to accidental.
__copy__(*arguments) Copies Abjad value object.
__eq__(argument) Is true when all initialization values of Abjad value object equal the initialization values of argument.
__format__([format_specification]) Formats Abjad object.
__ge__(argument) Is true when argument is an accidental with semitones less than or equal to those of this accidental.
__gt__(argument) Is true when argument is an accidental with semitones less than those of this accidental.
__hash__() Hashes Abjad value object.
__le__(argument) Is true when argument is an accidental with semitones greater than or equal to those of this accidental.
__lt__(argument) Is true when argument is an accidental with semitones greater than those of this accidental.
__ne__(argument) Is true when accidental does not equal argument.
__neg__() Negates accidental.
__nonzero__() Defined equal to true.
__repr__() Gets interpreter representation of Abjad object.
__str__() String representation of accidental.
__sub__(argument) Subtracts argument from accidental.

Read-only properties

Accidental.abbreviation

Gets abbreviation of accidental.

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

Returns string.

Accidental.is_adjusted

Is 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

Gets name of accidental.

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

Returns string.

Accidental.semitones

Gets semitones of accidental.

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

Returns number.

Accidental.symbolic_string

Gets symbolic string of accidental.

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

Returns string.

Class & static methods

static Accidental.is_abbreviation(argument)

Is true when argument is an alphabetic accidental abbreviation. 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(argument)

Is true when argument is a symbolic accidental string. Otherwise false.

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

Empty string returns true.

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

Returns true or false.

Special methods

Accidental.__add__(argument)

Adds argument to accidental.

Returns new accidental.

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

Accidental.__ge__(argument)

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

Returns true or false.

Accidental.__gt__(argument)

Is true when argument 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__(argument)

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

Returns true or false.

Accidental.__lt__(argument)

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

Returns true or false.

Accidental.__ne__(argument)

Is true when accidental does not equal argument. 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__(argument)

Subtracts argument from accidental.

Returns new accidental.