Next: , Up: Special rhythmic concerns


1.2.6.1 Grace notes

Grace notes are ornaments that are written out. Grace notes are printed in a smaller font and take up no logical time in a measure.

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

[image of music]

Lilypond also supports two special types of grace notes, the acciaccatura–an unmeasured grace note indicated by a slurred small note with a slashed stem–and the appoggiatura, which takes a fixed fraction of the main note and appears in small print without a slash.

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

[image of music]

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

     
     << \new Staff { e2 \grace { c16[ d e f] } e2 }
        \new Staff { c2 \grace { g8[ b] } c2 } >>

[image of music]

If you want to end a note with a grace, use the \afterGrace command. It takes two arguments: the main note, and the grace notes following the main note.

     
     c1 \afterGrace d1 { c16[ d] } c1

[image of music]

This will put the grace notes after a space lasting 3/4 of the length of the main note. The default fraction 3/4 can be changed by setting afterGraceFraction. The following example shows the results from setting the space at the default, at 15/16, and finally at 1/2 of the main note.

     
     <<
       \new Staff {
         c1 \afterGrace d1 { c16[ d] } c1
       }
       \new Staff {
         #(define afterGraceFraction (cons 15 16))
         c1 \afterGrace d1 { c16[ d] } c1
       }
       \new Staff {
         #(define afterGraceFraction (cons 1 2))
         c1 \afterGrace d1 { c16[ d] } c1
       }
     >>

[image of music]

The space between the main note and the grace note may also be specified using spacers. The following example places the grace note after a space lasting 7/8 of the main note.

     
     \new Voice {
       << { d1^\trill_( }
          { s2 s4. \grace { c16[ d] } } >>
       c1)
     }

[image of music]

A \grace music expression will introduce special typesetting settings, for example, to produce smaller type, and set directions. Hence, when introducing layout tweaks to override the special settings, they should be placed inside the grace expression. The overrides should also be reverted inside the grace expression. Here, the grace note's default stem direction is overriden and then reverted.

     
     \new Voice {
       \acciaccatura {
         \stemDown
         f16->
         \stemNeutral
       }
       g4 e c2
     }

[image of music]

Selected Snippets

The slash through the stem found in acciaccaturas can be applied in other situations:

     
     \relative c'' {
       \override Stem #'stroke-style = #"grace"
       c8( d2) e8( f4)
     }

[image of music]

The layout of grace expressions can be changed throughout the music using the function add-grace-property. The following example undefines the Stem direction for this grace, so that stems do not always point up.

     
     \relative c'' {
       \new Staff {
         #(add-grace-property 'Voice 'Stem 'direction ly:stem::calc-direction)
         #(remove-grace-property 'Voice 'Stem 'direction)
         \new Voice {
            \acciaccatura { f16 } g4 
            \grace { d16[ e] } f4
            \appoggiatura { a,32[ b c d] } e2
         }
       }
     }

[image of music]

Another option is to change the variables startGraceMusic, stopGraceMusic, startAcciaccaturaMusic, stopAcciaccaturaMusic, startAppoggiaturaMusic, stopAppoggiaturaMusic. The default values of these can be seen in the file ly/grace-init.ly. By redefining them other effects may be obtained.

Grace notes may be forced to align with regular notes in other staves:

     
     \relative c'' {
       <<
         \override Score.SpacingSpanner #'strict-grace-spacing = ##t
         \new Staff {
           c4
           \afterGrace c4 { c16[ c8 c16] }
           c4 r
         }
         \new Staff {
           c16 c c c c c c c c4 r
         }
       >>
     }

[image of music]

See also

Music Glossary: grace notes, acciaccatura, appoggiatura.

Installed Files: ly/grace-init.ly.

Snippets: Rhythms.

Internals Reference: GraceMusic.

Known issues and warnings

A multi-note beamed acciaccatura is printed without a slash, and looks exactly the same as a multi-note beamed appoggiatura.

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 d2. }
        \new Staff { c4 \bar "|:" d2. } >>

[image of music]

This can be remedied by inserting grace skips of the corresponding durations in the other staves. For the above example

     
     << \new Staff { e4 \bar "|:" \grace c16 d2. }
        \new Staff { c4 \bar "|:" \grace s16 d2. } >>

[image of music]

Predefined commands, like \voiceOne, which are intended to change the behaviour of the notation after a grace note, may not be effective if placed immediately before the grace note – they should be placed after it.

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.

This page is for LilyPond-2.11.58 (development-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.

Your suggestions for the documentation are welcome.

Other languages: français, español, deutsch.