### 2.3 More about pitches

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 eses:1

         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 together 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 a 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 gets an explicit accidental, but still you 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, 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 music can be printed according to different conventions. See Accidentals for some examples how accidentals can be printed according to different rules.

For more information on

Accidentals
  see Accidentals
Key signature
  see Key signature

#### Footnotes

[1] This syntax derived from note naming conventions in Nordic and Germanic languages, like German and Dutch.

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