]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/tutorial.itely
patch::: 1.3.121.jcn2
[lilypond.git] / Documentation / user / tutorial.itely
index 9bd5e9e28e81424e44014ebc440d04238f9d01e0..489c11463193588e31bad13c537c02214060ddc1 100644 (file)
@@ -1,35 +1,37 @@
-@chapter Tutorial
+@c -*-texinfo-*-
 
+@c ugh: because of @include, we need to fill in these nodes?
+@node Tutorial
+@chapter Tutorial
 
-@node Tutorial, , , Top
 @menu
-* Introduction::                  Introduction
-* The first tune::                The first tune
-* Lyrics and chords::             Lyrics and chords
-* Piano music::                   Piano music
-* end of tutorial::                       The end
+* Introduction::                   Introduction
+* The first tune::                 The first tune
+* Lyrics and chords::              Lyrics and chords
+* Piano music::                    Piano music
+* end of tutorial::                The end
 @end menu
 
-@node Introduction,  , , Tutorial
+@node Introduction
 @section Introduction
 
   
 LilyPond prints music from a specification that you, the user, supply.
 You have to give that specification using a @emph{language}.  This
 document is a gentle introduction to that language, which is called
-Mudela, an acronym of Music Definition Language.
+Lilypond, an acronym of Music Definition Language.
 
-This tutorial will demonstrate how to use Mudela by presenting
+This tutorial will demonstrate how to use Lilypond by presenting
 examples of input along with resulting output.  We will use English
 terms for notation.  In case you are not familiar with those, you may
 consult the glossary that is distributed with LilyPond.
 
 The examples discussed are included in the distribution, in the
 subdirectory @file{input/tutorial/}.  It is recommended that you
-experiment with writing Mudela input yourself, to get a feel for
+experiment with writing Lilypond input yourself, to get a feel for
 how LilyPond behaves.
 
-@node The first tune,  , , Tutorial
+@node The first tune
 @section The first tune
 
 
@@ -37,14 +39,15 @@ To demonstrate what LilyPond input looks like, we start off with a
 full fledged, yet simple example. It is a convoluted version
 of the famous menuet in J. S. Bach's @emph{Klavierbuechlein}.
 
