ScaleDegree

class tonalanalysistools.ScaleDegree(*arguments)

A diatonic scale degree such as 1, 2, 3, 4, 5, 6, 7 and also chromatic alterations including flat-2, flat-3, flat-6, etc.

>>> scale_degree = tonalanalysistools.ScaleDegree('#4')
>>> scale_degree
ScaleDegree('sharp', 4)

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.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_tonalanalysistools { graph [label=tonalanalysistools]; "abjad.tools.tonalanalysistools.ScaleDegree.ScaleDegree" [color=black, fontcolor=white, group=2, label=<<B>ScaleDegree</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.AbjadObject.AbjadObject" -> "abjad.tools.tonalanalysistools.ScaleDegree.ScaleDegree"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

accidental Accidental of scale degree.
apply_accidental(accidental) Applies accidental to scale degree.
name Name of scale degree.
number Number of scale degree.
roman_numeral_string Roman numeral string of scale degree.
symbolic_string Symbolic string of scale degree.
title_string Title string of scale degree.
__eq__(arg) Is true when arg is a scale degree with number and accidental equal to those of this scale degree.
__format__([format_specification]) Formats Abjad object.
__hash__() Hashes scale degree.
__ne__(arg) Is true when arg does not equal scale degree.
__repr__() Gets interpreter representation of scale degree.
__str__() String representation of scale degree.

Read-only properties

ScaleDegree.accidental

Accidental of scale degree.

>>> scale_degree.accidental
Accidental('s')

Returns accidental.

ScaleDegree.name

Name of scale degree.

>>> tonalanalysistools.ScaleDegree(4).name
'subdominant'

Returns string.

ScaleDegree.number

Number of scale degree.

>>> scale_degree.number
4

Returns integer from 1 to 7, inclusive.

ScaleDegree.roman_numeral_string

Roman numeral string of scale degree.

>>> scale_degree.roman_numeral_string
'IV'

Returns string.

ScaleDegree.symbolic_string

Symbolic string of scale degree.

>>> scale_degree.symbolic_string
'#IV'

Returns string.

ScaleDegree.title_string

Title string of scale degree.

>>> scale_degree.title_string
'SharpFour'

Returns string.

Methods

ScaleDegree.apply_accidental(accidental)

Applies accidental to scale degree.

>>> scale_degree.apply_accidental('ff')
ScaleDegree('flat', 4)

Returns new scale degree.

Special methods

ScaleDegree.__eq__(arg)

Is true when arg is a scale degree with number and accidental equal to those of this scale degree.

>>> scale_degree == tonalanalysistools.ScaleDegree('#4')
True

Otherwise false:

>>> scale_degree == tonalanalysistools.ScaleDegree(4)
False

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

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

Returns string.

ScaleDegree.__hash__()

Hashes scale degree.

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

Returns integer.

ScaleDegree.__ne__(arg)

Is true when arg does not equal scale degree. Otherwise false.

Returns true or false.

ScaleDegree.__repr__()

Gets interpreter representation of scale degree.

>>> scale_degree
ScaleDegree('sharp', 4)

Returns string.

ScaleDegree.__str__()

String representation of scale degree.

>>> str(scale_degree)
'#4'

Returns string.