TonalAnalysisAgent

class tonalanalysistools.TonalAnalysisAgent(client=None)

A tonal analysis interface.

Example 1. Interface to conjunct selection:

>>> staff = Staff("c'4 d' e' f'")
>>> show(staff) 
>>> selection_1 = tonalanalysistools.select(staff[:])

Example 2. Interface to disjunct selection:

>>> staff = Staff("c'4 d' e' f'")
>>> show(staff) 
>>> selection_2 = tonalanalysistools.select(staff[:1] + staff[-1:])

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.TonalAnalysisAgent.TonalAnalysisAgent" [color=black, fontcolor=white, group=2, label=<<B>TonalAnalysisAgent</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.TonalAnalysisAgent.TonalAnalysisAgent"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

analyze_chords() Analyzes chords in selection.
analyze_incomplete_chords() Analyzes incomplete chords in selection.
analyze_incomplete_tonal_functions(key_signature) Analyzes incomplete tonal functions of chords in selection according to key_signature.
analyze_neighbor_notes() Is true when note in selection is preceeded by a stepwise interval in one direction and followed by a stepwise interval in the other direction.
analyze_passing_tones() Is true when note in selection is both preceeded and followed by scalewise notes.
analyze_tonal_functions(key_signature) Analyzes tonal function of chords in selection according to key_signature.
are_scalar_notes() Is true when notes in selection are scalar.
are_stepwise_ascending_notes() Is true when notes in selection are stepwise ascending.
are_stepwise_descending_notes() Is true when notes in selection are stepwise descending.
are_stepwise_notes() Is true when notes in selection are stepwise.
client Returns client of mutation agent.
__eq__(expr) Is true when ID of expr equals ID of Abjad object.
__format__([format_specification]) Formats Abjad object.
__hash__() Hashes Abjad object.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

TonalAnalysisAgent.client

Returns client of mutation agent.

Returns selection or component.

Methods

TonalAnalysisAgent.analyze_chords()

Analyzes chords in selection.

>>> chord = Chord([7, 10, 12, 16], (1, 4))
>>> tonalanalysistools.select(chord).analyze_chords()
[CDominantSeventhInSecondInversion]

Returns none when no tonal chord is understood.

Returns list with elements each equal to chord class or none.

TonalAnalysisAgent.analyze_incomplete_chords()

Analyzes incomplete chords in selection.

>>> chord = Chord("<g' b'>4")
>>> tonalanalysistools.select(chord).analyze_incomplete_chords()
[GMajorTriadInRootPosition]
>>> chord = Chord("<fs g b>4")
>>> tonalanalysistools.select(chord).analyze_incomplete_chords()
[GMajorSeventhInSecondInversion]

Raises tonal harmony error when chord in selection can not analyze.

Returns list with elements each equal to chord class or none.

TonalAnalysisAgent.analyze_incomplete_tonal_functions(key_signature)

Analyzes incomplete tonal functions of chords in selection according to key_signature.

>>> chord = Chord("<c' e'>4")
>>> key_signature = KeySignature('g', 'major')
>>> selection = tonalanalysistools.select(chord)
>>> selection.analyze_incomplete_tonal_functions(key_signature)
[IVMajorTriadInRootPosition]

Raises tonal harmony error when chord in selection can not analyze.

Returns list with elements each equal to tonal function or none.

TonalAnalysisAgent.analyze_neighbor_notes()

Is true when note in selection is preceeded by a stepwise interval in one direction and followed by a stepwise interval in the other direction. Otherwise false.

>>> staff = Staff("c'8 d'8 e'8 f'8")
>>> selection = tonalanalysistools.select(staff[:])
>>> selection.analyze_neighbor_notes()
[False, False, False, False]

Returns list of boolean values.

TonalAnalysisAgent.analyze_passing_tones()

Is true when note in selection is both preceeded and followed by scalewise notes. Otherwise false.

>>> staff = Staff("c'8 d'8 e'8 f'8")
>>> selection = tonalanalysistools.select(staff[:])
>>> selection.analyze_passing_tones()
[False, True, True, False]

Returns list of boolean values.

TonalAnalysisAgent.analyze_tonal_functions(key_signature)

Analyzes tonal function of chords in selection according to key_signature.

>>> chord = Chord('<ef g bf>4')
>>> key_signature = KeySignature('c', 'major')
>>> selection = tonalanalysistools.select(chord)
>>> selection.analyze_tonal_functions(key_signature)
[FlatIIIMajorTriadInRootPosition]

Returns none when no tonal function is understood.

Returns list with elements each equal to tonal function or none.

TonalAnalysisAgent.are_scalar_notes()

Is true when notes in selection are scalar.

>>> selection_1.are_scalar_notes()
True

Otherwise false:

>>> selection_2.are_scalar_notes()
False

Returns true or false.

TonalAnalysisAgent.are_stepwise_ascending_notes()

Is true when notes in selection are stepwise ascending.

>>> selection_1.are_stepwise_ascending_notes()
True

Otherwise false:

>>> selection_2.are_stepwise_ascending_notes()
False

Returns true or false.

TonalAnalysisAgent.are_stepwise_descending_notes()

Is true when notes in selection are stepwise descending.

>>> selection_3 = tonalanalysistools.select(reversed(staff[:]))
>>> selection_3.are_stepwise_descending_notes()
True

Otherwise false:

>>> selection_1.are_stepwise_descending_notes()
False
>>> selection_2.are_stepwise_descending_notes()
False

Returns true or false.

TonalAnalysisAgent.are_stepwise_notes()

Is true when notes in selection are stepwise.

>>> selection_1.are_stepwise_notes()
True

Otherwise false:

>>> selection_2.are_stepwise_notes()
False

Returns true or false.

Special methods

(AbjadObject).__eq__(expr)

Is true when ID of expr equals ID of Abjad object. Otherwise false.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

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

Returns string.

(AbjadObject).__hash__()

Hashes Abjad object.

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

Returns integer.

(AbjadObject).__ne__(expr)

Is true when Abjad object does not equal expr. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.