.. _usersGuide_33_expressions:

.. WARNING: DO NOT EDIT THIS FILE:
   AUTOMATICALLY GENERATED.
   PLEASE EDIT THE .py FILE DIRECTLY.

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 :class:`~music21.base.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``

.. code:: ipython3

    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:

.. code:: ipython3

    cpe = corpus.parse('cpebach/h186')
    cpeExcerpt = cpe.measures(1,2)
    cpeExcerpt.show()



.. image:: usersGuide_33_expressions_3_0.png
   :width: 968px
   :height: 224px


.. code:: ipython3

    for n in cpeExcerpt[note.Note]:
        if n.expressions:
            print(n, n.expressions)


.. parsed-literal::
   :class: ipython-result

    <music21.note.Note C#> [<music21.expressions.Turn>]
    <music21.note.Note B> [<music21.expressions.InvertedMordent>, <music21.expressions.Turn>]
    <music21.note.Note B> [<music21.expressions.Turn>]


.. code:: ipython3

    cs = cpeExcerpt[note.Note].first()
    cs




.. parsed-literal::
   :class: ipython-result

    <music21.note.Note C#>



.. code:: ipython3

    expressions.realizeOrnaments(cs)




.. parsed-literal::
   :class: ipython-result

    [<music21.note.Note D>,
     <music21.note.Note C#>,
     <music21.note.Note B>,
     <music21.note.Note C#>]



