Note and Chord objects, as both subclasses of the GeneralNote object, share many features. Both contain a Duration object. A Note has only one Pitch; a Chord, however, contains a list one or more Pitch objects accessed via the pitches property. The Chord object additional has numerous analytic methods (such as isDiminishedSeventh()) as well as a variety of post-tonal tools (such as forteClass; see Overview: Post-Tonal Tools).
A Chord can be created with a list of Pitch objects or strings identical to those used for creating Pitches. Additional, pitch class integers can be provided.
>>> from music21 import * >>> c1 = chord.Chord(['a#3', 'g4', 'f#5']) >>> c1.pitches [<music21.pitch.Pitch A#3>, <music21.pitch.Pitch G4>, <music21.pitch.Pitch F#5>]
Like with a Note, Duration object properties can be configured from properties on Chord. For example, the Quarter Length of the Chord can be accessed from the quarterLength property. (Note that, to get expected results in Python 2.x, one of the values in division must be a floating point value.) The show() method can be used to display the results.
>>> c1.quarterLength = 1 + 1/3.0 >>> c1.show()
>>> c2 = c1.transpose('m2') >>> c2.show()
Finally, a Chord, like a Note, can have one or more lyrics. The addLyric() method functions the same as it does for Note. In the following example, a text annotation of the Forte set class name is added to the Chord.
>>> c2.addLyric(c2.forteClass) >>> c2.show()