-@mudela[verbatim]
-% lines preceded by a percent are comments.
+@lilypond[verbatim]
+% lines preceded by a percent are comments which
+% are ignored by Lilypond.
 \include "paper16.ly"
 \score {
     \notes                        
     \relative c'' \sequential{                
             \time 3/4;                
-            \key g;
+            \key g \major;
 
         \repeat "volta" 2 {
             d4 g,8 a b c d4 g, g |
@@ -67,7 +70,7 @@ of the famous menuet in J. S. Bach's @emph{Klavierbuechlein}.
        linewidth = 14.0 \cm;
    }
 }
-@end mudela
+@end lilypond
 
 Enter it (or copy it, the filename is @file{menuet.ly}), compile it
 with LilyPond and view the output.  Details of this procedure may vary
@@ -85,7 +88,9 @@ will analyse the input, line by line.
 Let's try to redo this
 @example
 
-        % lines preceded by a percent are comments.
+       % lines preceded by a percent are comments which
+       % are ignored by Lilypond.
+
  
 @end example 
 The percent sign, `@code{%}', introduces a line comment.  If you want to
@@ -119,7 +124,7 @@ that size, which is done.
         \score @{
  
 @end example 
-  A mudela file combines music with directions for outputting that
+  A lilypond file combines music with directions for outputting that
 music.  The music is combined with the output directions by putting
 them into a @code{\score} block.
 @example 
@@ -165,7 +170,7 @@ sign is printed.  This command is also used to generate bar lines in
 the right spots.
 @example 
 
-        \key g;
+        \key g \major;
  
 @end example 
   This command changes the current key to G-major.  Although this
@@ -178,8 +183,8 @@ typesetting conventions.
  
 @end example 
   This command tells LilyPond that the following piece of music must
-be played twice; @code{"volta"} volta brackets should be used for
-alternatives---if there were any.
+be played twice; @code{"volta"} means that volta brackets should be used
+for alternatives---if there were any.
 @example 
 
         @{
@@ -210,12 +215,12 @@ duration (You may enter it anyway, e.g. @code{a4 b4})
         d4 g, g |
  
 @end example 
- Three more notes.  The `@code{|}' character is a `barcheck'.  When
-processing the music, LilyPond will verify that barchecks are found at
+ 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.
 
  So far, no notes were chromatically altered.  Here is the first one
-that is: @code{fis}. Mudela by default uses Dutch note names, and
+that is: @code{fis}. Lilypond by default uses Dutch note names, and
 ``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.
@@ -233,8 +238,8 @@ In this case, a beam over 4 eighths is added.
 @end example 
   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 between
+closing parenthesis respectively.  In the line shown above, this is
+done for two slurs.  Slur markers (parentheses) are put between
 the notes.
 @example 
 
@@ -242,7 +247,7 @@ the notes.
  
 @end example 
 Automatic beaming can be overridden by inserting beam marks
-(brackets).  Brackets are put around notes you want beamed.
+(brackets).  Brackets are put around the notes you want beamed.
 @example 
 
         g2.  |
@@ -263,8 +268,8 @@ a repeat bar.
  
 @end example 
  This line shows that Lily will print an accidental if that is
-needed: the first C sharp will be printed with an accidental, the
-second one without.
+needed: the first C sharp of the bar will be printed with an accidental,
+the second one without.
 @example 
 
         a8-. b-. cis-. d-. e-. fis-.
@@ -272,7 +277,7 @@ second one without.
 @end example 
 You can enter articulation signs either in a verbose form using a
 shorthand.  Here we demonstrate the shorthand: it is formed by a dash
-and the the character for the articulation to use, e.g. `@code{-.}' for
+and the character for the articulation to use, e.g. `@code{-.}' for
 staccato as shown above.
 @example 
 
@@ -332,7 +337,7 @@ symbols and their placement is @emph{generated} from a high-level musical
 description.  In other words,  LilyPond would be best
 described by `music compiler' or `music to notation compiler'.
 
-@node Lyrics and chords, , , Tutorial
+@node Lyrics and chords
 @section Lyrics and chords
 
 In this section we show how to typeset a song of unknown
@@ -347,6 +352,7 @@ of this song.}.
 \include "paper16.ly"
 melody = \notes \relative c' @{
         \partial 8;
+       \key c \minor;
         g8 |
         c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
         c4 c8 d [es () d] c4 | d4 es8 d c4.
@@ -370,13 +376,13 @@ accompaniment =\chords @{
 
           \addlyrics
             \context Staff = mel @{        
-              \property Staff.noAutoBeaming = "1"
-              \property Staff.automaticMelismata = "1"
+              \property Staff.noAutoBeaming = ##t
+              \property Staff.automaticMelismata = ##t
               \melody 
             @}
             \context Lyrics \text
         @}
-        \midi  @{ @}
+        \midi  @{ \tempo 4=72;@}
         \paper @{ linewidth = 10.0\cm; @}
 @} 
 @end example 
@@ -389,7 +395,7 @@ may differ, since the titling in this document is not generated by
 @center @strong{The river is flowing}
 @center Traditional 
 
-@mudela[center]
+@lilypond[center]
 \header {
         title = "The river is flowing";
         composer = "Traditional (?)";
@@ -421,16 +427,16 @@ accompaniment =\chords {
 
           \addlyrics
             \context Staff = mel {
-              \property Staff.noAutoBeaming = "1"
-              \property Staff.automaticMelismata = "1"
+              \property Staff.noAutoBeaming = ##t
+              \property Staff.automaticMelismata = ##t
               \melody 
             }
             \context Lyrics \text
         }
-        \midi  { }
+        \midi  { \tempo 4=72;}
         \paper { linewidth = 10.0\cm; }
 }
-@end mudela
+@end lilypond
 
 Again, we will dissect the file line by line.
 @example 
