Help:LilyPond
Commands
[edit]These commands alter the way LilyPond and the Score extension render notation. For commands that just insert musical symbols, see Help:List of musical symbols.
Command | Effect |
---|---|
\autoBeamOff |
Turns off the automatic beaming, all notes will be rendered individually unless manually beamed. |
\autoBeamOn |
Turns the automatic beaming back on. |
\cadenzaOn |
Turns on the cadenza mode where bar lines are not automatically placed (also has the effect of turning off automatic beaming) |
\cadenzaOff |
Leave cadenza mode and resume normal bar lines (and turn automatic beaming back on) |
\override Score.TimeSignature #'stencil = ##f |
Turns off display of the time signature on all staves |
\override Staff.TimeSignature #'stencil = ##f |
Turns off display of the time signature on a particular staff |
\override Score.Clef #'stencil = ##f |
Turns off display of clefs on all staves |
\override Staff.Clef #'stencil = ##f |
Turns off display of clefs on a particular staff |
\override Score.Rest #'style = #'classical |
Crotchet (quarter-note) rests are displayed as a reversed quaver rest |
\override Score.BarNumber #'break-visibility = #'#(#f #f #f) |
Turns off display of bar numbers at line breaks |
\override TupletBracket #'bracket-visibility = ##f |
Turns off display of tuplet brackets |
\override TupletNumber #'stencil = ##f |
Turns off display of tuplet numbers |
\set Timing.defaultBarType = bartype |
Change the default bar line. The list of possible bartype is here |
\tweak #'font-size #-2 |
Make one note in a chord smaller than the others |
Notes
[edit]Relative notes
[edit]The relative
command can be used to indicate that pitches should always be relative to the last pitch entered. This is the easiest method of entering pitches. A pitch will be assumed to be the closest note of that pitch to the previous note in the staff. This can be raised an octave by entering an apostrophe after the note (but before the duration or any other modifier); two apostrophes will raise the pitch by two octaves, etc. The opposite, lowering the pitch by an octave, can be done by entering a comma after the note; again, two commas will lower the pitch by two octaves, etc.
Absolute notes
[edit]If the relative
command is not used, pitches will be absolute and each must be set manually. As with relative notes, commas and apostrophes following the pitch name will decrease or increase the octave. All notes are relative to bass c.
So, c
will always be bass c, c'
will always be middle c, c''
will always be treble c and so forth.
Accidentals
[edit]To add an accidental to a note, just add is for sharp or es for flat.
Name | Code | Result |
---|---|---|
sharp | ais |
|
flat | aes |
|
double sharp | aisis |
|
double flat | aeses |
Polyphony
[edit]Sometimes there are two sets of notes on the same bar. This can be represented using the following format:
<< { ... } \\ { ... } >>
For example:
Bar | Result |
---|---|
g g g g |
|
f f f f |
|
<< { g g g g } \\ { f' f f f } >> |
- Notes
- When transcribing, the different sets of notes can sometime be distinguished by the direction of the stems (up or down).
- Both sets of notes should have the same overall duration.
- Lyrics will skip these bars if
addLyrics
is used. To align lyrics to the notes in these bars, they need to be aligned manually.
Repetition
[edit]To repeat the previous chord, without writing the whole thing out again, you can use the letter q
. There can be single notes in between two uses of the chord.
<score>\relative c'' { <a c e> q q q }</score>
Only the pitches will be copied. Articulations and other mark-ups will not be repeated but can be applied again as normal (or changed to a different mark-up). Durations will match the previous note as normal, but these can be changed as well.
<score>\relative c'' { <a c e>-^ q q2 q4-> q8 q q4 }</score>
Multiple staves
[edit]Each staff, or stave, is represented by a new block within the score tags. These blocks are grouped by the bookending them with double angle brackets. For example:
<score>
\relative c'' {
<<
\new Staff {
...
}
\new Staff {
...
}
>>
}
</score>
Example:
<score>
\relative c'' {
<<
\new Staff {
a b c d
}
\new Staff {
d c b a
}
>>
}
</score>
- Notes
- If using relative notes, the first note on the second staff will be relative to the last note on the first staff, and so forth.
- It is recommended that the entire first staff be completed before moving on the start the second staff, before moving on to the third, etc; otherwise the subsequent note positions will keep changing.
Staff group
[edit]A staff group (or ensemble staff) connects multiple staves with a bracket and the bar lines continue across all staves. This creates a "system" to group different instruments that should be played simultaneously.
<score>
\relative c'' {
\new StaffGroup <<
\new Staff {
a b c d a b c d
}
\new Staff {
d c b a d c b a
}
>>
}
</score>
Grand staff
[edit]A grand staff (or great stave) groups mutliple staves that should be played on the same instrument. This displays a brace instead of a bracket.
<score>
\relative c'' {
\new GrandStaff <<
\new Staff {
...
}
\new Staff {
\clef "bass"
...
}
>>
}
</score>
The bass clef shown here in the second staff needs to be added manually. It is common but can be left out if required.
Example:
<score>
\relative c'' {
\new PianoStaff <<
\new Staff {
b4 b b b
}
\new Staff {
\clef "bass"
f, f f f
}
>>
}
</score>
There is also a Piano Staff object in LilyPond that is mostly identical to the Grand Staff.
<score>
\relative c'' {
\new PianoStaff <<
\new Staff {
...
}
\new Staff {
\clef "bass"
...
}
>>
}
</score>
Nested staves
[edit]Groups of staves can be nested for more complicated arrangements.
<score>
\relative c'' {
<<
\new Staff {
...
\new PianoStaff <<
\new Staff {
...
}
\new Staff {
\clef "bass"
...
}
>>
>>
}
</score>
Example:
<score>
\relative c'' {
<<
\new Staff {
b b b b
}
\new PianoStaff <<
\new Staff {
a b c d
}
\new Staff {
\clef "bass"
a, g f e
}
>>
>>
}
</score>
Lyrics
[edit]There are several different ways of adding lyrics to a score.
Manual durations
[edit]Lyrics can have set durations just like notes. Normally LilyPond assigns lyrics to notes automatically, but this sometimes differ from the original printed lyrics. For example, slurred notes have only one lyric attached to the whole slur and polyphonic sections are skipped entirely for the purposes of lyrics. Manually assigning durations helps to avoid this, as the lyrics are separate from the notes.
To do this, the lyrics block must be created in \lyricmode
instead of using \addlyrics
, as follows:
\new Lyrics \lyricmode {
...
}
The two (or more) blocks are separate and need to be joined together manually. The \addlyrics
command already contains the code to do so. To connect them manually, the blocks must be bookended with double angle-brackets, like so:
<score>
<<
\relative c {
...
}
\new Lyrics \lyricmode {
...
}
>>
</score>
Each lyric (or piece of lyric) needs to be given a duration just like a note, by a number immediately after the lyric itself. There should be no space between the lyric and the duration. If no duration is assigned to a lyric, the last used duration will be used, just as it would with a note. For example:
<score>
<<
\relative c'' {
a4 b c d
}
\new Lyrics \lyricmode {
foo2 bar4 baz
}
>>
</score>
This can add more lyrics to a bar than there are notes:
<score>
<<
\relative c'' {
a4 b c d
}
\new Lyrics \lyricmode {
x8 x x x x x x x
}
>>
</score>
Hyphenated lyrics will work with this method but extender will not be generated. The only way to generate extender lines would be to declare an associated voice with the \set associatedVoice
command.
Associated voice
[edit]Lyrics with manual duration will be left-aligned to the position of the appropriate note in the score. Extender lines also cannot be generated as the lyrics are not associated with any note and the the length of the line cannot be determined. To overcome that, the \set associatedVoice
command can be used to associate, or link, the lyrics with a melody in another block.
The block containing the melody (musical notation) must be created as \new voice="foo"
. The block containing the lyrics must also contain the command \set associatedVoice = #"foo"
. For example:
<score>
\relative c {
<<
\new voice="foo" {
...
}
\new Lyrics \lyricmode {
\set associatedVoice = #"foo"
...
}
>>
}
</score>
This will make the lyrics centre-aligned on the note positions and allow the system to generate extender lines.
Additional notes
[edit]- Stanzas can be numbered by the
\set
command at the beginning of the lyrics block. Eg:
\set stanza = #"1. "
- The appearance of the lyrics can be altered with the
\override
command:
Effect | Code | Notes |
---|---|---|
Italics | \override LyricText #'font-shape = #'italic |
Effects the entire lyric block. |
Font size | \override LyricText #'font-size = #-1 |
This reduces the font size by one level; the final number can be altered for other font sizes. |
Lyric spacing | \override LyricSpace #'minimum-distance = #0.6 |
The final number can be altered to control the spacing. |
Partial measures
[edit]The \partial
command can be used to create partial measures. The command should be followed by a duration, which should be the length before the start of the next measure.
<score>
\relative c'' {
\time 3/4
\partial 8
b8
g4 b8 a b4
}
</score>
Key signatures
[edit]The key signature is a set of sharp or flat symbols on a staff, often near the clef. To identify the key signature of a piece of music, so it can be replicated in LilyPond, the "circle of fifths" diagram can be useful or use the following table.
If there is no set of either sharps or flats, then the key is either C major or A minor and no code needs to be entered (unless dealing with transposing instruments). Each key signature has two relative keys, a major key and a minor key.
The key signature can be entered with the \key
command followed by the key and either \major
or \minor
as appropriate. For example, the B minor key signature:
\key b \minor
n | Key signature | Major key | Major key code | Minor key | Minor key code | Key signature | Major key | Major key code | Minor key | Minor key code |
---|---|---|---|---|---|---|---|---|---|---|
0 | C major | \key c \major
|
A minor | \key a \minor
| ||||||
1 | G major | \key g \major
|
E minor | \key e \minor
|
F major | \key f \major
|
D minor | \key d \minor
| ||
2 | D major | \key d \major
|
B minor | \key b \minor
|
B♭ major | \key bes \major
|
G minor | \key g \minor
| ||
3 | A major | \key a \major
|
F♯ minor | \key fis \minor
|
E♭ major | \key ees \major
|
C minor | \key c \minor
| ||
4 | E major | \key e \major
|
C♯ minor | \key cis \minor
|
A♭ major | \key aes \major
|
F minor | \key f \minor
| ||
5 | B major | \key b \major
|
G♯ minor | \key gis \minor
|
D♭ major | \key des \major
|
B♭ minor | \key bes \minor
| ||
6 | F♯ major | \key fis \major
|
D♯ minor | \key dis \minor
|
G♭ major | \key ges \major
|
E♭ minor | \key ees \minor
| ||
7 | C♯ major | \key cis \major
|
A♯ minor | \key ais \minor
|
C♭ major | \key ces \major
|
A♭ minor | \key aes \minor
|
Repeats
[edit]Gregorian chant
[edit]If required, it is possible to transcribe Gregorian chant in both traditional 4-line neumatic notation and in more modern variants. The exact syntax for traditional notation is described at the relevant documentation page.[1] The layout of the notes depends on the text. In cases where one word stretches over more than one note, it must be written as Pre- fix
instead of the usual Pre -- fix
to display properly, and syllables which are to be sung to more than one note, for example as a result of a ligature (flexa, pes, &c.), require a blank (i.e. ""
) to be used for the second and subsequent notes.
External links
[edit]- ↑ 2.9.4 Typesetting Gregorian chant, LilyPond — Notation Reference, v2.18.2 (stable-branch), retrieved 6 May 2020