music21.chord.tables

This module stores numerous data lists used in deriving set-class values and other post-tonal chord representations. All features of this module are made available through Chord objects. Use of this module directly is thus not necessary.

ChordTableAddress

class music21.chord.tables.ChordTableAddress(cardinality, forteClass, inversion, pcOriginal)

ChordTableAddress read-only properties

ChordTableAddress.cardinality

Alias for field number 0

ChordTableAddress.forteClass

Alias for field number 1

ChordTableAddress.inversion

Alias for field number 2

ChordTableAddress.pcOriginal

Alias for field number 3

Functions

music21.chord.tables.addressToForteName(address, classification='tn')

Given an address, return the set-class name as a string.

>>> address = chord.tables.ChordTableAddress(8, 15, 1, 10)
>>> chord.tables.addressToForteName(address)
'8-15A'
>>> chord.tables.addressToForteName((8,15))
'8-15A'
>>> chord.tables.addressToForteName((8,15), 'tni')
'8-15'
>>> chord.tables.addressToForteName((5,37))
'5-37'
music21.chord.tables.addressToPrimeForm(address)

Given a TN address, return the normal form

>>> chord.tables.addressToPrimeForm((3,1,0))
(0, 1, 2)
>>> chord.tables.addressToPrimeForm((3,11,-1))
(0, 3, 7)
>>> chord.tables.addressToPrimeForm((3,11,1))
(0, 3, 7)
>>> chord.tables.addressToPrimeForm((3,11))
(0, 3, 7)
>>> chord.tables.addressToPrimeForm((3,11,None))
(0, 3, 7)
music21.chord.tables.seekChordTablesAddress(c)

Utility method to return the address to the chord table.

Table addresses are TN based three character codes: cardinality, Forte index number, inversion

Inversion is either 0 (for symmetrical) or -1/1

NOTE: time consuming, and only should be run when necessary.

>>> c1 = chord.Chord(['c3'])
>>> chord.tables.seekChordTablesAddress(c1)
ChordTableAddress(cardinality=1, forteClass=1, inversion=0, pcOriginal=0)
>>> c1 = chord.Chord(
...     ['c', 'c#', 'd', 'd#', 'e', 'f', 'f#', 'g', 'g#', 'a', 'b']
...     )
>>> chord.tables.seekChordTablesAddress(c1)
ChordTableAddress(cardinality=11, forteClass=1, inversion=0, pcOriginal=11)
>>> c1 = chord.Chord(['g', 'b', 'd'])
>>> chord.tables.seekChordTablesAddress(c1)
ChordTableAddress(cardinality=3, forteClass=11, inversion=-1, pcOriginal=7)
>>> c1 = chord.Chord(['c', 'e-', 'g'])
>>> chord.tables.seekChordTablesAddress(c1)
ChordTableAddress(cardinality=3, forteClass=11, inversion=1, pcOriginal=0)
>>> c1 = chord.Chord(['c', 'c#', 'd#', 'e', 'f#', 'g#', 'a#'])
>>> chord.tables.seekChordTablesAddress(c1)
ChordTableAddress(cardinality=7, forteClass=34, inversion=0, pcOriginal=0)
>>> c1 = chord.Chord(['c', 'c#', 'b'])
>>> chord.tables.seekChordTablesAddress(c1)
ChordTableAddress(cardinality=3, forteClass=1, inversion=0, pcOriginal=11)

Zero-length chords raise a pitch exception:

>>> c2 = chord.Chord()
>>> chord.tables.seekChordTablesAddress(c2)
Traceback (most recent call last):
music21.chord.tables.ChordTablesException: cannot access chord tables address
    for Chord with 0 pitches
music21.chord.tables.addressToCommonNames(address)

Given a TN address, return one or more common names if available

>>> chord.tables.addressToCommonNames((3,1,0))
['chromatic trimirror']
>>> address = chord.tables.ChordTableAddress(3, 11, -1, 2)
>>> chord.tables.addressToCommonNames(address)
['major triad']
music21.chord.tables.addressToIntervalVector(address)

Given a TN address, return the normal form

>>> chord.tables.addressToIntervalVector((3,1,0))
(2, 1, 0, 0, 0, 0)
>>> chord.tables.addressToIntervalVector((3,11,-1))
(0, 0, 1, 1, 1, 0)
>>> chord.tables.addressToIntervalVector((3,11,1))
(0, 0, 1, 1, 1, 0)
>>> chord.tables.addressToIntervalVector((3,11))
(0, 0, 1, 1, 1, 0)
>>> chord.tables.addressToIntervalVector((3,11,None))
(0, 0, 1, 1, 1, 0)
music21.chord.tables.addressToTransposedNormalForm(address)

Given a TN address, return the normal form transposed to start on 0.

>>> chord.tables.addressToTransposedNormalForm((3, 1, 0))
(0, 1, 2)
>>> chord.tables.addressToTransposedNormalForm((3, 11, -1))
(0, 4, 7)
>>> chord.tables.addressToTransposedNormalForm((3, 11, 1))
(0, 3, 7)
>>> chord.tables.addressToTransposedNormalForm((3, 11))
(0, 3, 7)
>>> chord.tables.addressToTransposedNormalForm((3, 11, None))
(0, 3, 7)
music21.chord.tables.addressToZAddress(address)

Given a TN address, return the address of the z set, if not None

>>> chord.tables.addressToZAddress((5,12))
ChordTableAddress(cardinality=5, forteClass=36, inversion=1, pcOriginal=None)
>>> chord.tables.addressToZAddress((5,36,None))
ChordTableAddress(cardinality=5, forteClass=12, inversion=0, pcOriginal=None)
>>> chord.tables.addressToZAddress((5,37))
ChordTableAddress(cardinality=5, forteClass=17, inversion=0, pcOriginal=None)
>>> chord.tables.addressToZAddress((8,29))
ChordTableAddress(cardinality=8, forteClass=15, inversion=1, pcOriginal=None)
music21.chord.tables.forteIndexToInversionsAvailable(card, index)

Return possible inversion values for any cardinality and index

>>> chord.tables.forteIndexToInversionsAvailable(3,1)
[0]
>>> chord.tables.forteIndexToInversionsAvailable(3,2)
[-1, 1]
>>> chord.tables.forteIndexToInversionsAvailable(3,3)
[-1, 1]
>>> chord.tables.forteIndexToInversionsAvailable(3,6)
[0]
music21.chord.tables.intervalVectorToAddress(vector)

Given a vector, collect all addresses that match.

>>> chord.tables.intervalVectorToAddress((7,6,5,4,4,2))
[ChordTableAddress(cardinality=8, forteClass=1, inversion=None, pcOriginal=None)]
>>> chord.tables.intervalVectorToAddress((12,12,12,12,12,6))
[ChordTableAddress(cardinality=12, forteClass=1, inversion=None, pcOriginal=None)]
>>> chord.tables.intervalVectorToAddress((2,2,3,1,1,1))
[ChordTableAddress(cardinality=5, forteClass=10, inversion=None, pcOriginal=None)]
>>> chord.tables.intervalVectorToAddress((1,1,1,1,1,1))
[ChordTableAddress(cardinality=4, forteClass=15, inversion=None, pcOriginal=None),
 ChordTableAddress(cardinality=4, forteClass=29, inversion=None, pcOriginal=None)]