from music21 import *
import copy
it = ['M-3','P1','A4']
p = pitch.Pitch('F4')
cList = []
for int in it:
    pNew = p.transpose(int, inPlace=False)
    cList.append(pNew)
cList
 [<music21.pitch.Pitch D-4>, <music21.pitch.Pitch F4>, <music21.pitch.Pitch B4>]
chord1 = chord.Chord(cList)
chord1.show()
../_images/usersGuide_98_inversionDemo_7_0.png
chord1.inversion(0)
chord1.show()
../_images/usersGuide_98_inversionDemo_9_0.png
max(chord1.pitches)
 <music21.pitch.Pitch F5>
cMaj = chord.Chord("C3 E3 G3")
s = stream.Stream()
for i in range(20):
    inv = i % 3
    s.append(cMaj)
    cMajCopy = copy.deepcopy(cMaj)
    cMajCopy.inversion(inv)
    cMaj = cMajCopy
s.show('text')
 {0.0} <music21.chord.Chord C3 E3 G3>
 {1.0} <music21.chord.Chord C3 E3 G3>
 {2.0} <music21.chord.Chord E3 G3 C4>
 {3.0} <music21.chord.Chord G3 C4 E4>
 {4.0} <music21.chord.Chord C4 E4 G4>
 {5.0} <music21.chord.Chord E4 G4 C5>
 {6.0} <music21.chord.Chord G4 C5 E5>
 {7.0} <music21.chord.Chord C5 E5 G5>
 {8.0} <music21.chord.Chord E5 G5 C6>
 {9.0} <music21.chord.Chord G5 C6 E6>
 {10.0} <music21.chord.Chord C6 E6 G6>
 {11.0} <music21.chord.Chord E6 G6 C7>
 {12.0} <music21.chord.Chord G6 C7 E7>
 {13.0} <music21.chord.Chord C7 E7 G7>
 {14.0} <music21.chord.Chord E7 G7 C8>
 {15.0} <music21.chord.Chord G7 C8 E8>
 {16.0} <music21.chord.Chord C8 E8 G8>
 {17.0} <music21.chord.Chord E8 G8 C9>
 {18.0} <music21.chord.Chord G8 C9 E9>
 {19.0} <music21.chord.Chord C9 E9 G9>
s.show()
../_images/usersGuide_98_inversionDemo_13_0.png
cMaj = chord.Chord("C1 G1 E2")
s = stream.Stream()
for i in range(12):
    inv = i % 3
    s.append(cMaj)
    cMajCopy = copy.deepcopy(cMaj)
    cMajCopy.inversion(inv)
    cMaj = cMajCopy
s.show()
../_images/usersGuide_98_inversionDemo_15_0.png
cMaj = chord.Chord("C3 E3 G3 B-3 D-4 F#4")
s = stream.Stream()
for i in range(18):
    inv = i % 6
    s.append(cMaj)
    cMajCopy = copy.deepcopy(cMaj)
    cMajCopy.inversion(inv)
    cMaj = cMajCopy
s.show()
../_images/usersGuide_98_inversionDemo_17_0.png
s.show('midi')
Germ6 = chord.Chord("A-3 C4 E-4 F#4")
s = stream.Stream()
print Germ6.inversion()
for i in range(12):
    inv = i % 3
    s.append(Germ6)
    cMajCopy = copy.deepcopy(Germ6)
    cMajCopy.inversion(inv)
    Germ6 = cMajCopy
 1
s.show()
../_images/usersGuide_98_inversionDemo_20_0.png

All subchords.

from itertools import combinations as comb
c = chord.Chord([0, 1, 2, 4, 7, 8])
c.commonName
 'all tri-chord hexachord'
cc = set()
for i in comb(c.pitches, 3):
    cc.add(chord.Chord(i).forteClassNumber)
cc
 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}