@c -*-texinfo-*-
+@c TODO: LilyPond Lilypond lilypond
+
@node Tutorial
@chapter Tutorial
-
-
LilyPond prints music from a specification that you, the user, supply.
-You have to give that specification using a @emph{language}. This
-chapter is a gentle introduction to that language.
+You have to give that specification using a textual @emph{language}.
+This chapter is a gentle introduction to that language.
This tutorial will demonstrate how to use Lilypond by presenting
examples of input along with resulting output. We will use English
The examples discussed are included in the distribution, in the
subdirectory @file{input/tutorial/}@footnote{When we refer
to filenames, they are relative to the top directory of the source
-package.
+package. In binary installations you should look in your doc section,
+eg, @code{/usr/share/doc/lilypond1.3/examples/input/tutorial}
@cindex file names
}. We recommend that you experiment with writing Lilypond input
yourself, to get a feel for how the program behaves.
@node Running LilyPond
@section Running LilyPond
-
-[describe all programs involved in one list.]
+[FIXME refman: describe all programs involved in one list.]
Before we dive into describing the input language of LilyPond, we first
show you through the procedure for getting notes on your screen and out
of your printer.
-The first step is creating an input file. Using your favorite
+The first step is creating an input file. Using your favorite
text-editor, create @file{test.ly} containing
-@example
-\header @{
- title = "Test";
-@}
+@ignore
+
+NOTE: if you're reading this, ie, the Texinfo source itself, test.ly
+should of course contain:
+
+ \score{
+ \notes { c'4 e' g' }
+ }
+@end ignore
+
+@example
\score @{
- \notes @{ c'4 e'4 g'4 @}
- \paper @{ @}
+ \notes @{ c'4 e' g' @}
@}
@end example
@unnumberedsubsec Unix
-
@cindex Unix, Running lilypond on
+@cindex ly2dvi
+
+On unix, you invoke ly2dvi to compile your lilypond source file (you can
+omit the @code{.ly}):
-If you run Unix, proceed as follows: run lilypond on the file, i.e.,
@example
- lilypond test
+ly2dvi -P test
@end example
+
You will see the following on your screen:
+
@example
-GNU LilyPond 1.3.125.
-Now processing: `input/tutorial/test.ly'
+GNU LilyPond 1.3.145
+Now processing: `/home/fred/ly/test.ly'
Parsing...
Interpreting music...[1]
Preprocessing elements...
Calculating column positions... [2]
paper output to test.tex...
+
+Analyzing test.tex...
+Running LaTeX...
+Running dvips...
+PS output to test.ps...
+DVI output to test.dvi...
@end example
-Now, run @TeX{}@footnote{@TeX{} is a text-typesetting system that is
-especially suited for typesetting mathematics.}. The result should
-resemble this:
-@example
-This is TeX, Version 3.14159 (Web2C 7.3.1)
-(test.tex (/home/hanwen/usr/share/lilypond/tex/lilyponddefs.tex
-(/home/hanwen/usr/share/lilypond/tex/lilypond-plaintex.tex
-LilyPond Plain TeX settings) (/home/hanwen/usr/src/ ...
-(/home/hanwen/usr/share/lilypond/tex/lily-ps-defs.tex) [footer empty]
-(/home/hanwen/usr/share/lilypond/tex/fetdefs.tex)) [1] )
-Output written on test.dvi (1 page, 3716 bytes).
-Transcript written on test.log.
-@end example
-The result of the @TeX{} run is a @TeX{} ``DeVice Independent'' file
-(@file{test.dvi}).
+The results of the ly2dvi run are a ``DeVice Independent'' file
+(@file{test.dvi}) and a PostScript file (@file{test.ps}).
+
@cindex DVI file
-@cindex @TeX{}
@cindex Viewing music
-@cindex @code{xdvi}
-To view the output, run Xdvi, i.e.
+@cindex xdvi
+@cindex .dvi
+
+To view the @code{test.dvi} output, run Xdvi (you may omit the
+@code{.dvi}):
+
@example
- xdvi test
+xdvi test
@end example
+
You should see the following in a window next to some buttons.
@lilypond
-\header {
- title = "Test";
-}
-
\score {
- \notes { c'4 e'4 g'4 }
- \paper { }
+ \notes { c'4 e' g' }
}
@end lilypond
-@cindex postscript, converting to
-When you're satisfied with the result, you can print it. For printing,
-you have to generate a postscript file:
-@example
- dvips -o test.ps test.dvi
-@end example
-which looks like this:
-@example
-This is dvips(k) 5.86 Copyright 1999 Radical Eye Soft ...
-' TeX output 2001.01.27:1806' -> test.ps
-<texc.pro><special.pro>. [1]
-@end example
+When you're satisfied with the result, you can print the PostScript
+file.
@cindex PostScript
@cindex Printing output
+@cindex .ps
@cindex GhostScript
@cindex @code{lpr}
PostScript is a page description language, similar to PDF. Some printers
will act as a PostScript printer. Assuming this, the following command
will print the file
@example
- lpr test.ps
+lpr test.ps
@end example
If this does not make your printer produce a page of music, then you
should look into installing and configuring ghostscript. Refer to
GhostScript's website at @uref{http://www.ghostscript.com}.
-There are three other routes: firstly, you can add titling to the
-output. This is done by a separate program called @file{ly2dvi}: this
-program first calls LilyPond to process the @file{.ly} file, and then
-runs @TeX{} on it to produce a @file{.dvi} file with proper margin
-settings and titling.
-
-@cindex titles, adding
-@cindex ly2dvi
+There are three other routes. Firstly, there is a script called
+@code{lilypond-book}, that allows you to freely mix LilyPond input with
+Texinfo or LaTeX input. For example, this manual was written using
+@code{lilypond-book}. It is discussed in @ref{lilypond-book}.
+@c FIXME: ly2dvi option?
+Secondly, you can generate PostScript directly. This is useful if you
+can not or do not want to run @TeX{} on your system. To obtain direct
+PostScript output, invoke LilyPond as follows:
+@cindex PostScript output
@example
- ly2dvi test.ly
+lilypond -f ps test.ly
@end example
-After some disk-activity, you should end up with a @file{.dvi} file.
-Ly2dvi is further described in the @ref{ly2dvi}.
+You have to set some environment variables to view or print this
+output. More information can be found in @ref{Invoking
+LilyPond}.
-Secondly, you can generate PostScript directly. This is useful if you
-can not or do not want to run @TeX{} on your system.
-To obtain PS output, invoke LilyPond as follows:
-@cindex PostScript output
+@c FIXME: ly2dvi option?
+Thirdly, if you want to do special things with your output, you can run
+invoke lilypond directly:
@example
- lilypond -f ps test.ly
+lilypond test.ly
@end example
+to produce plain @TeX{}@footnote{@TeX{} is a text-typesetting system
+that is especially suited for typesetting mathematics.} output. Note
+that you must run @TeX{} on the resulting @file{test.tex}, ie, not
+LaTeX.
+@cindex @TeX{}
-You have to set some environment variables to view or print this
-output. More information can be found in the @ref{Invoking
-LilyPond}.
-Finally, there is a script called @code{lilypond-book}, that allows you
-to freely mix LilyPond input with Texinfo or LaTeX input. For example,
-this manual was written using @code{lilypond-book}. It is discussed in
-@ref{lilypond-book}.
@unnumberedsubsec Windows
@cindex Bach, Johann Sebastian
@lilypond[verbatim]
-% lines preceded by a percent are comments which
-% are ignored by Lilypond.
+% text preceded by a percent sign is a comment
+% and is ignored by Lilypond
\include "paper16.ly"
\score {
\notes
}
@end lilypond
-We will analyse the input, line by line.
+We will analyse the input, line by line.
+@separate
@example
- % lines preceded by a percent are comments which
- % are ignored by Lilypond.
+ % text preceded by a percent sign is a comment
+ % and is ignored by LilyPond
@end example
The percent sign, @code{%}, introduces a line comment. If you want to
-make larger comments, you can use block comments. These are delimited
-by @code{%@{} and @code{%@}}
+make a comment that use several lines, you can use block comments. These
+are delimited by @code{%@{} and @code{%@}}
@cindex comment
@cindex block comment
@cindex line comment
-
+@separate
@example
\include "paper16.ly"
@cindex @code{\include}
@cindex point, printer's
@cindex staff size setting
-By default, LilyPond will use definitions for a staff that is 20
-point@footnote{A point is the standard measure of length for printing;
-one point is 1/72.27 inch.} high. We want smaller
+By default, LilyPond will typeset the music in a size such that each
+staff is 20 point@footnote{A point is the standard measure of length for
+printing; one point is 1/72.27 inch.} high. We want smaller
output (16 point staff height), so we must import the settings for that
size, which is done here.
+@separate
@example
\score @{
@end example
Music is printed by combining a chunk of music with directions for
outputting it. This combination is formed in the @code{\score} block.
+@separate
@example
\notes
@end example
This makes LilyPond ready for accepting notes.
+@separate
@example
\relative c''
@cindex octaves, choosing
@cindex pitch
-As we will see, pitches are combinations of octave, note name and
-chromatic alteration. In this scheme, the octave is indicated by
-using raised quotes (@code{'}) and ``lowered'' quotes (commas:
-@code{,}). The central C is denoted by @code{c'}. The C one octave
-higher is @code{c''}. One and two octaves below the central C is
-denoted by @code{c} and @code{c,} respectively.
+As we will see, each note is described by its note name, duration,
+octave and possibly a chromatic alteration. In this scheme, the
+octave is indicated by using raised quotes (@code{'}) and ``lowered''
+quotes (commas: @code{,}). The central C is denoted by @code{c'}.
+The C one octave higher is @code{c''}. One and two octaves below
+the central C is denoted by @code{c} and @code{c,} respectively.
@cindex relative
-For pitches in a long piece you might have to type many quotes. It is
-easy to make typing errors with this, so LilyPond has a special entry
-mode to remedy this. In this ``relative'' octave mode, octaves of notes
+Even though a piece of music often spans a range of several octaves,
+it mostly moves in small intervals. LilyPond has a special entry
+mode to save typing in this situation. In this ``relative'' octave
+mode, octaves of notes
without quotes are chosen such that a note is as close as possible
(graphically, on the staff) to the preceding note. If you add a
high-quote an extra octave is added. The lowered quote (a comma) will
subtract an extra octave. Because the first note has no predecessor,
you have to give the (absolute) pitch of the note to start with.
+@separate
@example
\sequential @{
What follows is sequential music, i.e.,
@cindex sequential music
notes that are to be played and printed after each other.
+@separate
@example
\time 3/4;
@end example
@cindex time signature, setting
@cindex @code{\time}
- This command changes the time signature of the current piece: a 3/4
-sign is printed. The time signature setting is also used to generate
-bar lines in the right spots.
+ This command sets or changes the time signature of the current piece:
+a 3/4 sign is printed. The time signature setting is also used to generate
+bar lines at the right spots.
+@separate
@example
\key g \major;
@cindex key signature, setting
@cindex @code{\key}
This command changes the current key signature to G-major. Although this
-command comes after the @code{\time} command, in the output, the key
-signature comes before the time signature: LilyPond knows about music
+command comes after the @code{\time} command, the key signature comes
+before the time signature in the output; LilyPond knows about music
typesetting conventions.
+@separate
@example
\repeat "volta" 2
@end example
- This command tells LilyPond that the following piece of music must be
+ This command tells LilyPond that the following piece of music is
played twice. The first argument indicates the type of repeat. In this
-case, @code{"volta"} means that volta brackets are be used for
-alternatives---if there were any.
+case, @code{"volta"} means that prima volta/secunda volta brackets are
+used for the alternative endings---if there were any.
+@separate
@example
@{
The subject of the repeat is again sequential music. Since
@code{\sequential} is such a common construct, a shorthand is provided:
just leave off @code{\sequential}, and the result is the same.
+@separate
@example
d4
@end example
- This is a note with pitch @code{d} (determined up to octaves). The
+ This is a note with pitch @code{d} (determined up to the octave). The
relative music was started with a @code{c''}, so the real pitch of this
note is @code{d''}. A number designates the duration of the note, so
the @code{4} here represents a quarter note.
+@separate
@example
a b
These are notes with pitch @code{a} and @code{b}. Because their
duration is the same as the @code{g}, there is no need to enter the
duration, but you may enter it anyway, i.e., @code{a4 b4}
+@separate
@example
d4 g, g |
@cindex errors, finding
Three more notes. The @code{|} character is a `bar check'. When
processing the music, LilyPond will verify that bar checks are found at
-the start of a measure. This can help you track down errors.
+the start of a measure. This can help you track down typing errors.
@cindex alteration, chromatic
@cindex chromatic alteration
``Fis'' is the Dutch note name for ``F sharp''. However, there is no
sharp sign in the output. The program keeps track of key signatures,
and will only print accidentals if they are needed.
+@separate
@example
c8 d e fis
@end example
LilyPond guesses were beams can be added to eighth and shorter notes.
-In this case, a beam over 4 eighths is added.
+In this case, a beam is added over the 4 eights.
+@separate
@example
c4 d8( )c b a( )b4 c8 b a g |
The next line shows how to make a slur: the beginning and ending note
of the slur is marked with an opening and closing parenthesis
respectively. In the line shown above, this is done for two slurs.
-Slur markers (parentheses) are put between the slurred notes.
+Slur markers (parentheses) are entered between the slurred notes.
+@separate
@example
a4 [b8 a] [g fis]
@end example
Automatic beaming can be overridden by inserting beam marks
(brackets). Brackets are put around the notes you want beamed.
+@separate
@example
g2. |
@cindex augmentation dot
@cindex dot
A period adds an augmentation dot to the note.
+@separate
@example
@}
@end example
This ends the sequential music to be repeated. LilyPond will typeset
a repeat bar.
+@separate
@example
cis'4 b8 cis a4 |
@end example
- This line shows that Lily will print an accidental if that is
-needed: the first C sharp of the bar will be printed with an accidental,
+ This line shows that Lily will print an accidental if necessary:
+the first C sharp of the bar will be printed with an accidental,
the second one without.
+@separate
@example
a8-. b-. cis-. d-. e-. fis-.
@end example
@cindex articulation
-You can enter articulation signs either in a verbose form using a
+You can enter articulation signs either in a verbose form or using a
shorthand. Here we demonstrate the shorthand: it is formed by a dash
and the character for the articulation to use, e.g. @code{-.} for
staccato as shown above.
+@separate
@example
fis a, r8 cis8
@end example
Rests are denoted by the special notename @code{r}.
+@separate
@example
d2.-\fermata
identifier.
@cindex identifier
@cindex @code{\fermata}
+@separate
+@example
+ \bar "|.";
+@end example
+@separate
@example
-
@}
-
@end example
-
Here the music ends.
+
+@separate
@example
\paper @{
@}
@end example
-This specifies a conversion from music to notation output. Most of
-the details of this conversions (font sizes, dimensions, etc.) have
+This specifies how the entered music should be converted to notation
+output. Most of the details of the conversion (font sizes, dimensions,
+etc.) have
been taken care of, but to fit the output in this document, it has
-to be smaller. We do this by setting the line width to 14 centimeters
+to be narrower. We do this by setting the line width to 14 centimeters
(approximately 5.5 inches).
+@separate
@example
@}
@end lilypond
Again, we will dissect the file line by line.
+@separate
@example
\header @{
@code{\header} block. The information in this block is not used by
LilyPond, but it is passed into the output. @file{ly2dvi} uses this
information to print titles above the music.
+@separate
@example
title = "The river is flowing";
@end example
@cindex assignments
@cindex identifier assignment
-the @code{\header} block contains assignments. An assignment starts
-with a string. (which is unquoted, in this case). Then comes the
-equal sign. After the equal sign comes the expression you
-want to store. In this case, you want to put in strings. The
-information has to be quoted here, because it contains spaces. Each
-assignment is finished with a semicolon.
+the @code{\header} block contains assignments. In each assignment, a
+variable is set to a value. Lexically, both the variable name and the
+assigned value are strings. The values have to be quoted here, because
+they contain spaces, the variable names could also be put within quotes
+but it is not necessary. Each assignment is finished with a semicolon.
+@separate
@example
\include "paper16.ly"
@end example
Smaller size for inclusion in a book.
+@separate
@example
melody = \notes \relative c' @{
give names to the different parts of music, and use the names to
construct the music within the score block.
+@separate
@example
\partial 8;
@end example
@cindex @code{\partial}
@cindex anacrusis
The piece starts with an anacrusis of one eighth.
+@separate
@example
\key c \minor;
@end example
The key is C minor: we have three flats.
+@separate
@example
c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
@cindex automatic beaming, turning off
We use explicit beaming. Since this is a song, we turn automatic
beams off, and use explicit beaming where needed.
+@separate
@example
@}
@end example
This ends the definition of @code{melody}. Note that there are no
-semicolons after assignments at top level.
+semicolons after assignments at the top level.
+@separate
@example
text = \lyrics @{
notes. To make LilyPond parse words as syllables, switch it into
lyrics mode with @code{\lyrics}. Again, the brace after @code{\lyrics}
is a shorthand for @code{\sequential @{}.
+@separate
@example
The4 ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
@code{-}@code{-}. We enter the syllables as if they are all quarter notes
in length (hence the @code{4}), and use a feature to align the
syllables to the music, which obviously isn't all quarter notes.
+@separate
@example
accompaniment =\chords @{
@end example
@cindex chords
@cindex mode, chords
-We'll put chords over the music. To enter them, there is a special mode
+We'll put chords over the music. To enter them, there is a special mode
analogous to @code{\lyrics} and @code{\notes} mode, where you can give
-the names of the chords you want, instead of the notes comprising the
-chord.
+the names of the chords you want, instead of listing the notes
+comprising the chord.
+@separate
@example
r8
@end example
There is no accompaniment during the anacrusis.
+@separate
@example
c2:3- f:3-.7
@cindex modifier, chord
A chord is started by the tonic of the chord. The
first one lasts a half note. An unadorned note creates a major
-triad, while a minor triad is wanted. @code{3-} modifies the third to
-be small. @code{7} modifies (adds) a seventh, which is small by default
-to create the @code{f a c es} chord. Multiple modifiers must be
-separated by a dot.
+triad. Since a minor triad is wanted, @code{3-} is added to modify the
+third to be small. @code{7} modifies (adds) a seventh, which is small by
+default to create the @code{f a c es} chord. Multiple modifiers must be
+separated by dots.
+@separate
@example
d:min es4 c8:min r8
Some modifiers have predefined names, eg. @code{min} is the same as
@code{3-}, so @code{d-min} is a minor @code{d} chord.
+@separate
@example
c2:min f:min7 g:7^3.5 c:min @}
subtractions. Subtractions are started with a caret, and they are
also separated by dots. In this example, @code{g:7^3.5} produces a
minor seventh. The brace ends the sequential music.
+@separate
@example
\score @{
accompaniment have to sound at the same time, so they should be
@code{\simultaneous}.
@cindex @code{\simultaneous}
+@separate
@example
%\accompaniment
notation: they will be printed as note heads on a separate
staff. To print them as chords names, they have to be interpreted as
being chords, not notes. This is done with the following command:
+@separate
@example
\context ChordNames \accompaniment
We don't want that default here, because we want chord names. The
command above explicitly creates an interpretation context of
@code{ChordNames} type to interpret the music @code{\accompaniment}.
+@separate
@example
\addlyrics
@cindex lyrics and melody, combining
@cindex combining lyrics and melody
-The lyrics need to be aligned with the melody. This is done by
+The lyrics should be aligned with the melody. This is done by
combining both with @code{\addlyrics}. @code{\addlyrics} takes two
pieces of music (usually a melody and lyrics, in that order) and
aligns the syllables of the second piece under the notes of the
first piece. If you would reverse the order, the notes would be
aligned on the lyrics, which is not very useful, and looks
silly.
+@separate
@example
\context Staff = mel @{
accompaniment will be on a nameless staff. The melody has to be on a
different staff as the accompaniment. This is accomplished by giving
the melody staff a different name.
+@separate
@example
\property Staff.noAutoBeaming = ##t
@cindex \property
@cindex context variables
@cindex setting context variables
-An interpretation context has variables that tune its behaviour. One of
+An interpretation context has variables, called properties, that tune
+its behaviour. One of
the variables is @code{noAutoBeaming}. If set to @code{##t}, which is
the boolean value @var{true}, LilyPond will not try to put automatic beaming
on the current staff.
@cindex GUILE
@cindex Scheme
-@cindex accessinng Scheme
+@cindex accessing Scheme
@cindex evaluating Scheme
@cindex LISP
+@separate
@example
\property Staff.automaticMelismata = ##t
@cindex melismata
@cindex @code{\addlyrics} and slurs
Similarly, we don't want to print a syllable when there is
-a slur. This sets up @code{\addlyrics} to not put lyrics under notes
-while there is a slur.
+a slur. This sets up @code{\addlyrics} to not put lyrics under each
+separate note while there is a slur.
+@separate
@example
\melody
@code{\property} directives and @code{\melody} are grouped in sequential
music, so the property settings are done before the melody is
processed.
+@separate
@example
\context Lyrics \text
should not land on a Staff, but on a interpretation context for
syllables, extenders, hyphens etc. This context is called
Lyrics.
+@separate
@example
@}
@end example
This ends @code{\simultaneous}.
+@separate
@example
\midi @{ \tempo 4=72;@}
@end example
-MIDI (Musical Instrument Digitial Interface) is a standard for
+MIDI (Musical Instrument Digital Interface) is a standard for
connecting and recording digital instruments. So a MIDI file is like a
tape recording of an instrument. The @code{\midi} block causes makes the
music go to a MIDI file, so you can listen to the music you entered. It
is great for checking the music. Whenever you hear something weird, you
probably hear a typing error.
-Syntactally, @code{\midi} is similar to @code{\paper @{ @}}, since it
+Syntactically, @code{\midi} is similar to @code{\paper @{ @}}, since it
also specifies an output method. You can specify the tempo using the
@code{\tempo} command, in this case the tempo of quarter notes is set to
72 beats per minute.
+@separate
@example
\paper @{ linewidth = 10.0\cm; @}
some calculations, a @file{.tex} is produced. The contents
of this file are very low-level instructions.
-For example, the following file (@file{minatures.ly})
+For example, the following file (@file{miniatures.ly})
@example
\version "1.3.124";
@file{ly2dvi} runs it through LaTeX. LaTeX is a text-formatting system
built on top of @TeX{}. It's very popular in the academic world. If LaTeX
is successful, this will produce a @file{.dvi} file, containing both the
-titling and notes. @code{ly2dvi} completes its task by deleting the two
-temporary files, leaving only @file{miniatures.dvi}.
+titling and the actual music. @code{ly2dvi} completes its task by
+deleting the two temporary files, leaving only @file{miniatures.dvi}.
-Next, now we'll look at the examples line by line to explain new things.
+Next, now we'll look at the example line by line to explain new things.
+@separate
@example
\version "1.3.124";
@end example
is too old.
This version number is also used by the @code{convert-ly} program (See
-@ref{convert-ly}), which uses it update the file to the latest lily
+@ref{convert-ly}), which uses it to update the file to the latest lily
version.
+@separate
@example
\header @{ title = "Two miniatures"; @}
@end example
This sets the titling information for the entire file.
+@separate
@example
#(set! point-and-click line-column-location)
@end example
music on the screen. The point-and-click mechanism makes it easy to
find the origin of an error in the .ly file: when you view the file with
Xdvi and click on a note , your editor will jump to the spot where that
-note was entered. More information is in in @ref{Point and click}
+note was entered. More information is in @ref{Point and click}
+@separate
@example
\paper @{
@end example
paper block, at top-level, i.e. not in a @code{\score} block sets the
default page layout.
+@separate
@example
linewidth = -1.0; @}
@end example
score, and the spacing is set to natural length: a short phrase takes up
little space, a longer phrase more space.
+@separate
@example
\score @{
\notes @{ c'4 d'4 @}
(ie. composing) or by computer, absolute octaves are probably less work.
+@separate
@example
\header @{
@end example
The @code{\header} is normally at the top of the file, where it sets
values for the rest of the file. If you want to typeset different pieces
from one file (for example, if there are multiple movements, or if
-you're making a excercise book), you can put different @code{\score}
+you're making an exercise book), you can put different @code{\score}
blocks into the input file. ly2dvi will assemble all LilyPond output
files into a big document. The contents of \header blocks specified
within each score, are used for the titling of each movement.
+@separate
@example
opus = "Opus 1.";
piece = "Up"; @}
oboes = \notes \relative c'' \context Voice = oboe {
\stemUp s4 g8. b,16 c8 r <e'8.^\p g> <f16 a>
- \grace <e8( g> <d4 f> <c2 e> \times 2/3 { <d8 \< f> <e g> <f a> }
+ \grace <e8( g> <d4 )f> <c2 e> \times 2/3 { <d8 \< f> <e g> <f a> }
<
{ \times 2/3 { a8 g c } \! c2 }
\context Voice = oboeTwo {
}
hoomPah = \repeat unfold 8
- \notes \transpose c' { \stemUp c8 \stemBoth \stemDown c'8 \stemBoth }
+ \notes \transpose c' { \stemUp c8 \stemBoth \stemDown c'8 \stemBoth }
bassvoices = \notes \relative c' {
c4 g8. b,16
If it looks like incomprehensible gibberish to you, then you are right.
This example has been doctored to have as many quirks as possible.
+@separate
@example
stemDown = \property Voice.Stem \override #'direction = #-1
@end example
grob, etc. The initial values of these settings are set in the Scheme
file @file{scm/grob-description.scm}.
-This statement adds a the setting for all Stem grobs in the current
+This statement adds a setting for all Stem grobs in the current
Voice: @code{direction} is set to @code{-1}, which encodes down. The
setting remains in effect until it is reverted.
+@separate
@example
\property Voice.Stem \revert #'direction
@end example
LilyPond includes the identifiers @code{\stemUp}, @code{\stemDown} along
-with some more often used formatting instructions, but to explain how it
-works, we wrote our own here. Of course, you should use predefined
+with some other commonly used formatting instructions, but to explain how
+it works, we wrote our own here. Of course, you should use predefined
identifiers like these if possible: then you will be affected less by
the implementation changes we occasionally make.
+@separate
@example
viola = \notes \relative c' \context Voice = viola @{
@end example
precisely one @code{Voice} context, so we give it an unique name
(`@code{viola}').
+@separate
@example
<c4-\f-\arpeggio g' c>
@end example
@code{\arpeggio} draws an vertical wavy line before the chord,
signifying an arpeggio.
+@separate
@example
\stemDown
@end example
+@separate
@example
g'8. b,16
@end example
the @code{g} gets an octave up quote: it is a fifth above the starting
note of the previous chord (the central C).
+@separate
@example
s1 s2. r4
@end example
temporarily don't play. In this case, the viola doesn't come until one
and a half measure later.
+@separate
@example
oboes = \notes \relative c'' \context Voice = oboe @{
@end example
print the notes as one voice that makes chords. Again, we insure that
these notes are indeed processed by precisely one context with
@code{\context}.
+@separate
@example
\stemUp s4 g8. b,16 c8 r <e'8.-\p g> <f16 a>
@end example
@code{\stemUp} is a reference to the @code{\property \override} command
defined above.
+@separate
@example
\grace <e8 g> < d4 f> <c2 e>
@end example
will be attached to the next note.@footnote{LilyPond will squirm
about unended Slurs. In this case, you can ignore the warning}.
@end ignore
+@separate
@example
\times 2/3
@end example
arguments: a fraction and a piece of music. The duration of the piece
of music is multiplied by the fraction. Triplets make notes occupy 2/3
of their notated duration, so in this case the fraction is 2/3.
+@separate
@example
@{ <d8 \< f> <e g> <f a> @}
@end example
@cindex crescendo
@cindex @code{\<}
+@separate
@example
<
@end example
different parts. We can't use a sequence of chords to enter this, so
we make a `chord' of sequences to do it. We start with the upper
voice, which continues with upward stems:
+@separate
@example
@{ \times 2/3 @{ a8 g c @} \! c2 @}
@end example
The crescendo is ended at the half note by the escaped exclamation
mark @code{\!}.
+@separate
@example
\context Voice = oboeTwo @{
\stemDown
We can't share stems with the other voice, so we have to create a new
@code{Voice} context. We give it the name @code{oboeTwo} to distinguish
it from the other context. Stems go down in this voice.
+@separate
@example
\grace @{
@end example
etc. Here we fiddle with a property and make a beam. The argument of
@code{\grace} is sequential music.
+@separate
@example
\property Grace.Stem \override #'direction = #-1
[f,16 g] @}
As far as relative mode is concerned, the previous note is the
@code{c'''2} of the upper voice, so we have to go an octave down for
the @code{f}.
+@separate
@example
f8 e e2
@} >
@end example
This ends the two-part section.
+@separate
@example
\stemBoth
\grace <c,8( e> <)b8. d8.-\trill> <c16 e> |
The bass has a little hoom-pah melody to demonstrate parts switching
between staffs. Since it is repetitive, we use repeats:
+@separate
@example
hoomPah = \repeat unfold 8
@end example
@cindex unfolded @code{\repeat}
The unfolded repeat prints the notes in its argument as if they were
-written out in full.
+written out in full eight times.
+@separate
@example
\notes \transpose c' @{
@end example
Transposing can be done with @code{\transpose}. It takes two arguments;
the first specifies what central C should be transposed to. The second
is the to-be-transposed music. As you can see, in this case, the
-transposition has no effect, as central C stay at central C.
+transposition has no effect, as central C stays at central C.
The purpose of this no-op is circumventing relative mode. Relative mode
can not be used together with transposition, so @code{\relative} will
leave the contents of @code{\hoomPah} alone. We can use it without
having to worry about getting the motive in a wrong octave.
+@separate
@example
bassvoices = \notes \relative c' @{
c4 g8. b,16
@code{\autochange}. This command looks at the pitch of each note, and if
necessary, will cross to the other staff. For this to work, the two
staffs must be called @code{"up"} and @code{"down"}.
+@separate
@example
\translator Staff = down
@end example
staff switch here.
+@separate
@example
\context Voice = reallyLow @{\stemDown g2 ~ | g4 c8 @} >
@end example
note heads of the same pitch, whereas a slur can connect many chords
with one curve.
+@separate
@example
\context PianoStaff
@end example
A special context is needed to get cross staff beaming right. This
context is called @code{PianoStaff}.
+@separate
@example
\context Staff = bottom < \time 2/2; \clef bass;
@end example
The bottom staff must have a different clef.
+@separate
@example
indent = 0.0;
@end example
Things to note here are the definition of @code{\global} where we define
the time signature, and set the end bar. And the separate definition of
-@code{\Key} that we will use all staffs except staffs for transposing
+@code{\Key} that we will use for all staffs except those for transposing
instruments.
The second file, @file{os-score.ly} reads the definitions of the first
@lilypondfile{os-score.ly}
-First, we need to include the music definitions we made in
-@file{os-music.ly}.
+@separate
@example
\include "os-music.ly";
@end example
+First, we need to include the music definitions we made in
+@file{os-music.ly}.
-In a large orchestral score like this you're bound to make some small
-mistakes, so we enable point and click (See @ref{Point and click})
-editing.
+@separate
@example
#(set! point-and-click line-column-location)
@end example
+In a large orchestral score like this you're bound to make some small
+mistakes, so we enable point and click (See @ref{Point and click})
+editing.
-[what is markup text?]
-
-We need a flat sign in text to name the tuning of the french horn, so we
-predefine it with bit of scheme markup text (See @ref{Text markup}).
+@separate
@example
#(define text-flat '((font-relative-size . -2)
(music "accidentals--1")))
@end example
+[FIXME: what is markup text?]
-Of course, all staffs are simultaneous and use the same global settings.
+We need a flat sign in text to name the tuning of the french horn, so we
+predefine it with bit of scheme markup text (See @ref{Text markup}).
+
+@separate
@example
<
\global
@end example
+Of course, all staffs are simultaneous and use the same global settings.
-Then, we start a new staff group for the woodwind section (just the
-flutes in this case). Immediately after that, we start the staff for
-the two flutes, that also play simultaneously.
+@separate
@example
\context StaffGroup = woodwind <
\context Staff = flauti <
@end example
+Then, we start a new staff group for the woodwind section (just the
+flutes in this case). Immediately after that, we start the staff for
+the two flutes, that also play simultaneously.
-We specify the intrument for MIDI output (see @ref{MIDI instrument
-names}).
+@separate
@example
\property Staff.midiInstrument = #"flute"
@end example
+We specify the instrument for MIDI output (see @ref{MIDI instrument
+names}).
-And define the intrument names to be printed in the margin,
-@code{instrument} for the first line of the score, @code{instr} for the
-rest of the score.
+@separate
@example
\property Staff.instrument = "2 Flauti"
\property Staff.instr = "Fl."
@end example
+And define the instrument names to be printed in the margin,
+@code{instrument} for the first line of the score, @code{instr} for the
+rest of the score.
-The flutes play in the default key.
+@separate
@example
\Key
@end example
+The flutes play in the default key.
+@separate
+@example
+ \context Voice=one @{ \voiceOne \flautoI @}
+ \context Voice=two @{ \voiceTwo \flautoII @}
+@end example
Last come the actual flute parts. Remember that we're still in
simultaneous mode. We name both voices differently, so that LilyPond
will actually create two Voice contexts. The flute parts are simple, so
we specify manually which voice is which: @code{\voiceOne} forces the
direction of stems, beams, slurs and ties up, @code{\voiceTwo} sets
directions down.
-@example
- \context Voice=one @{ \voiceOne \flautoI @}
- \context Voice=two @{ \voiceTwo \flautoII @}
-@end example
-We close the flutes staff and woodwind staff group.
+@separate
@example
>
>
@end example
+We close the flutes staff and woodwind staff group.
-The timpani staff only shows a new piece of scheme markup, it sets two
-lines of text.
+@separate
@example
\property Staff.instrument = #'(lines "Timpani" "(C-G)")
@end example
+The timpani staff only shows a new piece of scheme markup, it sets two
+lines of text.
-[what is thread, why is distinction thread/voice necessary?]
+@separate
+@example
+ \context Voice=one \partcombine Voice
+ \context Thread=one \tromboI
+ \context Thread=two \tromboII
+@end example
+[FIXME: what is thread, why is distinction thread/voice necessary?]
-for the trumpets we use the automatic part combiner (see @ref{Automatic
+For the trumpets we use the automatic part combiner (see @ref{Automatic
part combining}) to combine the two simultaneous trumpet parts onto the
trumpet staff. Each trumpet gets its own Thread context, which must be
named @code{one} and @code{two}). The part combiner makes these two
threads share a Voice when they're similar, and splits the threads up
when they're different.
+
+@separate
@example
- \context Voice=one \partcombine Voice
- \context Thread=one \tromboI
- \context Thread=two \tromboII
+ \property Staff.instrument = #`(lines "Corno"
+ (rows "(E" ,text-flat ")"))
@end example
-
The french horn has the most complex scheme markup name, made up of two
lines of text. The second line has two elements (rows), the @code{E}
and the flat sign @code{text-flat} that we defined before.
+
+@separate
@example
- \property Staff.instrument = #`(lines "Corno"
- (rows "(E" ,text-flat ")"))
+ \property Staff.transposing = #3
@end example
-
The french horn is to be tuned in E-flat, so we tell the MIDI backend to
transpose this staff by three steps.
-[note how we can choose different tuning for entering, printing and
+[FIXME: note how we can choose different tuning for entering, printing and
playing, using \transpose and transposing.]
-@example
- \property Staff.transposing = #3
-@end example
-
-Therefore, it has a different key.
+@separate
@example
\notes \key bes \major;
@end example
+Therefore, it has a different key.
-We specify a big indent for the first line and a small linewith for this
-tuturial.
+@separate
@example
indent = 15 * \staffspace;
linewidth = 60 * \staffspace;
@end example
+We specify a big indent for the first line and a small linewidth for this
+tutorial.
-[explain about overriding contexts.]
-
-Because we have a Thread representing one instrument, we need to move
-the @code{Rest_engraver} from Voice to Thread level. Similarly, we need
-to move the @code{Multi_measure_rest_engraver} from Staff to Voice
-level.
-
-[todo: should put Rest_engraver in threadcontext by default.]
-
+@separate
@example
\translator@{
\ThreadContext
\consists "Bar_engraver";
@}
@end example
+[FIXME: explain about overriding contexts.]
-In orchestral scores, it often happens that one instrument has only
-rests during one line of the score. The @code{HaraKiriStaffContext} can
-be used as a regular @code{StaffContext} drop-in and will take care of
-the automatic removing of empty staffs.
+Because we have a Thread representing one instrument, we need to move
+the @code{Rest_engraver} from Voice to Thread level. Similarly, we need
+to move the @code{Multi_measure_rest_engraver} from Staff to Voice
+level.
+
+[FIXME: should put Rest_engraver in threadcontext by default.]
+
+@separate
@example
\translator@{
\HaraKiriStaffContext
\remove "Bar_engraver";
@}
@end example
-
-We want bar numbering at score level and want to move the bar number a
-few staff spaces up.
+In orchestral scores, it often happens that one instrument has only
+rests during one line of the score. The @code{HaraKiriStaffContext} can
+be used as a regular @code{StaffContext} drop-in and will take care of
+the automatic removing of empty staffs.
@ignore
[note how you can use \override in \translator]
@end ignore
+@separate
@example
\translator @{
\OrchestralScoreContext
BarNumber \override #'padding = #3
@}
@end example
+FIXME: use \property Score.BarNumber
+
+We want bar numbering at score level and want to move the bar number a
+few staff spaces up.
+
@node Part extraction
@section Part extraction
linewidth = 80 * \staffspace;
textheight = 200 * \staffspace;
\translator @{
- \OrchestralScoreContext %%%%junkme
+ \OrchestralScoreContext %%%%FIXME
skipBars = ##t
@}
@}
the second flute. This then is the part for the second flute player.
Of course, we make separate parts for all individual instruments.
-In this individual part the second flute has a whole staff for itself,
-so we don't want to force stem or tie directions.
+@separate
@example
\flautoII
@end example
+In this individual part the second flute has a whole staff for itself,
+so we don't want to force stem or tie directions.
-The @code{\header} definitions were also read from @file{os-music.ly},
-but we need to set the instrument for this particular score.
+@separate
@example
\header @{
instrument = "Flauto II";
@}
@end example
+The @code{\header} definitions were also read from @file{os-music.ly},
+but we need to set the instrument for this particular score.
-In the conductor's full score, all bars with rests are printed, but for
-the individual parts, we want to contract pieces of consecutive empty
-bars.
+@separate
@example
skipBars = ##t
@end example
+In the conductor's full score, all bars with rests are printed, but for
+the individual parts, we want to contract pieces of consecutive empty
+bars.
-[Waarom moet skipBars in \translator, waarom niet \property Score.skipBars]
+[FIXME: Waarom moet skipBars in \translator, waarom niet \property
+Score.skipBars]
@end example
The actual values for linewidth will differ depending on papersize and
number of columns. Also, if you use a different fontsize for the
-music, another file than @code{paper16.ly} will be included.
+music, another file than @code{paper16.ly} should be included.
If you want to make the music not so wide, you can insert a
-@code{\paper} statement that set the linewidth:
+@code{\paper} statement to set the linewidth:
@lilypond[veryverbatim, intertext="produces this music:"]
\score{
@subsection More options
@itemize
-@item The @code{singleline} option set @code{linewidth} to -1.0.
-@item The @code{multiline} option set @code{linewidth} to a value letting
+@item The @code{singleline} option sets @code{linewidth} to -1.0.
+@item The @code{multiline} option sets @code{linewidth} to a value letting
the music be aligned to the right margin. The music can span several
lines.
@end itemize
beginning of the fantastic street opera ``Houdini the Great'', by the
Danish composer Andy Pape. The music is put inside a
@code{floatingfigure} environment, and the music will be aligned by
-the right marging if you set floatingfigure width and lilypond linewidth
+the right margin if you set floatingfigure width and lilypond linewidth
to the same value. The code looks like this:
@lilypond[verbatim]
lines where you have music printed with the smallest font size.
Lilypond-book does know about @code{\onecolumn} and @code{\twocolumn}.
-So the music will be adjusted to the new linewith:
+So the music will be adjusted to the new linewidth:
Verbatim environments will also ignore the page margins. That is
a feature of La@TeX{}. (But you usually put things inside a verbatim
That's all folks. From here, you can either try fiddling with input
files, or you can read the reference manual. You can find more example
-files in @file{input} and @file{input/test}. You can also look at Real
-Music (TM), have a look at the @ref{Mutopia project}.
+files in @file{input} and @file{input/test}. You can also look at some
+Real Music (TM), have a look at the @ref{Mutopia project}.
If you have a big music project, or just a lot of LilyPond input files,
all generated output from LilyPond, @TeX{} and metafont will clutter
your working directory. LilyPond comes with a one-size-fits-all
-pre-cooked makefile that helps you manage producing ouptut. It will
-produce all output in @file{out}, generate and track dependencies.
-Also, it helps in preparing your submission to the @ref{Mutopia
+pre-cooked makefile that helps you manage producing output. It will
+produce all output in the directory @file{out} , generate and track
+dependencies. Also, it helps in preparing your submission to @ref{Mutopia
project}.
@file{make/ly.make}