]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/learning/tutorial.itely
lilypond-manuals.css: edit color scheme and some spacing
[lilypond.git] / Documentation / learning / tutorial.itely
index ed064c6dd020bbd54b8f81b853ff4e9c22ae8c46..27084f32eab12e95ac29cef38e2cda32ea92edcc 100644 (file)
@@ -10,7 +10,7 @@
 
 @include included/generating-output.itexi
 
-@c \version "2.13.36"
+@c \version "2.19.21"
 
 @node Tutorial
 @chapter Tutorial
@@ -45,6 +45,10 @@ LilyPond input files (written by you) to produce output files.
 @cindex example, first
 @cindex case sensitive
 
+@menu
+* Producing output::
+@end menu
+
 @qq{Compiling} is the term used for processing an input file in
 LilyPond format to produce output file(s).  Output files are
 generally PDF (for printing or viewing), MIDI (for playing), and
@@ -83,7 +87,8 @@ produce an error message.
 
 @smallspace
 
-@subheading Producing output
+@node Producing output
+@unnumberedsubsubsec Producing output
 
 @cindex PDF file
 @cindex viewing music
@@ -165,6 +170,16 @@ started writing input files.
 @cindex simple notation
 @cindex notation, simple
 
+@menu
+* Pitches::
+* Durations (rhythms)::
+* Rests::
+* Time signature::
+* Tempo marks::
+* Clef::
+* All together::
+@end menu
+
 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.
@@ -180,7 +195,8 @@ This behavior may be altered, but in most cases these automatic
 values are useful.
 
 
-@subheading Pitches
+@node Pitches
+@unnumberedsubsubsec Pitches
 
 @cindex pitches
 @cindex relative mode
@@ -190,7 +206,6 @@ values are useful.
 @cindex relative mode, and accidentals
 
 @funindex \relative
-@funindex relative
 @funindex '
 @funindex ,
 
@@ -198,6 +213,16 @@ Music Glossary: @rglos{pitch}, @rglos{interval},
 @rglos{scale}, @rglos{middle C}, @rglos{octave},
 @rglos{accidental}.
 