@@ -451,7 +457,7 @@ the @code{\header} block contains assignments.  An assignment starts
 with a string.  (which is unquoted, in this case). Then comes the
 equal sign `@code{=}'.  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. The
+information has to be quoted here, because it contains spaces. Each
 assignment is finished with a semicolon.
 @example 
 
@@ -475,7 +481,7 @@ construct the music within the score block.
 
 The piece starts with an anacrusis of one eighth.
 @example
-       \key c \minor
+       \key c \minor;
 @end example
 The key is C minor: we have three flats.
 
@@ -587,18 +593,18 @@ Normally, the notes that you enter are transformed into note heads.
 The note heads alone make no sense, they need surrounding information:
 a key signature, a clef, staff lines, etc.  They need @emph{context}.  In
 LilyPond, these symbols are created by objects called `interpretation
-context'.  Interpretation contexts only exist during a run of
+contexts'.  Interpretation contexts only exist during a run of
 LilyPond.  Interpretation contexts that are for printing music (as
-opposed to playing music) are called `notation context'.
+opposed to playing music) are called `notation contexts'.
 
-By default, LilyPond will create a Staff contexts for you.  If you
-would remove the @code{%} sign in the previous line, you can see that
+By default, LilyPond will create a Staff context for you.  If you
+removed the @code{%} sign in the previous line, you would see that
 mechanism in action.
 
-We don't want default contexts here, because we want names, not note
-heads.  An interpretation context can also created upon explicit
+We don't want default contexts here, because we want chord names, not
+note heads.  An interpretation context can also created upon explicit
 request. The keyword for such a request is @code{\context}.  It takes
-two arguments.  The first is the name of a interpretation context.
+two arguments.  The first is the name of an interpretation context.
 The name is a string, it can be quoted with double quotes).  The
 second argument is the music that should be interpreted in this
 context.  For the previous line, we could have written @code{\context
@@ -621,14 +627,14 @@ silly.)
  
 @end example 
 This is the argument of @code{\addlyrics}.  We instantiate a
-@code{Staff} context explicitly: should you chose to remove comment
+@code{Staff} context explicitly: should you chose to remove the comment
 before the ``note heads'' version of the accompaniment, the
 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.
 @example 
 
-        \property Staff.noAutoBeaming = "1"
+        \property Staff.noAutoBeaming = ##t
  
 @end example 
 An interpretation context has variables that tune its behaviour.  One
@@ -637,7 +643,7 @@ true) LilyPond will not try to put automatic beaming on the current
 staff.
 @example 
 
-        \property Staff.automaticMelismata = "1"
+        \property Staff.automaticMelismata = ##t
  
 @end example 
 Similarly, we  don't want to print a  syllable when there is
@@ -670,14 +676,16 @@ Lyrics.
 This ends @code{\simultaneous}.
 @example 
 
