@node Tutorial
@chapter Tutorial
-@html
-<!--- @@WEB-TITLE@@=Tutorial --->
-@end html
Using LilyPond comes down to encoding music in an input file. After
* Running LilyPond:: Printing music.
* More about pitches and accidentals::
* Octave entry::
-* Relative octave entry::
* Combining music into compound expressions::
* Adding articulation marks to notes::
* Combining notes into chords::
* Listening to output::
* Titling::
* Single staff polyphony::
-* Piano staffs::
+* Piano staves::
* Setting variables::
* Fine tuning layout::
* Organizing larger pieces::
@cindex Viewing music
@cindex xdvi
-The result of the ly2dvi is the file @file{test.pdf}.@footnote{ For
-@TeX{} afficionados, there is also a (@file{test.dvi}) file. It can be
+The result of the ly2dvi is the file @file{test.pdf}.@footnote{For
+@TeX{} afficionados, there is also a @file{test.dvi} file. It can be
viewed with @code{xdvi}. The DVI uses a lot of PostScript specials,
which do not show up in the magnifying glass. The specials also mean
that the DVI file cannot be processed with @code{dvilj}. Use
@cindex DVI driver
} One of the following commands should put the PDF on your
screen:
-@c eeek
@quotation
@example
gv test.pdf
xpdf test.pdf
gpdf test.pdf
acroread test.pdf
+ gsview32 test.pdf
@end example
@end quotation
If the music on your screen looks good, you can print it by clicking
@cindex PDF
-On Windows, the terminal is started by clicking on the LilyPond or
-Cygwin icon. Any text editor (such as NotePad, Emacs or Vim) may be
-used to edit the LilyPond file. If you have a PDF viewer installed,
-use that for viewing the PDF
-@c where on file system for double-click people?
-If you have no viewer, then you can download @code{GSView} from
-@uref{http://www.cs.wisc.edu/~ghost}. With @code{GSView},
-the PDF file can viewed with
-@quotation
-@example
-@code{gsview32 test.pdf}
-@end example
-@end quotation
-Printing may be done with
-@quotation
-@example
-@code{gsview32 /s test.pdf}
-@end example
-@end quotation
+On Windows, the same procedure should work, the terminal is started by
+clicking on the LilyPond or Cygwin icon. Any text editor (such as
+NotePad, Emacs or Vim) may be used to edit the LilyPond file.
-The commands for formatting and printing music are detailed in
-@ref{Invoking LilyPond}.
+To view the PDF file, try the following:
+@itemize
+@item
+If your system has a PDF viewer installed, open
+@file{C:\Cygwin\home\@var{your-name}} in the explorer and double-click
+@file{test.pdf}.
+@item
+If you prefer the keyboard, you can also try the list of commands
+shown before. If none work, go to
+@uref{http://www.cs.wisc.edu/~ghost/} to install the proper software.
+@end itemize
+
+The commands for formatting and printing music on all platforms are
+detailed in @ref{Invoking LilyPond}.
@node More about pitches and accidentals
@section More about pitches and accidentals
it possible to use different conventions for when to print
accidentals.
+@cindex beams, by hand
+Beams are drawn automatically, but if you do not like where they are
+put, they can be entered by hand. Mark the first note to be beamed
+with @code{[} and the last one with @code{]}:
+@quotation
+@lilypond[fragment,relative 1, verbatim]
+a8[ ais] d[ es r d]
+@end lilypond
+@end quotation
+@separate
+
+Rests are described in full detail in @ref{Rests}.
+
+The notation manual discusses ties in @ref{Ties}.
+
+
@node Octave entry
@section Octave entry
-@node Relative octave entry
-@section Relative octave entry
-
-@c lousy example
-@c ? --hwn
-@c fragment of 1st hrn in Adams' The Chairman Dances, with creative
-@c chromatic thing pasted in front. (admittedly the original does not
-@c have a phrasing slur. The problem is that we do not want the slur
-@c and the Phrasing slur to collide. We are trying to make a good
-@c impression here.
-@quotation
-@lilypond[fragment,relative 1, verbatim]
-a8-(-\( ais b c-) cis2 b'2 a4 cis, c-\)
-@end lilypond
-@end quotation
-@separate
-
-@cindex beams, by hand
-Beams are drawn automatically, but if you do not like where they are
-put, they can be entered by hand. Mark the first note to be beamed
-with @code{[} and the last one with @code{]}:
-@quotation
-@lilypond[fragment,relative 1, verbatim]
-a8-[ ais-] d-[ es r d-]
-@end lilypond
-@end quotation
-@separate
-
-Rests are described in full detail in @ref{Rests}.
-
-The notation manual discusses ties in @ref{Ties}.
@quotation
@lilypond[fragment,verbatim]
\simultaneous {
- \context Staff = staffA { \clef violin c'' }
- \context Staff = staffB { \clef bass c }
+ \new Staff { \clef violin c'' }
+ \new Staff { \clef bass c }
}
@end lilypond
@end quotation
@lilypond[verbatim,singleline]
\score {
\notes
- < \context Staff = staffA {
+ < \new Staff {
\time 3/4
\clef violin
\relative c'' {
- e2-( d4 c2 b4 a8-[ a-]
- b-[ b-] g-[ g-] a2.-) }
+ e2( d4 c2 b4 a8[ a]
+ b[ b] g[ g] a2.) }
}
- \context Staff = staffB {
+ \new Staff {
\clef bass
c2 e4 g2.
f4 e d c2.
Dynamic signs are made by adding the markings to the note:
@quotation
@lilypond[verbatim,relative 1]
-c-\ff c-\mf
+c\ff c\mf
@end lilypond
@end quotation
@separate
is attached to:
@quotation
@lilypond[verbatim,relative 1]
-c2-\< c2-\!-\ff c2-\> c2-\!
+c2\< c2\!\ff c2\> c2\!
@end lilypond
@end quotation
@separate
@quotation
@lilypond[fragment,relative 1, verbatim]
-d4-( c16-)-( cis d e c cis d e-)-( d4-)
+d4( c16)( cis d e c cis d e)( d4)
@end lilypond
@end quotation
@separate
pitch. Slurs indicate the articulations of notes, and can be used on
larger groups of notes. Slurs and ties are also nested in practice:
@lilypond[fragment, relative=1]
-c2-~-( c8 fis fis4 ~ fis2 g2-)
+c2-~( c8 fis fis4 ~ fis2 g2)
@end lilypond
@cindex phrasing slurs
phrasing), you can also make a phrasing slur with @code{\(} and
@code{\)}.
+@quotation
+@lilypond[fragment,relative 1, verbatim]
+a8(\( ais b c) cis2 b'2 a4 cis, c\)
+@end lilypond
+@end quotation
+
+
More information on fingering, articulation, slurs, phrasing slurs,
and dynamics can be found in @ref{Fingering instructions},
@ref{Articulations}, @ref{Slurs}, @ref{Phrasing slurs}, and @ref{Dynamics},
must be placed outside the chord markers:
@quotation
@lilypond[relative 0, fragment,verbatim]
-r4 <<c e g>>8-[ <<c f a>>-]-~ <<c f a>>
+r4 <<c e g>>8[ <<c f a>>]-~ <<c f a>>
@end lilypond
@end quotation
@quotation
@example
-r4 <<c e g>>8-\>-( <<c e g>> <<c e g>> <<c f a>>8-\!-)
+r4 <<c e g>>8\>( <<c e g>> <<c e g>> <<c f a>>8\!)
@end example
@lilypond[relative 0, fragment]
\slurUp
-r4 <<c e g>>8-\>-( <<c e g>> <<c e g>> <<c f a>>8-\!-)
+r4 <<c e g>>8\>( <<c e g>> <<c e g>> <<c f a>>8\!)
@end lilypond
@end quotation
@separate
Grace notes are also made by prefixing a note, or a set of notes with
a keyword. In this case, the keyword is @code{\grace}:
@lilypond[relative 1, verbatim,fragment]
- c4 \grace b16-( c4-)
- \grace { d16-( e } d4-)
+ c4 \grace b16( c4)
+ \grace { d16( e } d4)
@end lilypond
@noindent
@lilypond[fragment,relative=1]
\partial 8
c8
- \times 2/3 { f4 g g } \times 2/3 { g4-( a2-) }
+ \times 2/3 { f4 g g } \times 2/3 { g4( a2) }
@end lilypond
The lyrics can be set to these notes, combining both with the
\relative c' {
\partial 8
c8
- \times 2/3 { f g g } \times 2/3 { g4-( a2-) }
+ \times 2/3 { f g g } \times 2/3 { g4( a2) }
}
\context Lyrics \lyrics { I want to break free }
}
\relative c' {
\partial 8
c8
- \times 2/3 { f g g } \times 2/3 { g4-( a2-) }
+ \times 2/3 { f g g } \times 2/3 { g4( a2) }
%% ugh, this is to deal with bugs in the extender implementation
\hideNotes
\notes \relative c' {
\partial 8
c8
- \times 2/3 { f g g } \times 2/3 { g4-( a2-) } }
+ \times 2/3 { f g g } \times 2/3 { g4( a2) } }
\context Lyrics \lyrics { I want to break free __ }
>
\paper{ raggedright = ##t }
the musical transcription.
@code{\midi} can be used in similarly to @code{\paper @{ @}}, for
-example
+example,
@example
\score @{
@var{..music..}
When the file is processed by @code{ly2dvi}, the title and composer
specified are printed above the music. The `tagline' is a short line
-printed at bottom of the last page, which normally says ``Lily was
-here, version @dots{}''. In the example above, it is replaced by the
+printed at bottom of the last page, which normally says ``Engraved
+by LilyPond, version @dots{}''. In the example above, it is replaced by the
line ``small is beautiful''.
Normally, the @code{\header} is put at the top of the file. However,
@lilypond[fragment]
<
- \context Staff = staffA
+ \new Staff
\relative c''
< { a4 g2 f4-~ f4 } \\
{ s4 g4 f2 f4 } >
- \context Staff = staffB
+ \new Staff
< { \clef bass <<c g>>1 } \\
{ f4 d e2 }
>
More features of polyphonic typesetting are in the notation manual
in @ref{Polyphony}.
-@node Piano staffs
-@section Piano staffs
+@node Piano staves
+@section Piano staves
@cindex staff switch, manual
@cindex cross staff voice, manual
@cindex @code{\translator}
-Piano music is always typeset in two staffs connected by a brace.
+Piano music is always typeset in two staves connected by a brace.
Printing such a staff is done similar to the polyphonic example in
@ref{Combining music into compound expressions}:
@example
- < \context Staff = up @{ @dots{} @}
- \context Staff = down @{ @dots{} @}
+ < \new Staff @{ @dots{} @}
+ \new Staff @{ @dots{} @}
>
@end example
but now this entire expression must be interpreted as a
@lilypond[relative 0,fragment]
\context PianoStaff
- < \context Staff = up { \time 2/4
+ < \new Staff { \time 2/4
c4 c g' g }
- \context Staff = down {
+ \new Staff {
\clef bass c,, c' e c }
>
@end lilypond
used to apply generic tweaks. We mention a couple of these:
@itemize @bullet
-@cindex @code{extra-offset}
@item The @code{extra-offset} property, which
+@cindex @code{extra-offset}
has a pair of numbers as value, moves around objects in the printout.
The first number controls left-right movement; a positive number will
move the object to the right. The second number controls up-down
\once \property Voice.Stem \set #'transparent = ##t
b8~ b8
} \\ {
- b-[ g8-]
+ b[ g8]
} >
@end lilypond
@item
The @code{padding} property for objects with
+@cindex @code{padding}
@code{side-position-interface} can be set to increase distance between
symbols that are printed above or below notes. We only give an
example; a more elaborate explanation is in @ref{Constructing a
tweak}:
@lilypond[relative 1]
- c2-\fermata
+ c2\fermata
\property Voice.Script \set #'padding = #3
- b2-\fermata
+ b2\fermata
@end lilypond
@end itemize
@end example
The @code{\include} command substitutes the contents of the file at
this position in the file, so that @code{hornNotes} is defined
-afterwards. Since the horn is tuned in F, the @code{\transpose}
-command is used. The code @code{\transpose c' f} indicates that the
+afterwards. The code @code{\transpose f c'} indicates that the
argument, being @code{\hornNotes}, should be transposed by a fifth
-downwards: the @code{c'} becomes a @code{f}. The transposition can be
-seen in the following output:
+downwards: sounding @code{f} is denoted by notated @code{c'}, which
+corresponds with tuning of a normal French Horn in F. The
+transposition can be seen in the following output:
@lilypond[singleline]
\score {
- \notes \transpose c' f \notes \relative c' {
+ \notes \transpose f c' \notes \relative c {
\time 2/4
r4 f8 a cis4 f e d
}
following result:
@lilypond[singleline]
-\score {\notes { \transpose c' f \relative c' { \time 2/4
+\score {\notes { \transpose f c' \relative c { \time 2/4
\property Score.skipBars = ##t
R2*3
r4 f8 a cis4 f e d } }}
\score @{
\simultaneous @{
- \context Staff = hornStaff \hornNotes
- \context Staff = bsnStaff \bassoonNotes
+ \new Staff \hornNotes
+ \new Staff \bassoonNotes
@} @}
@end example
@lilypond[singleline]
\score {
\notes \relative c \simultaneous {
- \context Staff = hornStaff { \time 2/4
+ \new Staff { \time 2/4
R2*3
r4 f8 a cis4 f e d }
- \context Staff = fagStaff { \clef bass
+ \new Staff { \clef bass
r4 d,8 f | gis4 c | b bes |
a8 e f4 | g d | gis f }
} }