LilyPond input that was used to generate that image.
Try it on this image
-@lilypond[quote,raggedright,relative=2]
+@lilypond[fragment,quote,raggedright,relative=2]
c-\markup { \bold \huge { Click here. } }
@end lilypond
@end ifhtml
* Printing lyrics::
* A lead sheet::
* Listening to output::
-* Titling::
+* Adding titles::
* Single staff polyphony::
* Piano staves::
* Organizing larger pieces::
@noindent
the result looks like this
-@lilypond[quote,notime,relative=1]
+@lilypond[fragment,quote,notime,relative=1]
c d e f g a b
@end lilypond
a1 a2 a4 a16 a32
@end example
-@lilypond[quote,notime]
+@c FIXME: have NOTIME also remove Score.timing?
+@lilypond[fragment,quote,notime,relative=1]
\set Score.timing = ##f
\set Staff.autoBeaming = ##f
-\transpose c c' { a1 a2 a4 a16 a32 s16_" " }
+{ a1 a2 a4 a16 a32 s16_" " }
@end lilypond
If you do not specify a @rglos{duration}, the duration last entered is
a a8 a a2 a
@end example
-@lilypond[quote,notime]
+@lilypond[fragment,quote,notime,relative=1]
\set Score.timing = ##f
-\transpose c c' { a a8 a a2 a s16_" " }
+{ a a8 a a2 a s16_" " }
@end lilypond
r2 r4 r8 r16
@end example
-@lilypond[quote,notime]
+@lilypond[fragment,quote,notime]
\set Score.timing = ##f
r2 r4 r8 r16 s16_" "
@end lilypond
a2. a4 a8. a16
@end example
-@lilypond[quote,notime]
+@lilypond[fragment,quote,notime,relative=1]
\set Score.timing = ##f
-\transpose c c' { a2. a4 a8. a16 s16_" " }
+{ a2. a4 a8. a16 s16_" " }
@end lilypond
The @rglos{meter} (or @rglos{time signature}) can be set with the
@end example
@c A clef here may lead to confusion, remove it.
-@lilypond[quote]
+@lilypond[fragment,quote]
\override Staff.Clef #'transparent = ##t
\time 3/4
s4_" "
\clef tenor
@end example
-@lilypond[quote,notime]
+@lilypond[fragment,quote,notime]
\set Score.timing = ##f
\clef violin
s4_" "
s16_" "
@end lilypond
+@ignore
To recognize names like @samp{c} and @samp{d} as pitches, they have to
be entered inside a so-called @code{\notes} block. This block is
formed by enclosing notes and commands are enclosed in curly braces
the opening brace
@example
-\notes @{
+@{
\time 3/4
\clef bass
c2 e4 g2.
@noindent
and the music will be converted to printable output.
+@end ignore
-@lilypond[quote,noindent]
-\score {
- \notes {
- \time 3/4
- \clef bass
- c2 e4 g2.
- f4 e d c2 r4
- }
- \paper {
- linewidth = 55 * \staffspace
- }
+Remember to enclose the notes and commands in curly braces
+@code{@{@tie{}@dots{}@tie{}@}} to convert it to printable output.
+
+@lilypond[fragment,quote,noindent,linewidth=55\staffspace]
+{
+ \time 3/4
+ \clef bass
+ c2 e4 g2.
+ f4 e d c2 r4
}
@end lilypond
-In many examples in this manual, both @code{\score} and @code{\notes}
-and accompanying braces are left out for brevity. However, they must
-be present when feeding the file to LilyPond.
-
For more elaborate information on
@quotation
input and save the file as @file{test.ly}
@example
-\score @{
- \notes @{ c'4 e' g' @}
-@}
+@{ c'4 e' g' @}
@end example
@noindent
@example
lilypond (GNU LilyPond) 2.2.0
-Running lilypond-bin...
+Running lilypond...
Now processing `/home/fred/ly/test.ly'
Parsing...
Interpreting music...[1]
word processor, its formatting codes will confuse LilyPond.} and enter
@example
-\score @{
- \notes @{ c'4 e' g' @}
-@}
+@{ c'4 e' g' @}
@end example
Save it on the desktop as @file{test.ly} and make sure that it is not
cis1 ees fisis aeses
@end example
-@lilypond[quote,notime]
+@lilypond[fragment,quote,notime]
\set Score.timing = ##f
\transpose c c' { cis1 ees fisis aeses s16_" " }
@end lilypond
g
@end example
-@lilypond[quote,notime,fragment]
+@lilypond[fragment,quote,notime,fragment]
\key d \major
g'1
\key c \minor
Here are key signatures, accidentals and ties in action
@example
-\score @{
- \notes @{
- \time 4/4
- \key g \minor
- \clef violin
- r4 r8 a8 gis4 b
- a8 d4.~ d e8
- fis4 fis8 fis8 eis4 a8 gis~
- gis2 r2
- @}
+@{
+ \time 4/4
+ \key g \minor
+ \clef violin
+ r4 r8 a8 gis4 b
+ a8 d4.~ d e8
+ fis4 fis8 fis8 eis4 a8 gis~
+ gis2 r2
@}
@end example
-@lilypond[quote, noindent]
-\score {
- \notes \transpose c c' {
- \time 4/4
- \key g \minor
- \clef violin
- r4 r8 a8 gis4 b
- a8 d4.~ d e8
- fis4 fis8 fis8 eis4 a8 gis~
- gis2 r2
- }
- \paper { linewidth = 50 * \staffspace }
+@ignore
+FIXME
+ugr: removing the ignore block, leaving the comment line below
+@c TODO: use relative mode, verbatim, junk \transpose and above @example
+@end ignore
+
+
+@lilypond[fragment,quote,noindent,linewidth=50\staffspace]
+\transpose c c' {
+ \time 4/4
+ \key g \minor
+ \clef violin
+ r4 r8 a8 gis4 b
+ a8 d4.~ d e8
+ fis4 fis8 fis8 eis4 a8 gis~
+ gis2 r2
}
@end lilypond
+
@cindex accidentals
+
@noindent
There are some interesting points to note in this example. Bar lines
and beams are drawn automatically. Line breaks are calculated
This makes the input less readable, and it is a source of errors. The
solution is to use `relative octave' mode. In practice, this is the
most convenient way to copy existing music. To use relative mode, add
-@code{\relative} before the piece of music. You must also give a note
-from which relative mode starts, in this case @code{c''}. If you do not
+@code{\relative} before the piece of music.
+@ignore
+FIXME: move to notation manual?
+ You must also give a note
+from which relative mode starts, in this case @code{c''}.
+@end ignore
+If you do not
use octavation quotes (i.e., do not add @code{'} or @code{,} after a
note), relative mode chooses the note that is closest to the previous
one. For example, @samp{c f} goes up while @samp{c g} goes down
@lilypond[quote,notime,fragment,verbatim]
-\relative c'' {
- c f c g c
+\relative {
+ c' f c g c
}
@end lilypond
entered as
@lilypond[quote,raggedright,fragment,verbatim]
-\relative c'' {
+\relative {
\key a \major
\time 6/8
- cis8. d16 cis8 e4 e8
+ cis''8. d16 cis8 e4 e8
b8. cis16 b8 d4 d8
}
@end lilypond
Larger intervals are made by adding octavation quotes.
@lilypond[quote,notime,verbatim,fragment]
-\relative c'' {
- c f, f c' c g' c,
+\relative c {
+ c'' f, f c' c g' c,
}
@end lilypond
expression}. We have already seen in the previous examples;
a single note is a music expression
-@lilypond[quote,verbatim,relative=3]
+@lilypond[fragment,quote,verbatim,relative=3]
a4
@end lilypond
Enclosing group of notes in braces creates a new music
expression
-@lilypond[quote,verbatim,relative=3]
+@lilypond[fragment,quote,verbatim,relative=3]
{ a4 g4 }
@end lilypond
Here, the expression from the previous example is combined with two
notes
-@lilypond[quote,verbatim,relative=3]
+@lilypond[fragment,quote,verbatim,relative=3]
{ { a4 g } f g }
@end lilypond
@code{>>}. In the following example, three sequences (all containing
two notes) are combined simultaneously
-@lilypond[quote,verbatim,relative=3]
+@lilypond[fragment,quote,verbatim,relative=3]
<<
{ a4 g }
{ f e }
Like mathematical expressions, music expressions can be nested
arbitrarily deep@footnote{The reason for getting three staves in the
-previous example but just a single staff in current one will be explained
-later.}
+previous example but just a single staff in the current one will be
+explained later.}
-@lilypond[quote,verbatim,relative=2]
+@lilypond[fragment,quote,verbatim,relative=2]
{
c <<c e>>
<< { e f } { c <<b d>> } >>
braces at the end of an expression. For example,
@example
-\score @{
- \notes <<
- @{
- @dots{}
- @}
- @{
- @dots{}
- @}
- >>
-@}
+\book @{
+ \score @{
+ <<
+ @{
+ @dots{}
+ @}
+ @{
+ @dots{}
+ @}
+ \paper @{
+ @dots{}
+ @}
+ >>
+ @}
+@}
@end example
Some editors have special support for entering LilyPond, and can help
indenting source files. See @ref{Editor support}, for more information.
-
-
@node More staves
@section More staves
@c TODO: (c) status of this Paul McCartney (?) song (let's all stand together)
-@lilypond[quote,verbatim,raggedright]
-\score {
- \notes <<
- \new Staff {
- \time 3/4
- \clef violin
- \relative c'' {
- e2 d4 c2 b4 a8[ a]
- b[ b] g[ g] a2. }
- }
- \new Staff {
- \clef bass
- c2 e4 g2.
- f4 e d c2.
- }
- >>
-}
+@lilypond[fragment,quote,verbatim,raggedright]
+<<
+ \new Staff {
+ \time 3/4
+ \clef violin
+ \relative {
+ e''2 d4 c2 b4 a8[ a]
+ b[ b] g[ g] a2. }
+ }
+ \new Staff {
+ \clef bass
+ c2 e4 g2.
+ f4 e d c2.
+ }
+>>
@end lilypond
For more information on context see the description in
Common accents can be added to a note using a dash (@samp{-}) and a
single character
-@lilypond[quote,verbatim,relative=2]
+@lilypond[fragment,quote,verbatim,relative=2]
c-. c-- c-> c-^ c-+ c-_
@end lilypond
Similarly, fingering indications can be added to a note using a dash
(@samp{-}) and the digit to be printed
-@lilypond[quote,verbatim,relative=2]
+@lilypond[fragment,quote,verbatim,relative=2]
c-3 e-5 b-2 a-1
@end lilypond
Dynamic signs are made by adding the markings (with a backslash) to
the note
-@lilypond[quote,verbatim,relative=2]
+@lilypond[fragment,quote,verbatim,relative=2]
c\ff c\mf
@end lilypond
@code{\>}. An ending dynamic, for example @code{\f}, will finish the
crescendo, or the command @code{\!} can be used
-@lilypond[quote,verbatim,relative=2]
+@lilypond[fragment,quote,verbatim,relative=2]
c2\< c2\ff\> c2 c2\!
@end lilypond
articulation. The starting note and ending note are marked with
@samp{(} and @samp{)}, respectively
-@lilypond[quote,fragment,relative=2,verbatim]
+@lilypond[fragment,quote,fragment,relative=2,verbatim]
d4( c16)( cis d e c cis d e)( d4)
@end lilypond
@cindex Lyrics
@cindex Songs
-Lyrics are entered by separating each syllable with a space,
+Lyrics are entered by separating each syllable with a space
@example
I want to break free
@end example
-To prevent certain words (for example `as') as being read as a
-pitch, the input-mode must be switched. This is done with
-@code{\lyrics}. In @code{\lyrics} mode, all words are read as lyric
-syllables.
-
-@example
-\lyrics @{ I want to break free @}
-@end example
-
-@noindent
-Again, the braces @code{@{@}} signify that the syllables are sung in
-sequence.
-
-By default, music expressions are interpreted in @code{Staff} context. For
-lyrics, this is obviously not desirable, so it is necessary
-to explicitly specify a @code{Lyrics} context,
-
-@example
-\new Lyrics \lyrics @{ I want to break free @}
-@end example
-
-The melody for this song is as follows
+Consider the melody
-@lilypond[quote,fragment,relative=2]
-r4 c \times 2/3 { f4 g g }
-\times 2/3 { g4( a2) }
+@lilypond[quote,verbatim,fragment,raggedright]
+\relative {
+ r4 c \times 2/3 { f g g }
+ \times 2/3 { g4( a2) }
+}
@end lilypond
+@c FIXME: when/how/to what rename newlyrics?
The lyrics can be set to these notes, combining both with the
-@code{\lyricsto} keyword
-
-@example
-\lyricsto "@var{name}" \new Lyrics @dots{}
-@end example
-
-@noindent
-where @var{name} identifies to which melody the lyrics should be
-aligned. In this case, there is only one melody, so we can leave it
-empty.
-
-The final result is
+@code{\newlyrics} keyword
@lilypond[quote,verbatim,fragment,raggedright]
-\score {
- \notes <<
- \relative c' {
- r4 c \times 2/3 { f g g }
- \times 2/3 { g4( a2) }
- }
- \lyricsto "" \new Lyrics \lyrics { I want to break free }
- >>
-}
+<<
+ \relative {
+ r4 c \times 2/3 { f g g }
+ \times 2/3 { g4( a2) }
+ }
+ \newlyrics { I want to break free }
+>>
@end lilypond
@cindex melisma
line}. It is entered as two underscores, i.e.,
@example
-\lyrics @{ I want to break free __ @}
+@{ I want to break free __ @}
@end example
-@lilypond[quote,raggedright]
-\score {
- <<
- \notes \relative c' \new Voice {
- r4 c \times 2/3 { f g g }
- \times 2/3 { g4( a2) }
- }
- \lyricsto "" \new Lyrics \lyrics { I want to break free __ }
- >>
-}
+@lilypond[fragment,quote,raggedright]
+<<
+ \relative {
+ r4 c \times 2/3 { f g g }
+ \times 2/3 { g4( a2) }
+ }
+ \newlyrics { I want to break free __ }
+>>
@end lilypond
Similarly, hyphens between words can be entered as two dashes,
Twin -- kle twin -- kle
@end example
-@lilypond[quote,raggedright]
-\score {
- <<
- \notes \relative f' \context Voice = bla {
- \time 2/4
- f4 f c' c
- }
- \new Lyrics \lyrics \lyricsto "bla" { Twin -- kle twin -- kle }
- >>
-}
+@lilypond[fragment,quote,raggedright]
+<<
+ \relative {
+ \time 2/4
+ f4 f c' c
+ }
+ \newlyrics { Twin -- kle twin -- kle }
+>>
@end lilypond
More options, like putting multiple lines of lyrics below a melody are
discussed in @ref{Vocal music}.
+@c FIXME: too geeky, for notation manual?
+@c or introduce using foo = \lyrics { a b c } ?
+
+When using variables for a piece of lyrics
+To prevent certain words (for example `as') as being read as a
+pitch, the input-mode must be switched. This is done with
+@code{\lyrics}. In @code{\lyrics} mode, all words are read as lyric
+syllables.
+
+@example
+myText = \lyrics @{ I want to break free @}
+@end example
+
+@noindent
+The braces @code{@{@}} signify that the syllables are sung in
+sequence.
+
+@ignore
+By default, music expressions are interpreted in @code{Staff} context. For
+lyrics, this is obviously not desirable, so it is necessary
+to explicitly specify a @code{Lyrics} context,
+
+@example
+\lyrics @{ I want to break free @}
+@end example
+
+The melody for this song is as follows
+
+@lilypond[fragment,quote,fragment,relative=2]
+r4 c \times 2/3 { f4 g g }
+\times 2/3 { g4( a2) }
+@end lilypond
+
+@end ignore
@node A lead sheet
This mode is switched on with @code{\chords}
@lilypond[quote,verbatim,raggedright]
-\score {
- \chords { c2 f4. g8 }
-}
+\chords { c2 f4. g8 }
@end lilypond
Other chords can be created by adding modifiers after a colon. The
a lead sheet, for example,
@example
-\score @{
- <<
- \new ChordNames \chords @{ @emph{chords} @}
- \notes @emph{the melody}
- \lyricsto "" \new Lyrics \lyrics @{ @emph{the text} @}
- >>
+<<
+ \new ChordNames \chords @{ @emph{chords} @}
+ @emph{the melody}
+ \newlyrics @{ @emph{the text} @}
+>>
@}
@end example
@lilypond[quote,raggedright]
-\score {
- <<
- \new ChordNames \chords { r2 c:sus4 f }
- \notes \relative c' {
- r4 c \times 2/3 { f g g }
- \times 2/3 { g4( a2) }
- }
- \new Lyrics \lyricsto "" \lyrics { I want to break free __ }
- >>
-}
+<<
+ \new ChordNames \chords { r2 c:sus4 f }
+ \notes \relative {
+ r4 c' \times 2/3 { f g g }
+ \times 2/3 { g4( a2) }
+ }
+ \newlyrics { I want to break free __ }
+>>
@end lilypond
A complete list of modifiers and other options for layout can be found
in @ref{Chords}.
-
+@c FIXME: we talk about \midi before mentioning \paper (or \layout?)
@node Listening to output
@section Listening to output
connecting and controlling digital instruments. A MIDI file is like a
tape recording of a MIDI instrument.
-To create a MIDI from a music piece of music, add a
-@code{\midi} block causes LilyPond to create a MIDI file, so you
-can listen to the music you entered. It is great for checking the
-music: octaves that are off or accidentals that were mistyped stand
-out very much when listening to the musical transcription.
+To create a MIDI from a music piece of music, add a @code{\midi}
+block. This causes LilyPond to create a MIDI file, so you can listen
+to what you just entered. It is great for checking the music.
+Octaves that are off or accidentals that were mistyped stand out very
+much when listening to the musical transcription.
The @code{\midi} block is added to @code{\score}, for example,
@cindex paper block
-@node Titling
-@section Titling
+@node Adding titles
+@section Adding titles
Bibliographic information is entered in a separate block, the
@code{\header} block. The name of the piece, its composer, etc., are
-entered as an assignment, within @code{\header @{@tie{}@dots{}@tie{}@}}.
-For example,
+entered as an assignment, within @code{\header
+@{@tie{}@dots{}@tie{}@}}. The @code{\header} block is usually put at
+the top of the file. For example,
@example
\header @{
tagline = "small is beautiful"
@}
-\score @{ @dots{} @}
+@{ @dots{} @}
@end example
@cindex bibliographic information
beautiful.'@footnote{Nicely printed parts are good PR for us, so
please leave the tagline if you can.}
-Normally, the @code{\header} is put at the top of the file. However,
-for a document that contains multiple pieces (e.g., an etude book, or
-an orchestral part with multiple movements), the header can be
-put into the @code{\score} block as follows; in this case, the name of
-each piece will be printed before each movement.
+
+The @code{\header} block is usually put at the top of the file.
+
+A document may contains multiple pieces of music, examples are an
+etude book, or an orchestral part with multiple movements.
+@c FIXME: ugh. \header can only live at toplevel, or inside \score.
+@c If we allow it also to live inside \book, we do not need \score here?
+The @code{\book} block is used to group the individual @code{\score}
+blocks.
+
+The header for each piece of music can be put inside the @code{\score}
+block. The @code{piece} name from the header will be printed before
+each movement.
+
+@ignore
+
+FIXME: introduce \BOOK
+
+FIXME: Using "Adagio" as a name is confusing, it's more common to be
+a plain tempo indication.
+
+Since today (CVS-1.211) we also allow headers and composite music
+inside book:
+
+ \header { ... }
+ \book {
+ \header { ... }
+ { ... }
+ \header { ... }
+ { ... }
+ }
+
+@end ignore
@cindex Engraved by LilyPond
@cindex signature line
@cindex tag line
+
@example
\header @{
title = "Eight miniatures"
tagline = "small is beautiful"
@}
-\score @{
- @dots{}
- \header @{ piece = "Adagio" @}
-@}
-\score @{
- @dots{}
- \header @{ piece = "Menuetto" @}
+\book @{
+ \score @{
+ @dots{}
+ \header @{ piece = "Adagio" @}
+ @}
+ \score @{
+ @dots{}
+ \header @{ piece = "Menuetto" @}
+ @}
@}
@end example
@cindex multiple voices
@cindex voices, more -- on a staff
When different melodic lines are combined on a single staff they are
-printed as polyphonic voices: each voice has its own stems, slurs and
+printed as polyphonic voices; each voice has its own stems, slurs and
beams, and the top voice has the stems up, while the bottom voice has
them down.
{ r4 g4 f2 f4 } >>
@end lilypond
-For polyphonic music typesetting, spacer rests can also be convenient: these
+For polyphonic music typesetting, spacer rests can also be convenient; these
are rests that do not print. It is useful for filling up voices that
temporarily do not play. Here is the same example with a spacer rest
instead of a normal rest---just use @samp{s} instead of @samp{r}
In the next example, a two-note motive is repeated two times by using
variable substitution
-@lilypond[quote,raggedright,verbatim]
+@lilypond[quote,raggedright,verbatim,nofragment]
seufzer = \notes {
e'4( dis'4)
}
-\score {
- \new Staff { \seufzer \seufzer }
-}
+{ \seufzer \seufzer }
@end lilypond
The name of an identifier should have alphabetic characters only;
@node An orchestral part
@section An orchestral part
-In orchestral music, all notes are printed twice: in a part for
+In orchestral music, all notes are printed twice; in a part for
the musicians, and in a full score for the conductor. Identifiers can
-be used to avoid double work: the music is entered once, and stored in
+be used to avoid double work. The music is entered once, and stored in
a variable. The contents of that variable is then used to generate
both the part and the score.
substitutes the contents of @file{horn-music.ly} at this position in
the file, so @code{hornNotes} is defined afterwards. The command
@code{\transpose f@tie{}c'} indicates that the argument, being
-@code{\hornNotes}, should be transposed by a fifth downwards: sounding
+@code{\hornNotes}, should be transposed by a fifth downwards. Sounding
@samp{f} is denoted by notated @code{c'}, which corresponds with
tuning of a normal French Horn in@tie{}F. The transposition can be seen
in the following output
\end@{lilypond@}
\noindent
-In this example two things happened: a
+In this example two things happened. A
\verb+\score+ block was added, and the line width was set to natural
length.
If there is no @code{\score} block in the fragment,
@code{lilypond-book} will supply one
-@lilypond[quote]
+@lilypond[fragment,quote]
c'4
@end lilypond
@noindent
-In this example two things happened: a
+In this example two things happened. A
@code{score} block was added, and the line width was set to natural
length.
Options are put in brackets.
-@lilypond[quote,staffsize=26,verbatim]
+@lilypond[fragment,quote,staffsize=26,verbatim]
c'4 f16
@end lilypond