-        \midi  @{ @}
+        \midi  @{ \tempo 4=72;@}
  
 @end example 
 This makes the music go to a MIDI file.  MIDI is great for
 checking music you enter.  You listen to the MIDI file: if you hear
 something unexpected, it's probably a typing error.  @code{\midi} is an
 `output definition', a declaration that specifies how to output music
-analogous to @code{\paper @{ @}}.
+analogous to @code{\paper @{ @}}. 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.
 @example 
 
         \paper @{ linewidth = 10.0\cm; @}
@@ -692,61 +700,62 @@ will be set in two lines.
 @end example 
 End the score block.
 
-@node Piano music, , , Tutorial
+@node Piano music
 @section Piano music
 
-Our third subject is a piece piano music.  The fragment in the input
+Our third subject is a piece of piano music.  The fragment in the input
 file is a piano reduction of the G major Sinfonia by Giovanni Battista
 Sammartini.  It was composed around 1740. 
 
-@mudela[verbatim]
+@lilypond[verbatim]
 
+\version "1.3.60";
 \include "paper16.ly";
 
 viola = \notes \relative c' \context Voice = viola {
         <c4-\f g' c>
-        \property Voice.verticalDirection = \down g'8. b,16
+        \stemDown g'8. b,16
         s1 s2. r4
         g
 }
 
 oboes = \notes \relative c'' \context Voice = oboe {
-        \stemup s4  g8. b,16 c8 r <e'8.-\p g> <f16 a>
+        \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> }
         <
           { \times 2/3 { a8 g c } \! c2 }
           \context Voice = oboeTwo {
-                \stemdown
+                \stemDown
                 \grace {
-                    \property Grace.verticalDirection = \down
+                    \property Grace.Stem \override #'direction = #-1
                     [f,16 g] }
                 f8 e e2
         } >
-        \stemboth
+        \stemBoth
         \grace <c,8( e> <)b8. d8.-\trill> <c16 e> | 
         [<d ( f> < )f8. a>] <)b,8 d> r [<d16( f> <f8. )a>] <b,8 d> r  |
         [<c16( e>  < )e8. g>] <c8 e,>
 }
 
 hoomPah  = \notes \transpose c' {
-    c8 \translator Staff = top \stemdown 
-    c'8 \translator Staff = bottom \stemup }
+    c8 \translator Staff = top \stemDown 
+    c'8 \translator Staff = bottom \stemUp }
 
 hoomPahHoomPah = { [\hoomPah \hoomPah] }
 
 bassvoices = \notes \relative c' {
         c4 g8. b,16
-        \hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah
-        \stemdown [c8 c'8] r4
+        \repeat unfold 4 {\hoomPahHoomPah}
+        \stemDown [c8 c'8] r4
         <g d'> r4
-        < {\stemup r2 <e4 c'> <c8 g'> }
-          \context Voice = reallyLow  {\stemdown g2 ~ | g4 c8 } >
+        < {\stemUp r2 <e4 c'> <c8 g'> }
+          \context Voice = reallyLow  {\stemDown g2 ~ | g4 c8 } >
 }
 
 \score {
         \context PianoStaff \notes <
                 \context Staff = top < \time 2/2;
-                        \context Voice = viola \viola
+                        \viola
                         \oboes
                 >
                 \context Staff = bottom < \time 2/2; \clef bass;
@@ -758,34 +767,43 @@ bassvoices = \notes \relative c' {
           indent = 0.0;
           linewidth = 15.0 \cm; }
 }
-@end mudela
+@end lilypond
 
 If it looks like incomprehensible gibberish to you@dots{} Then you are
 right.  The author has doctored this example to have as many quirks in
 one system as possible.
 @example 
+\version "1.3.61";
+@end example 
+Lilypond and the Lilypond language is still under development, therefore
+it is useful to indicate the Lilypond version of the file. Lilypond 
+will check the version number and warn you when the syntax has
+changed. Also, the @code{convert-ly} program will be able to 
+update most of the syntax changes automatically.
+@example 
 viola = \notes \relative c'  \context Voice = viola @{ 
 @end example 
 In this example, you can see multiple parts on a staff.  Each part is
 associated with one notation context.  This notation context handles
 stems and dynamics (among others).  The name of this context is
 @code{Voice}.  For each part we have to make sure that there is
-precisely one Voice context@footnote{If @code{\context} would not
-have been specified explicitly, three @code{Voice} contexts would be
-created: one for each note  in the first chord.}.
+precisely one Voice context.
 @example 
 <c4-\f g' c> 
 @end example 
 @code{<} and @code{>} are short hands for @code{\simultaneous @{} and
 @code{@}}. So the expression enclosed in @code{<} and @code{>} is a
 chord.  @code{\f} places a forte symbol  under the chord.
+[FIXME]
+
 @example 
-\property Voice.verticalDirection = \down 
+   \property Voice.verticalDirection = \down 
 @end example 
 @code{verticalDirection} is a property of the voice context. It
 controls the directions of stems, articulations marks and other
 symbols.
-  If @code{verticalDirection} is set to @code{\down}
+
+If @code{verticalDirection} is set to @code{\down}
 (identifier for the integer -1) the stems go down,
 @code{\up} (identifier for the integer 1) makes the stems go up.
 @example 
@@ -809,9 +827,9 @@ 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}.
 @example 
-\stemup s4  g8. b,16 c8 r <e'8.-\p g> <f16 a> 
+\stemUp s4  g8. b,16 c8 r <e'8.-\p g> <f16 a> 
 @end example 
-@code{\stemup} is an identifier reference.  It is shorthand for
+@code{\stemUp} is an identifier reference.  It is shorthand for
 @code{\property Voice.verticalDirection = \up}.  If possible, you
 should use predefined identifiers like these for setting properties.
 Your input will be less dependent upon the implementation of LilyPond.
@@ -850,7 +868,7 @@ The crescendo is ended at the half note by the escaped exclamation
 mark `@code{\!}'.
 @example 
 \context Voice = oboeTwo @{
-\stemdown 
+\stemDown 
 @end example 
 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
@@ -861,11 +879,13 @@ it from the other context.  Stems go down in this voice.
 When a grace section is processed, a @code{Grace} context is
 created. This context acts like a miniature score of its own.  It has
 its own time bookkeeping, and you can make notes, beams, slurs
-etc. Here fiddle with a property and make a beam.  The argument of
+etc. Here we fiddle with a property and make a beam.  The argument of
 @code{\grace} is sequential music.
+
 @example 
-\property Grace.verticalDirection = \down
-[f,16 g] @} 
+\property Grace.verticalDirection = \down   
+[f,16 g] @}
+  [FIXME]
 @end example 
 Normally, grace notes are always stem up, but in this case, the upper
 voice interferes. We set the stems down here.
