TonalAnalysis

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.system" { graph [label="abjad.system"]; node [color=1]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjadext/tonality/../../abjad/system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; } subgraph "cluster_abjadext.tonality" { graph [label="abjadext.tonality"]; node [color=2]; "abjadext.tonality.TonalAnalysis.TonalAnalysis" [URL="../api/abjadext/tonality/TonalAnalysis.html#abjadext.tonality.TonalAnalysis.TonalAnalysis", color=black, fontcolor=white, label="Tonal\nAnalysis", target=_top]; } 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.AbjadObject.AbjadObject" -> "abjadext.tonality.TonalAnalysis.TonalAnalysis"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjadext.tonality.TonalAnalysis.TonalAnalysis(client=None)

Tonal analysis agent.

Intializes agent on conjunct selection:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.show(staff) 
>>> agent_1 = abjadext.tonality.analyze(staff[:])

Initializes agent on disjunct selection:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.show(staff) 
>>> agent_2 = abjadext.tonality.analyze(staff[:1] + staff[-1:])

Attributes Summary

analyze_chords Analyzes chords in selection.
analyze_incomplete_chords Analyzes incomplete chords.
analyze_incomplete_tonal_functions Analyzes incomplete tonal functions of chords in client according to key_signature.
analyze_neighbor_notes Is true when note in client 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 client is both preceeded and followed by scalewise notes.
analyze_tonal_functions Analyzes tonal function of chords in client according to key_signature.
are_scalar_notes Is true when notes in client are scalar.
are_stepwise_ascending_notes Is true when notes in client are stepwise ascending.
are_stepwise_descending_notes Is true when notes in client are stepwise descending.
are_stepwise_notes Is true when notes in client are stepwise.
client Gets client.

Special methods

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

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

Returns string.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.


Methods

analyze_chords()

Analyzes chords in selection.

>>> chords = [
...     abjad.Chord([0, 4, 7], (1, 4)),
...     abjad.Chord([4, 7, 12], (1, 4)),
...     abjad.Chord([7, 12, 16], (1, 4)),
...     ]
>>> staff = abjad.Staff(chords)
>>> abjad.show(staff) 
>>> for chord in abjadext.tonality.analyze(staff[:]).analyze_chords():
...     chord
... 
CMajorTriadInRootPosition
CMajorTriadInFirstInversion
CMajorTriadInSecondInversion

The three inversions of an a minor triad:

>>> chords = [
...     abjad.Chord([9, 12, 16], (1, 4)),
...     abjad.Chord([12, 16, 21], (1, 4)),
...     abjad.Chord([16, 21, 24], (1, 4)),
...     ]
>>> staff = abjad.Staff(chords)
>>> abjad.show(staff) 
>>> for chord in abjadext.tonality.analyze(staff[:]).analyze_chords():
...     chord
... 
AMinorTriadInRootPosition
AMinorTriadInFirstInversion
AMinorTriadInSecondInversion

The four inversions of a C dominant seventh chord:

>>> chords = [
...     abjad.Chord([0, 4, 7, 10], (1, 4)),
...     abjad.Chord([4, 7, 10, 12], (1, 4)),
...     abjad.Chord([7, 10, 12, 16], (1, 4)),
...     abjad.Chord([10, 12, 16, 19], (1, 4)),
...     ]
>>> staff = abjad.Staff(chords)
>>> abjad.show(staff) 
>>> for chord in abjadext.tonality.analyze(staff[:]).analyze_chords():
...     chord
... 
CDominantSeventhInRootPosition
CDominantSeventhInFirstInversion
CDominantSeventhInSecondInversion
CDominantSeventhInThirdInversion

The five inversions of a C dominant ninth chord:

>>> chords = [
...     abjad.Chord([0, 4, 7, 10, 14], (1, 4)),
...     abjad.Chord([4, 7, 10, 12, 14], (1, 4)),
...     abjad.Chord([7, 10, 12, 14, 16], (1, 4)),
...     abjad.Chord([10, 12, 14, 16, 19], (1, 4)),
...     abjad.Chord([2, 10, 12, 16, 19], (1, 4)),
...     ]
>>> staff = abjad.Staff(chords)
>>> abjad.show(staff) 
>>> for chord in abjadext.tonality.analyze(staff[:]).analyze_chords():
...     chord
... 
CDominantNinthInRootPosition
CDominantNinthInFirstInversion
CDominantNinthInSecondInversion
CDominantNinthInThirdInversion
CDominantNinthInFourthInversion

Returns none when no tonal chord is understood.

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

analyze_incomplete_chords()

Analyzes incomplete chords.

>>> chord = abjad.Chord("<g' b'>4")
>>> abjadext.tonality.analyze(chord).analyze_incomplete_chords()
[GMajorTriadInRootPosition]
>>> chord = abjad.Chord("<g' bf'>4")
>>> abjadext.tonality.analyze(chord).analyze_incomplete_chords()
[GMinorTriadInRootPosition]
>>> chord = abjad.Chord("<f g b>4")
>>> abjadext.tonality.analyze(chord).analyze_incomplete_chords()
[GDominantSeventhInSecondInversion]
>>> chord = abjad.Chord("<fs g b>4")
>>> abjadext.tonality.analyze(chord).analyze_incomplete_chords()
[GMajorSeventhInSecondInversion]

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

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

analyze_incomplete_tonal_functions(key_signature)

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

>>> chord = abjad.Chord("<c' e'>4")
>>> key_signature = abjad.KeySignature('g', 'major')
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_incomplete_tonal_functions(key_signature)
[RomanNumeral('IV')]
>>> chord = abjad.Chord("<g' b'>4")
>>> key_signature = abjad.KeySignature('c', 'major')
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_incomplete_tonal_functions(key_signature)
[RomanNumeral('V')]
>>> chord = abjad.Chord("<g' bf'>4")
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_incomplete_tonal_functions(key_signature)
[RomanNumeral('v')]
>>> key_signature = abjad.KeySignature('c', 'major')
>>> chord = abjad.Chord("<f g b>4")
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_incomplete_tonal_functions(key_signature)
[RomanNumeral('V4/3')]
>>> chord = abjad.Chord("<fs g b>4")
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_incomplete_tonal_functions(key_signature)
[RomanNumeral('VM4/3')]

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

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

analyze_neighbor_notes()

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

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8")
>>> abjad.show(staff) 
>>> agent = abjadext.tonality.analyze(staff[:])
>>> agent.analyze_neighbor_notes()
[False, False, False, False]

Returns list of boolean values.

analyze_passing_tones()

Is true when note in client is both preceeded and followed by scalewise notes.

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8")
>>> abjad.show(staff) 
>>> agent = abjadext.tonality.analyze(staff[:])
>>> agent.analyze_passing_tones()
[False, True, True, False]

Returns list of boolean values.

analyze_tonal_functions(key_signature)

Analyzes tonal function of chords in client according to key_signature.

