#### 3.7.10 Grace notes

Grace notes are ornaments that are written out. The most common ones are acciaccatura, which should be played as very short. It is denoted by a slurred small note with a slashed stem. The appoggiatura is a grace note that takes a fixed fraction of the main note, is and denoted as a slurred note in small print without a slash. They are entered with the commands `\acciaccatura` and `\appoggiatura`, as demonstrated in the following example

>          b4 \acciaccatura d8 c4 \appoggiatura e8 d4
>          \acciaccatura { g16[ f] } e4

Both are special forms of the `\grace` command. By prefixing this keyword to a music expression, a new one is formed, which will be printed in a smaller font and takes up no logical time in a measure.

>          c4 \grace c16 c4
>          \grace { c16[ d16] } c2 c4

Unlike `\acciaccatura` and `\appoggiatura`, the `\grace` command does not start a slur.

Internally, timing for grace notes is done using a second, `grace' time. Every point in time consists of two rational numbers: one denotes the logical time, one denotes the grace timing. The above example is shown here with timing tuples

The placement of grace notes is synchronized between different staves. In the following example, there are two sixteenth graces notes for every eighth grace note

>          << \new Staff { e4 \grace { c16[ d e f] } e4 }
>             \new Staff { c'4 \grace { g8[ b] } c4 } >>

If you want to end a note with a grace, the standard trick is to put the grace notes after a “space note”

>          \context Voice {
>            << { d1^\trill ( }
>               { s2 \grace { c16[ d] } } >>
>            c4)
>          }

By adjusting the duration of the skip note (here it is a half-note), the space between the main-note and the grace is adjusted.

A `\grace` section will introduce special typesetting settings, for example, to produce smaller type, and set directions. Hence, when introducing layout tweaks, they should be inside the grace section, for example,

>          \new Voice {
>            \acciaccatura {
>              \override Stem #'direction = #-1
>              f16->
>              \revert Stem #'direction
>            }
>            g4
>          }

The overrides should also be reverted inside the grace section.

If the layout of grace sections must be changed throughout the music, then this can be accomplished through the function `add-grace-property`. The following example undefines the Stem direction for this grace, so stems do not always point up.

         \new Staff {
            #(add-grace-property "Voice" Stem direction '())
            ...
         }

Another option is to change the variables `startGraceMusic`, `stopGraceMusic`, `startAccacciaturaMusic`, `stopAccacciaturaMusic`, `startAppoggiaturaMusic`, `stopAppoggiaturaMusic`. More information is in the file ly/grace-init.ly.

##### See also

Program reference: GraceMusic.

##### Bugs

A score that starts with an `\grace` section needs an explicit `\context Voice` declaration, otherwise the main note and grace note end up on different staves.

Grace note synchronization can also lead to surprises. Staff notation, such as key signatures, bar lines, etc. are also synchronized. Take care when you mix staves with grace notes and staves without, for example,

>          << \new Staff { e4 \bar "|:" \grace c16 d4 }
>             \new Staff { c4  \bar "|:"  d4 } >>

This can be remedied by inserting grace skips, for the above example

         \new Staff { c4  \bar "|:"  \grace s16 d4 } >>

Grace sections should only be used within sequential music expressions. Nesting or juxtaposing grace sections is not supported, and might produce crashes or other errors.

Read comments on this page, or add one. This page is for LilyPond-2.2.2 (stable-branch).