[icon]

GNU LilyPond

-- --

What is LilyPond
Home
Examples
Templates
Download
GNU/Linux binaries
Windows binaries
Source code
Documentation
Tutorial
Manual
Glossary
Index

Support
Mailing lists
Search
WikiWiki

External sites
lilypond.org/stable
lilypond.org/development
savannah.gnu.org
ftp.lilypond.org
Mutopia
Other music online

Node:Grace notes, Next:, Previous:Text scripts, Up:Ornaments



Grace notes

Grace notes are ornaments that are written out

     c4 \grace c16 c4 \grace {
     [c16 d16] } c4
     
[picture of music]

In normal notation, grace notes are supposed to take up no logical time in a measure. Such an idea is practical for normal notation, but is not strict enough to put it into a program. The model that LilyPond uses for grace notes internally is that all timing is done in two steps:

Every point in musical 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.

[picture of music]

The advantage of this approach is that you can use almost any lilypond construction together with grace notes, for example slurs and clef changes may appear halfway in between grace notes:

     
       c4  \grace { [ c16 c, \clef bass c, b(] }  )c4
     
[picture of music]

The placement of these grace notes is synchronized between different staves, using this grace timing.

     
     < \context Staff = SA { e4 \grace { c16 d e f } e4 }
       \context Staff = SB { c4 \grace { g8 b } c4 } >
     
[picture of music]

Unbeamed eighth notes and shorter by default have a slash through the stem. This can be controlled with object property stroke-style of Stem . The change in formatting is accomplished by inserting \startGraceMusic before handling the grace notes, and \stopGraceMusic after finishing the grace notes. You can add to these definitions to globally change grace note formatting. The standard definitions are in ly/grace-init.ly.

[TODO discuss Scheme functionality.]

Notice how the \override is carefully matched with a \revert.

     \relative c'' \context Voice {
       \grace c8 c4 \grace { [c16 c16] } c4
       \grace {
         \property Voice.Stem \override #'stroke-style = #'()
         c16
         \property Voice.Stem \revert #'stroke-style
       } c4
     }
     
[picture of music]

If you want to end a note with a grace note, then the standard trick is to put the grace notes before a phantom "space note", e.g.

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

A \grace section has some default values, and LilyPond will use those default values unless you specify otherwise inside the \grace section. For example, if you specify \slurUp before your \grace section, a slur which starts inside the \grace won't be forced up, even if the slur ends outside of the \grace. Note the difference between the first and second bars in this example:

     \relative c'' \context Voice {
         \slurUp
         \grace {
             a4 ( }
         ) a4 a4 () a2
         \slurBoth
     
         \grace {
             \slurUp
             a4 ( }
         ) a4 a4 () a2
         \slurBoth
     
     }
     
[picture of music]

BUGS

Grace notes can not be used in the smallest size (paper11.ly).

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

     < \context Staff = SA { e4 \bar "|:" \grace c16 d4 }
       \context Staff = SB { c4 \bar "|:"  d4 } >
     
[picture of music]

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

Go back to index of LilyPond.

Please send GNU LilyPond questions and comments to lilypond-user@gnu.org.

Please send comments on these web pages to (address unknown)

Copyright (c) 1997--2002 Han-Wen Nienhuys and Jan Nieuwenhuizen.

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


This page was built from LilyPond-1.7.14 (development-branch) by

Buchan Milne <(address unknown)>, Thu Mar 6 21:11:35 2003 CET.