Product SiteDocumentation Site

12.4. LilyPond Basics

The syntax of LilyPond files offers the most flexibility through the most diverse musical conditions. Over time, you will realize that features which seem too complex at first are really a very powerful and simple way to solve complex problems that commercial programs cannot.

12.4.1. Letters Are Pitches

One letter is all that's required to create a note in LilyPond. There are additional symbols and letters that are added to indicate further details, like the register, and whether the note is "sharp" or "flat."
Although it can be changed, the default (and recommended) way to indicate "sharp" or "flat" is by using Dutch note-names: "-is" to indicate a sharp, and "-es" to indicate a flat. For example, the following command would create b-double-flat, b-flat, b, b-sharp, and b-double-sharp: beses bes b bis bisis Getting used to these names happens quickly, and they take less time to input than the English alternative. Furthermore, with these names, it becomes possible to sing note-names when you are ear training!
Pitch can be entered either absolutely, or relative to the preceding notes. Usually (for music without frequent large leaps) it is more convenient to use the "relative" mode. The symbols , and ' (comma and apostrophe) are used to indicate register.
When entering absolute pitches, the register is indicated mostly as in the Helmholtz system (see Helmholtz Pitch Notation (Wikipedia) at octaves begin on the pitch "C," and end eleven tones higher on the pitch "B." The octave below "middle C" (octave 3 in scientific pitch notation - see Scientific Pitch Notation (Wikipedia) at Scientific Pitch Notation) has no commas or apostrophes. The octave starting on "middle C" (octave 4) has one apostrophe; the octave above that (octave 5) has two apostrophes, and so on. Octave 2 (starting two octaves below "middle C") has one comma, the octave below that has two commas, and so on. It is usually not necessary to understand how to use this in LilyPond, or to be able to use it quickly, because most scores will use "relative mode."
When entering pitches relative to the previous one, the register is still indicated with commas or apostrophes, but usually none are needed. When using this input mode, the octave of each note is guessed based on the octave of the previous note. Think of it this way: the next note will always be placed so it produces the smaller interval. For example, after a C, an E could be placed as a major third, a minor sixth, a major tenth, a minor thirteenth, and so on. In relative mode, LilyPond will always choose the "major third" option. If you wanted LilyPond to notate the E so that it's a minor sixth, you would tell LilyPond with a comma appended: c e, so that LilyPond knows what you want. It's the same case if you were to input c aes (meaning "C then A-flat"): the A-flat will be notated so that it is a major third from the C; if you wanted LilyPond to notate it so that the A-flat is a minor sixth higher than the C, you would need to append an apostrophe: c aes'
The only possible ambiguity with this method is with a tritone. LilyPond solves this by not recognizing "tritones," per se, and thinking of them as "augmented fourth" or "diminished fifth." Unless instructed otherwise (with a comma or apostrophe), LilyPond will always notate the interval as an augmented fourth.
You must always indicate a sharp or flat, even if it is already in a key signature. This ultimately helps to reduce the number of errors.
Letters used to indicate pitch are always in lower-case.