@node Compiling a file
@subsection Compiling a file
+@cindex compiling
+@cindex first example
+@cindex example, first
+@cindex case sensitive
+
@qq{Compiling} is the term used for processing an input file
in LilyPond format to produce a file which can be printed and
(optionally) a MIDI file which can be played. LilyPond input
in your own music! For more information about the display of
examples in the manual, see @ref{How to read the manual}.}
-@cindex case sensitive
In addition, LilyPond input is @strong{case sensitive}.
@w{@code{@{ c d e @}}} is valid input; @w{@code{@{ C D E @}}} will
produce an error message.
@cindex PDF file
@cindex viewing music
+@cindex text editors
+@cindex running LilyPond under MacOS X
+@cindex MacOS X, running LilyPond
+@cindex running LilyPond under Windows
+@cindex Windows, running LilyPond
+@cindex running LilyPond under Unix
+@cindex Unix, running LilyPond
In this section we will explain what commands to run and how to
view or print the output.
@node Simple notation
@subsection Simple notation
+@cindex simple notation
+@cindex notation, simple
+
LilyPond will add some notation elements automatically. In the
next example, we have only specified four pitches, but LilyPond
has added a clef, time signature, and rhythms.
@subheading Pitches
+@cindex pitches
+@cindex relative mode
+@cindex quote, single
+@cindex comma
+@cindex accidentals and relative mode
+@cindex relative mode, and accidentals
+
+@funindex \relative
+@funindex relative
+@funindex '
+@funindex ,
+
Music Glossary: @rglos{pitch}, @rglos{interval},
@rglos{scale}, @rglos{middle C}, @rglos{octave},
@rglos{accidental}.
@subheading Durations (rhythms)
+@cindex note durations
+@cindex durations
+@cindex rhythms
+@cindex whole note
+@cindex half note
+@cindex quarter note
+@cindex dotted note
+@cindex notating durations
+
Music Glossary: @rglos{beam}, @rglos{duration},
@rglos{whole note}, @rglos{half note}, @rglos{quarter note},
@rglos{dotted note}.
@subheading Rests
+@cindex rest
+@cindex notating rests
+
Music Glossary: @rglos{rest}.
A @notation{rest} is entered just like a note with the name
@subheading Time signature
+@cindex time signature
+
+@funindex \time
+@funindex time
+
Music Glossary: @rglos{time signature}.
The @notation{time signature} can be set with the @code{\time}
@subheading Clef
+@cindex clef
+@cindex treble
+@cindex alto
+@cindex tenor
+@cindex bass
+
+@funindex \clef
+@funindex clef
+
Music Glossary: @rglos{clef}.
The @notation{clef} can be set using the @code{\clef} command:
@node Working on input files
@subsection Working on input files
+@cindex curly braces
+@cindex braces, curly
+@cindex comments
+@cindex line comment
+@cindex comment, line
+@cindex block comment
+@cindex comment, line
+@cindex case sensitive
+@cindex whitespace insensitive
+@cindex expressions
+
+@funindex { ... }
+@funindex %
+@funindex %{ ... %}
+
LilyPond input files are similar to source files in many common
programming languages. They are case sensitive, and white-space
is generally ignored. Expressions are formed with curly braces
@itemize
-@cindex case sensitive
@item
@strong{Case sensitive}:
it matters whether you enter a letter in lower case (e.g.
@node How to read the manual
@subsection How to read the manual
+@cindex how to read the manual
+@cindex manual, reading
+@cindex reading the manual
+@cindex examples, clickable
+@cindex clickable examples
+@cindex tips for constructing files
+@cindex templates
+@cindex constructing files, tips
+@cindex files, tips for constructing
+
LilyPond input must be surrounded by @{ @} marks or a
@w{@code{\relative c'' @{ ... @}}}, as we saw in @ref{Working on
input files}. For the rest of this manual, most examples will
@subheading Accidentals
+@cindex accidentals
+@cindex accidentals and key signatures
+@cindex sharp
+@cindex double sharp
+@cindex sharp, double
+@cindex flat
+@cindex double flat
+@cindex flat, double
+
+@funindex es
+@funindex is
+@funindex eses
+@funindex isis
+
Music Glossary: @rglos{sharp}, @rglos{flat}, @rglos{double sharp},
@rglos{double flat}, @rglos{accidental}.
@cindex key signature, setting
@subheading Key signatures
+@cindex key signature
+@cindex major
+@cindex minor
+@cindex accidentals and key signature
+@cindex content vs. layout
+@cindex layout vs. content
+
+@funindex \key
+@funindex key
+@funindex \major
+@funindex major
+@funindex \minor
+@funindex minor
+
Music Glossary: @rglos{key signature}, @rglos{major},
@rglos{minor}.
@node Ties and slurs
@subsection Ties and slurs
-@cindex ties
+@cindex tie
+@cindex slur
+@cindex slur, phrasing
+@cindex phrasing slur
+
+@funindex ~
+@funindex ( ... )
+@funindex \( ... \)
+
@subheading Ties
+
Music Glossary: @rglos{tie}.
A @notation{tie} is created by appending a tilde @code{~} to the
c4 ~ c8 a8 ~ a2
@end lilypond
-@cindex slurs
@subheading Slurs
+
Music Glossary: @rglos{slur}.
A @notation{slur} is a curve drawn across many notes. The
d4( c16) cis( d e c cis d) e( d4)
@end lilypond
-@cindex slurs, phrasing
-@cindex phrasing slurs
@subheading Phrasing slurs
Music Glossary: @rglos{slur}, @rglos{phrasing}.
@node Articulation and dynamics
@subsection Articulation and dynamics
+
+@subheading Articulations
+
@cindex articulation
-@cindex accents
+@cindex accent
@cindex staccato
-@subheading Articulations
Music Glossary: @rglos{articulation}.
c-. c-- c-> c-^ c-+ c-_
@end lilypond
-@cindex fingering
@subheading Fingerings
+@cindex fingering
+
+@funindex ^
+@funindex _
+
Music Glossary: @rglos{fingering}.
Similarly, @notation{fingering} indications can be added to a note
@subheading Dynamics
+@cindex dynamics
+@cindex decrescendo
+@cindex crescendo
+
+@funindex \f
+@funindex \ff
+@funindex \mp
+@funindex \p
+@funindex \mf
+@funindex \pp
+@funindex \<
+@funindex <
+@funindex \>
+@funindex >
+@funindex \!
+@funindex !
+
Music Glossary: @rglos{dynamics}, @rglos{crescendo},
@rglos{decrescendo}.
c\ff c\mf c\p c\pp
@end lilypond
-@cindex dynamics
-@cindex decrescendo
-@cindex crescendo
@notation{Crescendi} and @notation{decrescendi} are started with
the commands @code{\<} and @code{\>}. The next dynamics sign, for
@node Adding text
@subsection Adding text
+@cindex text, adding
+@cindex adding text
+@cindex markup
+
+@funindex \markup
+@funindex markup
+
Text may be added to your scores:
@lilypond[verbatim,quote,relative=2]
@node Automatic and manual beams
@subsection Automatic and manual beams
+@cindex beaming
+@cindex automatic beams
+@cindex manual beams
+@cindex beams, automatic
+@cindex beams, manual
+@cindex beams, by hand
+
+@funindex [ ... ]
+@funindex [
+@funindex ]
+@funindex \autoBeamOff
+@funindex autoBeamOff
+@funindex \autoBeamOn
+@funindex autoBeamOn
+
Music Glossary: @rglos{beam}.
-@cindex beams, by hand
All @notation{beams} are drawn automatically:
@lilypond[verbatim,quote,relative=2]
@node Advanced rhythmic commands
@subsection Advanced rhythmic commands
+@subheading Partial measure
+
@cindex pickup
@cindex anacrusis
@cindex partial measure
-@subheading Partial measure
+
+@funindex \partial
+@funindex partial
Music Glossary: @rglos{anacrusis}.
f8 c2 d
@end lilypond
+@subheading Tuplets
+
@cindex tuplets
@cindex triplets
-@subheading Tuplets
+
+@funindex \times
+@funindex times
Music Glossary: @rglos{note value}, @rglos{triplet}.
\times 2/3 { d4 a8 }
@end lilypond
+@subheading Grace notes
+
@cindex grace notes
@cindex acciaccatura
@cindex appoggiatura
-@subheading Grace notes
+
+@funindex \grace
+@funindex grace
+@funindex \acciaccatura
+@funindex acciaccatura
+@funindex \appoggiatura
+@funindex acciaccatura
Music Glossary: @rglos{grace notes}, @rglos{acciaccatura},
@rglos{appoggiatura}.
@node Music expressions explained
@subsection Music expressions explained
+@cindex music expression
+@cindex expression, music
+@cindex compound music expression
+@cindex music expression, compound
+
In LilyPond input files, music is represented by @emph{music
expressions}. A single note is a music expression:
{ { a4 g } f g }
@end lilypond
-@cindex expression
-@cindex music expression
@subheading Analogy: mathematical expressions
This mechanism is similar to mathematical formulas: a big formula
@subheading Simultaneous music expressions: multiple staves
+@cindex multiple staves
+@cindex staves, multiple
+@cindex polyphony
+@cindex combining expressions in parallel
+@cindex parallel expressions
+@cindex expressions, parallel
+@cindex relative notes and simultaneous music
+@cindex relative notes and parallel expressions
+@cindex simultaneous music and relative notes
+@cindex parallel expressions and relative notes
+
+@funindex <<
+@funindex >>
+@funindex << ... >>
+
Music Glossary: @rglos{polyphony}.
This technique is useful for @notation{polyphonic} music. To
@node Multiple staves
@subsection Multiple staves
+@cindex multiple staves
+@cindex staves, multiple
+@cindex context
+@cindex context, notation
+@cindex notation context
+
+@funindex \new Staff
+@funindex new Staff
+@funindex Staff
+@funindex \new
+@funindex new
+@funindex Score
+@funindex Voice
+@funindex Lyrics
+@funindex ChordNames
+
LilyPond input files are constructed out of music expressions, as
we saw in @ref{Music expressions explained}. If the score begins
with simultaneous music expressions, LilyPond creates multiples
@subsection Staff groups
@cindex piano staff
+@cindex staff, piano
@cindex choir staff
+@cindex staff, choir
@cindex grand staff
+@cindex staff, grand
+@cindex staff group
+
+@funindex PianoStaff
+@funindex GrandStaff
+@funindex ChoirStaff
Music Glossary: @rglos{brace}.
@subsection Combining notes into chords
@cindex chords
+@cindex note durations in chords
+
+@funindex <
+@funindex >
+@funindex < ... >
Music Glossary: @rglos{chord}.
@cindex polyphony
@cindex multiple voices
-@cindex voices, more -- on a staff
+@cindex voices, more on one staff
+@cindex single staff polyphony
+@cindex spacer rest
+@cindex rest, spacer
+
+@funindex << ... \\ ... >>
+@funindex <<
+@funindex \\
+@funindex >>
+
When different melodic lines are combined on a single staff they
are printed as polyphonic voices; each voice has its own stems,
slurs and beams, and the top voice has the stems up, while the
@cindex lyrics
@cindex songs
+@funindex \addlyrics
+@funindex addlyrics
+
Music Glossary: @rglos{lyrics}.
Here is the start of the melody to a nursery
@node Aligning lyrics to a melody
@subsection Aligning lyrics to a melody
-Music Glossary: @rglos{melisma}, @rglos{extender line}.
-
@cindex melisma
@cindex extender line
@cindex hyphens
@cindex underscore
+@cindex lyrics, aligning
+@cindex aligning lyrics
+@cindex lyrics, multi-syllable words
+@cindex words with multiple syllables in lyrics
+
+Music Glossary: @rglos{melisma}, @rglos{extender line}.
The next line in the nursery rhyme is @notation{The moon doth
shine as bright as day}. Let's extend it:
@node Lyrics to multiple staves
@subsection Lyrics to multiple staves
+@cindex lyrics and multiple staves
+@cindex multiple staves and lyrics
+
The simple approach using @code{\addlyrics} can be used for
placing lyrics under more than one staff. Here is an
example from Handel's @notation{Judas Maccabæus}:
@node Organizing pieces with variables
@subsection Organizing pieces with variables
+@cindex variables
+@cindex variables, defining
+@cindex identifiers
+@cindex macros
+@cindex assigning variables
+@cindex using variables
+@cindex variables, using
+@cindex variables, characters allowed in
+@cindex characters allowed in variables
+
When all of the elements discussed earlier are combined to produce
larger files, the music expressions get a lot bigger. In
polyphonic music with many staves, the input files can become very
@subsection Version number
@cindex versioning
+@cindex version
+@cindex version number
+@cindex upgrades
+@cindex future upgrades
+@cindex updating files
+@cindex files, updating
+
+@funindex \version
+@funindex version
+@funindex convert-ly
+
The @code{\version} statement records the version of LilyPond that
was used to write the file:
@node Adding titles
@subsection Adding titles
+@cindex title
+@cindex headers
+@cindex header block
+
+@funindex \header
+@funindex header
+
The title, composer, opus number, and similar information are
entered in the @code{\header} block. This exists outside of the
main music expression; the @code{\header} block is usually placed
@node Absolute note names
@subsection Absolute note names
+@cindex note names
+@cindex note names, absolute
+@cindex absolute mode
+@cindex absolute values for pitches
+@cindex pitches, absolute values
+@cindex absolute note names
+
So far we have always used @code{\relative} to define pitches.
This is the easiest way to enter most music, but another way of
defining pitches exists: absolute mode.