User’s Guide, Chapter 33: Expressions and Ornaments¶
(This Chapter is still a work in progress)
The previous chapter covered articulations, which music21 defines to
mean an expressive mark that applies to a single note, chord, or object.
There are two related types of objects which might apply to one or to
many notes or other Music21Object instances.
These are called in music21, Expressions and their sub-category,
Ornaments.
Let’s see what an expression does by playing around with some. We’ll
load music21
from music21 import *
Ornaments¶
To understand how ornaments work, let’s turn to a keyboard piece by C.P.E. Bach and examine the opening two measures:
cpe = corpus.parse('cpebach/h186')
cpeExcerpt = cpe.measures(1,2)
cpeExcerpt.show()
for n in cpeExcerpt[note.Note]:
if n.expressions:
print(n, n.expressions)
<music21.note.Note C#> [<music21.expressions.Turn>]
<music21.note.Note B> [<music21.expressions.InvertedMordent>, <music21.expressions.Turn>]
<music21.note.Note B> [<music21.expressions.Turn>]
cs = cpeExcerpt[note.Note].first()
cs
<music21.note.Note C#>
expressions.realizeOrnaments(cs)
[<music21.note.Note D>,
<music21.note.Note C#>,
<music21.note.Note B>,
<music21.note.Note C#>]