>>> chord = abjad.Chord('<ef g bf>4')
>>> key_signature = abjad.KeySignature('c', 'major')
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[RomanNumeral('bIII')]
>>> key_signature = abjad.KeySignature('c', 'major')
>>> chord = abjad.Chord('<c e g>4')
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[RomanNumeral('I')]
>>> chord = abjad.Chord(['e', 'g', "c'"], (1, 4))
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[RomanNumeral('I6')]
>>> chord = abjad.Chord(['g', "c'", "e'"], (1, 4))
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[RomanNumeral('I6/4')]
>>> key_signature = abjad.KeySignature('c', 'major')
>>> chord = abjad.Chord(['c', 'ef', 'g'], (1, 4))
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[RomanNumeral('i')]
>>> chord = abjad.Chord(['ef', 'g', "c'"], (1, 4))
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[RomanNumeral('i6')]
>>> chord = abjad.Chord(['g', "c'", "ef'"], (1, 4))
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[RomanNumeral('i6/4')]
>>> key_signature = abjad.KeySignature('c', 'major')
>>> chord = abjad.Chord(['c', 'e', 'g', 'bf'], (1, 4))
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[RomanNumeral('I7')]
>>> chord = abjad.Chord(['e', 'g', 'bf', "c'"], (1, 4))
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[RomanNumeral('I6/5')]
>>> chord = abjad.Chord(['g', 'bf', "c'", "e'"], (1, 4))
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[RomanNumeral('I4/3')]
>>> chord = abjad.Chord(['bf', "c'", "e'", "g'"], (1, 4))
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[RomanNumeral('I4/2')]
>>> key_signature = abjad.KeySignature('c', 'major')
>>> chord = abjad.Chord(['c', 'cs', 'd'], (1, 4))
>>> agent = abjadext.tonality.analyze(chord)
>>> agent.analyze_tonal_functions(key_signature)
[None]

Returns none when no tonal function is understood.

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

are_scalar_notes()

Is true when notes in client are scalar.

>>> staff = abjad.Staff("c'4 cs'")
>>> abjadext.tonality.analyze(staff[:]).are_scalar_notes()
True
>>> staff = abjad.Staff("c'4 d'")
>>> abjadext.tonality.analyze(staff[:]).are_scalar_notes()
True
>>> staff = abjad.Staff("c'4 ds'")
>>> abjadext.tonality.analyze(staff[:]).are_scalar_notes()
True
>>> staff = abjad.Staff("c'4 b")
>>> abjadext.tonality.analyze(staff[:]).are_scalar_notes()
True
>>> staff = abjad.Staff("c'4 c'")
>>> abjadext.tonality.analyze(staff[:]).are_scalar_notes()
False
>>> staff = abjad.Staff("c'4 e'")
>>> abjadext.tonality.analyze(staff[:]).are_scalar_notes()
False

Returns true or false.

are_stepwise_ascending_notes()

Is true when notes in client are stepwise ascending.

>>> staff = abjad.Staff("c'4 cs'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_ascending_notes()
False
>>> staff = abjad.Staff("c'4 d'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_ascending_notes()
True
>>> staff = abjad.Staff("c'4 ds'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_ascending_notes()
True
>>> staff = abjad.Staff("c'4 b")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_ascending_notes()
False
>>> staff = abjad.Staff("c'4 c'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_ascending_notes()
False
>>> staff = abjad.Staff("c'4 e'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_ascending_notes()
False

Returns true or false.

are_stepwise_descending_notes()

Is true when notes in client are stepwise descending.

>>> staff = abjad.Staff("c'4 cs'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_descending_notes()
False
>>> staff = abjad.Staff("c'4 d'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_descending_notes()
False
>>> staff = abjad.Staff("c'4 ds'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_descending_notes()
False
>>> staff = abjad.Staff("c'4 b")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_descending_notes()
True
>>> staff = abjad.Staff("c'4 c'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_descending_notes()
False
>>> staff = abjad.Staff("c'4 e'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_descending_notes()
False

Returns true or false.

are_stepwise_notes()

Is true when notes in client are stepwise.

>>> staff = abjad.Staff("c'4 cs'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_notes()
True
>>> staff = abjad.Staff("c'4 d'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_notes()
True
>>> staff = abjad.Staff("c'4 ds'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_notes()
True
>>> staff = abjad.Staff("c'4 b")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_notes()
True
>>> staff = abjad.Staff("c'4 c'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_notes()
False
>>> staff = abjad.Staff("c'4 e'")
>>> abjadext.tonality.analyze(staff[:]).are_stepwise_notes()
False

Returns true or false.


Read-only properties

client

Gets client.

Returns selection or component.