Next: , Previous: Relative note names, Up: Single staff notation


2.2.2 Accidentals and key signatures

Accidentals

A sharp pitch is made by adding `is' to the name, and a flat pitch by adding `es'. As you might expect, a double sharp or double flat is made by adding `isis' or `eses'1

     
     cis1 ees fisis, aeses

[image of music]

Key signatures

The key signature is set with the command \key followed by a pitch and \major or \minor.

     
     \key d \major
     a1
     \key c \minor
     a

[image of music]


Warning: key signatures and pitches

To determine whether to print an accidental, LilyPond examines the pitches and the key signature. The key signature only effects the printed accidentals, not the actual pitches! 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 printed 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

     
     \key d \major
     d cis fis

[image of music]

No note has a printed accidental, but you must still add the `is' to cis and fis.

The code `e' does not mean “print a black dot just below the first line of the staff.” Rather, it means: “there is a note with pitch E-natural.” In the key of A-flat major, it does get an accidental:

     
     \key aes \major
     e

[image of music]

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.

More information

Accidentals
see Accidentals and Automatic accidentals.
Key signature
see Key signature.

Footnotes

[1] This syntax derived from note naming conventions in Nordic and Germanic languages, like German and Dutch. To use other names for accidentals, see Note names in other languages.


Next: , Previous: Relative note names, Up: Single staff notation

This page is for LilyPond-2.10.33 (stable-branch).

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

Other languages: French.