A sharp (#) pitch is made by adding is to the name, a flat (b) pitch by adding es. As you might expect, a double sharp or double flat is made by adding isis or eses1
cis1 ees fisis aeses
The key signature is set with the command \key
, followed by
a pitch and \major
or \minor
\key d \major g1 \key c \minor g
Key signatures together with the pitches (including alterations) are used to determine when to print accidentals. This is a feature that often causes confusion to newcomers, so let us explain it in more detail.
LilyPond makes a sharp distinction between musical content and layout. The alteration (flat, natural or sharp) of a note is part of the pitch, and is therefore musical content. Whether an accidental (a flat, natural or sharp sign) is printed in front of the corresponding note is a question of layout. Layout is something that follows rules, so accidentals are printed automatically according to those rules. The pitches in your music are works of art, so they will not be added automatically, and you must enter what you want to hear.
In this example
no note has an explicit accidental, but you still must enter
\key d \major d cis fis
The code d does not mean `print a black dot just below the staff.' Rather, it means: `a note with pitch D-natural.' In the key of A-flat major, it does get an accidental
\key as \major d
Adding all alterations explicitly might require a little more effort when typing, but the advantage is that transposing is easier, and accidentals can be printed according to different conventions. See Automatic accidentals, for some examples how accidentals can be printed according to different rules.
For more information on
- Accidentals
- see Automatic accidentals.
- Key signature
- see Key signature.
[1] This syntax derived from note naming conventions in Nordic and Germanic languages, like German and Dutch.
This page is for LilyPond-2.6.3 (stable-branch).