+LilyPond uses lower-case letters for pitches.  The letters
+@code{c} through@tie{}@code{b} denote pitches in the
+@q{small octave} below @notation{middle C}.  Added @code{'}
+or@tie{}@code{,} suffixes indicate higher or lower octaves.
+Here is a scale starting on @notation{middle C}, and an arpeggio:
+
+@lilypond[verbatim,quote]
+{ c' d' e' f' g' a' b' c'' g c' e' g' c'' e'' g'' c''' }
+@end lilypond
+
 The easiest way to enter notes is by using @code{\relative} mode.
 In this mode, the octave is chosen automatically by assuming the
 following note is always to be placed closest to the previous
@@ -207,40 +232,37 @@ elementary piece of music, a @notation{scale}, in which every note
 is within just one staff space of the previous note.
 
 @lilypond[verbatim,quote]
-% set the starting point to middle C
-\relative c' {
-  c d e f
+\relative {
+  c' d e f
   g a b c
 }
 @end lilypond
 
-The initial note is @notation{middle C}.  Each successive note is
+The initial note is @notation{middle C}, denoted by @code{c'}.
+Each successive note is
 placed closest to the previous note -- in other words, the first
 @code{c} is the closest C to middle C.  This is followed by the
 closest D to the previous note.  We can create melodies which have
 larger intervals, still using only @code{\relative} mode:
 
 @lilypond[verbatim,quote]
-\relative c' {
-  d f a g
+\relative {
+  d' f a g
   c b f d
 }
 @end lilypond
 
 @noindent
-It is not necessary for the first note of the melody to start on
-the note which specifies the starting pitch.  In the previous
-example, the first note -- the @code{d} -- is the closest D to
-middle C.
+In the previous example, the first note -- the @code{d'} with one
+@code{'}-mark -- is the D in the octave starting from middle C
+and going up to B.
 
 By adding (or removing) quotes @code{'} or commas @code{,} from
-the @q{@w{@code{@bs{}relative c'}}} command, we can change the
-starting octave:
+the first note, we can change the starting octave:
 
 @lilypond[verbatim,quote]
-% one octave above middle C
-\relative c'' {
-  e c a c
+\relative {
+  e'' c a c
 }
 @end lilypond
 
@@ -253,8 +275,8 @@ if the note following a B is a C, D or E it will be assumed to be
 above the B, and an A, G or F will be assumed to be below.
 
 @lilypond[verbatim,quote]
-\relative c'' {
-  b c  % c is 1 staff space up, so is the c above
+\relative {
+  b' c % c is 1 staff space up, so is the c above
   b d  % d is 2 up or 5 down, so is the d above
   b e  % e is 3 up or 4 down, so is the e above
   b a  % a is 6 up or 1 down, so is the a below
@@ -275,8 +297,8 @@ apostrophe) to the note name.  We can lower the octave by adding a
 comma @code{,} to the note name.
 
 @lilypond[verbatim,quote]
-\relative c'' {
-  a a, c' f,
+\relative {
+  a' a, c' f,
   g g'' a,, f'
 }
 @end lilypond
@@ -287,7 +309,8 @@ To change a note by two (or more!) octaves, we use multiple
 quotes @code{''} and not one double quote @code{"}@tie{}!
 @c " - keeps quotes in order for context-sensitive editor -td
 
-@subheading Durations (rhythms)
+@node Durations (rhythms)
+@unnumberedsubsubsec Durations (rhythms)
 
 @cindex note durations
 @cindex durations
@@ -312,8 +335,8 @@ for the next note.  The duration of the first note defaults to a
 quarter note.
 
 @lilypond[verbatim,quote]
-\relative c'' {
-  a1
+\relative {
+  a'1
   a2 a4 a8 a
   a16 a a a a32 a a a a64 a a a a a a a a2
 }
@@ -324,14 +347,14 @@ duration number.  The duration of a dotted note must be stated
 explicitly (i.e., with a number).
 
 @lilypond[verbatim,quote]
-\relative c'' {
-  a4 a a4. a8
+\relative {
+  a'4 a a4. a8
   a8. a16 a a8. a8 a4.
 }
 @end lilypond
 
-
-@subheading Rests
+@node Rests
+@unnumberedsubsubsec Rests
 
 @cindex rest
 @cindex notating rests
@@ -342,19 +365,19 @@ A @notation{rest} is entered just like a note with the name
 @code{r}@tie{}:
 
 @lilypond[verbatim,quote]
-\relative c'' {
-  a4 r r2
+\relative {
+  a'4 r r2
   r8 a r4 r4. r8
 }
 @end lilypond
 
 
-@subheading Time signature
+@node Time signature
+@unnumberedsubsubsec Time signature
 
 @cindex time signature
 
 @funindex \time
-@funindex time
 
 Music Glossary: @rglos{time signature}.
 
@@ -362,9 +385,9 @@ The @notation{time signature} can be set with the @code{\time}
 command:
 
 @lilypond[verbatim,quote]
-\relative c'' {
+\relative {
   \time 3/4
-  a4 a a
+  a'4 a a
   \time 6/8
   a4. a
   \time 4/4
@@ -372,13 +395,13 @@ command:
 }
 @end lilypond
 
-@subheading Tempo marks
+@node Tempo marks
+@unnumberedsubsubsec Tempo marks
 
 @cindex tempo marks
 @cindex metronome marks
 
 @funindex \tempo
-@funindex tempo
 
 Music Glossary: @rglos{tempo indication}, @rglos{metronome}.
 
@@ -386,10 +409,10 @@ The @notation{tempo indication} and @notation{metronome mark} can be
 set with the @code{\tempo} command:
 
 @lilypond[verbatim,quote]
-\relative c'' {
+\relative {
   \time 3/4
   \tempo "Andante"
-  a4 a a
+  a'4 a a
   \time 6/8
   \tempo 4. = 96
   a4. a
@@ -400,7 +423,8 @@ set with the @code{\tempo} command:
 @end lilypond
 
 
-@subheading Clef
+@node Clef
+@unnumberedsubsubsec Clef
 
 @cindex clef
 @cindex treble
@@ -409,16 +433,15 @@ set with the @code{\tempo} command:
 @cindex bass
 
 @funindex \clef
-@funindex clef
 
 Music Glossary: @rglos{clef}.
 
 The @notation{clef} can be set using the @code{\clef} command:
 
 @lilypond[verbatim,quote]
-\relative c' {
+\relative {
   \clef "treble"
-  c1
+  c'1
   \clef "alto"
   c1
   \clef "tenor"
@@ -429,16 +452,17 @@ The @notation{clef} can be set using the @code{\clef} command:
 @end lilypond
 
 
-@subheading All together
+@node All together
+@unnumberedsubsubsec All together
 
 Here is a small example showing all these elements together:
 
 @lilypond[verbatim,quote]
-\relative c, {
+\relative {
   \clef "bass"
   \time 3/4
   \tempo "Andante" 4 = 120
-  c2 e8 c'
+  c,2 e8 c'
   g'2.
   f4 e d
   c4 c, r
@@ -552,7 +576,7 @@ The braces should be surrounded by a space unless they are at the
 beginning or end of a line to avoid ambiguities.
 
 A LilyPond command followed by a simple expression in braces (such
-as @q{@w{@code{@bs{}relative c' @{ @dots{} @}}}}) also counts as a
+as @q{@w{@code{@bs{}relative @{ @dots{} @}}}}) also counts as a
 single music expression.
 
 @cindex comments
@@ -662,29 +686,18 @@ online version.
 @cindex files, tips for constructing
 
 LilyPond input must be surrounded by @code{@{ @}} marks or a
-@q{@w{@code{@bs{}relative c'' @{ @dots{} @}}}}, as we saw in
-@ref{Working on input files}.  For the rest of this manual, most
-examples will omit this.  To replicate the examples, you may copy
-and paste the displayed input, but you @strong{must} add the
-@q{@w{@code{@bs{}relative c'' @{ @dots{} @}}}} like this:
+@q{@w{@code{@bs{}relative @{ @dots{} @}}}}, as we saw in
+@ref{Working on input files}.  For the rest of this manual,
+some short examples will omit this.  To replicate these examples,
+you can copy displayed input, but paste it between @code{@{}
+and @code{@}} in your input file.
 
 @example
-\relative c'' @{
+@{
   @dots{}example goes here@dots{}
 @}
 @end example
 
-Why omit the braces?  Most examples in this manual can be inserted
-into the middle of a longer piece of music.  For these examples,
-it does not make sense to add
-@q{@w{@code{@bs{}relative c'' @{ @dots{} @}}}} -- you should not
-place a @code{\relative} inside another @code{\relative}!  If we
-included @q{@w{@code{@bs{}relative c'' @{ @dots{} @}}}} around
-every example, you would not be able to copy a small documentation
-example and paste it inside a longer piece of your own.  Most
-people want to add material to an existing piece, so we format the
-manual this way.
-
 Also, remember that every LilyPond file should have a
 @code{\version} statement.  Because the examples in the manuals
 are snippets, not files, the @code{\version} statement is omitted.
@@ -703,8 +716,8 @@ this image:
 
 @c no verbatim here
 @lilypond[quote]
-\relative c'' {
-  c4-\markup { \bold \huge { Click here. } }
+\relative {
+  c''4-\markup { \bold \huge { Click here. } }
 }
 @end lilypond