@@ -880,10 +900,10 @@ the @code{f}.
 @end example 
 This ends the two-part section.
 @example 
-\stemboth
+\stemBoth
 \grace <c,8( e> <)b8. d8.-\trill> <c16 e> |  
 @end example 
-@code{\stemboth} ends the forced stem directions. From here, stems are
+@code{\stemBoth} ends the forced stem directions. From here, stems are
 positioned as if it were single part music.
 
 The bass has a little hoom-pah melody to demonstrate parts switching
@@ -905,7 +925,7 @@ octave@footnote{@code{hoomPah = \relative @dots{}} would be more
 intuitive to use, but that would not let me plug @code{\transpose}
 :-).}.
 @example 
-c8 \translator Staff = top \stemdown  
+c8 \translator Staff = top \stemDown  
 @end example 
 We assume that the first note will be put in the lower staff.  After
 that note we switch to the upper staff with @code{\translator}.  To be
@@ -914,7 +934,7 @@ precise, this @code{\translator} entry switches the current voice to a
 `@code{top}'.  Stem directions are set to avoid interfering with the
 oboe voices.
 @example 
-c'8 \translator Staff = bottom \stemup @} 
+c'8 \translator Staff = bottom \stemUp @} 
 @end example 
 Then a note is put on the upper staff, and we switch again.  We have
 to name the lower staff `@code{bottom}'.
@@ -924,13 +944,13 @@ hoomPahHoomPah = @{ [\hoomPah \hoomPah] @}
 Put two of these fragments in sequence, and beam them.@example 
 bassvoices = \notes \relative c' @{
 c4 g8. b,16
-\hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah
-\hoomPahHoomPah 
+\repeat unfold 4 @{\hoomPahHoomPah @} 
 @end example 
 Entering the bass part is easy: the hoomPahHoomPah variable is
-referenced four times.
+repeated four times; @code{unfold} means that all four repetitions
+should be written out.
 @example 
-\context Voice = reallyLow  @{\stemdown g2 ~ | g4 c8 @} > 
+\context Voice = reallyLow  @{\stemDown g2 ~ | g4 c8 @} > 
 @end example 
 After skipping some lines, we see @code{~}.  This mark makes ties.
 @example 
@@ -946,7 +966,7 @@ The bottom staff must have a different clef.
 indent = 0.0; 
 @end example 
 To make some more room on the line, the first (in this case the only)
-line is not indented.  The line still looks is very cramped, but that is due
+line is not indented.  The line still looks very cramped, but that is due
 to the format of this tutorial.
 
 This example shows a lot of features, but the organisation isn't
@@ -956,7 +976,7 @@ parts.
 
 [TODO: demonstrate Hara-Kiri with scores and  part extraction.]
 
-@node  end of tutorial, , , Tutorial
+@node  end of tutorial
 @section The end        
          
 That's all folks.  From here, you can either try fiddling with input