]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/tex/tutorial.yo
release: 1.1.69
[lilypond.git] / Documentation / tex / tutorial.yo
index 297a1fb3a5868196d920949f0db515db54459025..5ddcab218efdca838360341816682aafb230eadc 100644 (file)
@@ -1,17 +1,33 @@
+mailto(gnu-music-discuss@gnu.org)
 COMMENT(-*-text-*-)
 
 redef(var)(1)(whenlatex(latexcommand({\normalfont\scshape )ARG1+latexcommand(}))\
     whenhtml(sc(ARG1)))
 
+COMMENT(urg)
+DEFINEMACRO(Large)(1)(\
+    whenlatex(latexcommand(\Large{)ARG1+latexcommand(}))\
+    whentexinfo(texinfocommand(@strong{)ARG1+texinfocommand(}))\
+    whenhtml(htmlcommand(<font size=+2>)ARG1+htmlcommand(</font>))\
+    whentxt(ARG1))
+
 COMMENT( This document contains Mudela fragments.  You need at least
 Yodl-1.30.18 to convert this to tex or html.
 
 TODO
 
-pipethrough(date) sucks.
+    * pipethrough(date) sucks.
+    * paragraphs have too much space.
+    * fix the amount of spaces (urg:tabs) at the start of verb() blocks
+      or even better: do verb and description side-by side
+      (TeX: use minipage construct):
 
-paragraphs have too much space.
+      \foo                  This does the
+                            foo construct
 
+      The explaining texts are right in between examples.
+      Constructs like 'This shows' and 'The next line' are esp.
+      confusing, here.
 )
 
 COMMENT(
@@ -20,13 +36,6 @@ COMMENT(
         with help of (among others)
 
         * Jan Nieuwenhuizen
-
-        * Lambert Meertens,
-
-        * Adrian Mariano
-
-        * Mats Bengtsson
-
 )
 
 htmlbodyopt(bgcolor)(white)
@@ -47,7 +56,7 @@ latexlayoutcmds(
 whenlatex(notableofcontents())
 whentexinfo(notableofcontents())
 
-article(Mudela -- Using LilyPond to typeset music)
+article(Typesetting music with LilyPond)
       (Han-Wen Nienhuys and Jan Nieuwenhuizen)
       (nop()PIPETHROUGH(date "+%B %d, %Y")()()nop())
 
@@ -66,162 +75,171 @@ sect(Introduction)
 label(tutorial:introduction)
 latexcommand(\parindent2pc)
   
-If you are reading this, you probably are interested in printing
-music.  LilyPond is a program that can print music from a
-specification that you, the user, supply.  Using LilyPond may be a bit
-quaint in the beginning, because you have to give that specification
-using a em(language).  This document is a gentle introduction to that
-language, which is called Mudela, an abbreviation for Music Definition
-Language.
-
-We will demonstrate the working of Mudela by presenting  examples of
-input alongside with the resulting output.  We will comment on these
-examples using English terms for notation, so if you are not familiar
-with these terms, you should consult the glossary that is distributed
-with LilyPond: it contains a list of musical terms along with
-explanations and translations in some other languages.
+LilyPond prints music from a specification that you, the user, supply.
+You have to give that specification using a em(language).  This
+document is a gentle introduction to that language, which is called
+Mudela, an acronym of Music Definition Language.
+
+This tutorial will demonstrate how to use Mudela 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
+how LilyPond behaves.
 
 sect(The first tune)
 label(sec:firsttune)
 
 To demonstrate what LilyPond input looks like, we start off with a
-full fledged, yet simple, example. It is somewhat convoluted version
-of one of the menuets in bind(J.)bind(S.)Bach's em(Clavierbuchlein).
+full fledged, yet simple example. It is a convoluted version
+of the famous menuet in bind(J.)bind(S.)Bach's em(Klavierbuechlein).
 
-mudela(verbatim)(
-% lines preceded by a percent are comments.
+COMMENT(urg: the fermata sign is placed below the note by default)
+mudela(verbatim)(% lines preceded by a percent are comments.
 \include "paper16.ly"
 \score {
-    \notes                     
-    \relative c'' {            
-        \key g;
-        \time 3/4;             
-
-        d4 [g,8 a b c] d4 g, g |
-        e'4 [c8 d e fis] g4 g, g |
-        c4 [d8( )c b a( ] )b4 [c8 b a g] |
-        a4 [b8 a g fis] g2.  |
-
-        \bar ":|";             
+    \notes                        
+    \relative c'' {                
+            \key g;
+            \time 3/4;                
+
+        \repeat "volta" 2 {
+            d4 g,8 a b c d4 g, g |
+            e'4 c8 d e fis g4 g, g |
+            c4 d8()c b a( )b4 c8 b a g |
+            a4 [b8 a] [g fis] g2.  |
+        }
 
-        b'4 [g8 a b g]
-        a4 [d,8 e fis d] |
-        g4 [e8 fis g d] cis4 [b8 cis] a4 |
-        [a8-. b-. cis-. d-. e-. fis-. ] 
+        b'4 g8 a b g
+        a4 d,8 e fis d |
+        g4 e8 fis g d cis4 b8 cis a4 |
+        a8-. b-. cis-. d-. e-. fis-.
         g4 fis e |
         fis a,  r8 cis8
         d2.-\fermata
         \bar "|.";
     }
     \paper {
-       linewidth = 14.0 \cm; % standard settings are too wide for a book
+       % standard settings are too wide for a book
+       linewidth = 14.0 \cm;
    }
 })
 
-Before we will discuss the contents of the above, it would be best if
-you would try to enter and save this text with a text editor, compile
-it with LilyPond and view the output.  Details of this procedure may
-vary from system to system.  On a Unix system, you should enter the
-input in a file ending in file(.ly), such as file(menuet.ly).  To
-create the output, one would issue code(ly2dvi menuet).
+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
+from system to system.  To create the output, one would issue the
+command `code(ly2dvi menuet)'.  file(ly2dvi) is a program that does
+the job of running LilyPond and TeX(), handling of titles and
+adjusting of page margins.
 
-file(ly2dvi) is a little program that does the job of calling the
-LilyPond and TeX() and adjusting page margins.
+If all goes well, the file file(menuet.dvi) will be created.
+To view this output, issue the command `code(xdvi menuet)'.
 
-If all goes well, this will create the output file file(menuet.dvi).
-To view this output, issue the command code(xdvi menuet).  Now that we
-are familiar with the procedure to view the output, we will analyse
-the input itself, line by line.
+Now that we are familiar with the procedure of producing output, we
+will analyse the input, line by line.COMMENT(
 
-verb(% lines preceded by a percent are comments.)COMMENT(
+)verb(
+        % lines preceded by a percent are comments.
+)COMMENT(
 
-)The percent sign (code(%)) introduces a line comment.  If you want
+)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(%})
-
+by `code(%{)' and `code(%})'COMMENT(
 
-verb(\input "paper16.ly")
-
-By default, LilyPond will use definitions for a staff of 20 point
-high.  If you want smaller output (e.g., 16 point), you have to import
-the setting for that size.  You can do this by including a file.
-code(\include "file") is replaced by the contents of  code(file).
+)verb(
+        \input "paper16.ly"
+)COMMENT(
 
+)By default, LilyPond will use definitions for a 20
+nop(point)footnote(A point is the standard measure of length for
+printing.  One point is 1/72.27 inch.) high staff.  We want smaller
+output (16 point staff height), so we must import the settings for
+that size, which is done.COMMENT(
 
-verb(\score {
-) COMMENT( 
+)verb(
+        \score {
+) COMMENT(
 
 ) A mudela 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.
 verb(
-   \notes              
+        \notes                
 ) COMMENT( 
 
 )This makes LilyPond ready for accepting notes.
 verb(
-    \relative c''
+        \relative c''
 )COMMENT(
 
 ) 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:
+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 central C is denoted
-by code(c) and code(c,) respectively.
-
-If you have to indicate the pitches in a long piece that is written in
-either a high or very low octave, you would have to type very many
-quotes.  To remedy this, LilyPond has a so-called "relative" octave
-entry mode.  In this mode, notes without quotes are chosen in such an
-octave that they are the closest to the preceding note.  If you add a
-high-quote an extra octave is added.  The lowered quote will substract
-an octave.  Because the first note obviously has no predecessor, you
-have to give the (absolute) pitch of the note to start with.
-COMMENT(
+higher is code(c'').  One and two octaves below the central C is
+denoted by code(c) and code(c,) respectively.
+
+For pitches in a long piece you might have to type many quotes.  To
+remedy this, LilyPond has a ``relative'' octave entry mode.  In this
+mode, octaves of notes without quotes are chosen such that a note is
+as close as possible (graphically, on the staff) to the the preceding
+note.  If you add a high-quote an extra octave is added.  The lowered
+quote (a comma) will substract an extra octave.  Because the first note
+has no predecessor, you have to give the (absolute) pitch of the note
+to start with.COMMENT(
 
 )verb(
-       {                         % sequential music follows
+        \sequential {
 )COMMENT(
 
-) The brace indicates that what follows is sequential music, i.e.,
-notes that are to be played and printed after each other.  This is in
-contrast with simultaneous music: notes that are to be played like a
-chord.  You should be careful not to confuse this brace with the one
-coming after code(\score).
+)  What follows is sequential music, i.e.,
+notes that are to be played and printed after each other.COMMENT(
 
-
-verb(
-        \time 3/4;             % set the time signature.
+)verb(
+        \time 3/4;
 ) COMMENT(
 
-) This command changes the time signature of the current piece: this
-prints a 3/4 sign.  The 3/4 value is also used to generate bar lines
-in the right spots.
-verb(
+) This command changes the time signature of the current piece: a 3/4
+sign is printed.  This command is also used to generate bar lines in
+the right spots.COMMENT(
+
+)verb(
         \key g;
-) COMMENT(
+)COMMENT(
 
-) This command changes the current key to G-major.  Although
-this command comes after the code(\time) command, in the
-output, the key comes before the time signature: LilyPond knows about
-music typesetting conventions.
-verb(
-        d4
+) This command changes the current key 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
+typesetting conventions. COMMENT(
+
+)verb(
+        \repeat "volta" 2
 ) COMMENT(
 
-) This is a code(d) note.  The relative music was started with a
-code(c''), the real pitch of this note is code(d'').  The 4 
-designates the duration of the note (it is a quarter note). COMMENT(
+) 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.
+COMMENT(
 
 )verb(
-        [g,8
+        {
 )COMMENT(
 
-)The open bracket starts a beam.  This bracket is connected to the
-following note, which is an eighth with pitch code(g') (remember
-relative mode for pitches!)
-COMMENT(
+)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. COMMENT(
+
+)verb(
+        d4
+)COMMENT(
+
+) This is a note with pitch code(d) (determined up to octaves).  The
+relative music was started with a code(c''), so the real pitch of this
+note is code(d'').  The code(4) designates the duration of the note
+(it is a quarter note). COMMENT(
 
 )verb(
         a b
@@ -229,29 +247,19 @@ COMMENT(
 
 )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 (It is not illegal to enter it anyway.  Then you would have
-to enter code(a8 b8))
-COMMENT(
+duration (You may enter it anyway, eg. code(a4 b4)) COMMENT(
 
 )verb(
-          c]
-) COMMENT(
+        d4 g, g |
+)COMMENT(
 
-) This ends the beam started four notes earlier, at the code(g).  In
-the output, you will notice a measure bar following this note.  You do
-not have to enter anything to make LilyPond create a bar.  Instead
-Lily will deduce where bars have to be by comparing durations of notes with
-the current time signature.  COMMENT(
+) Three more notes.  The `code(|)' character is a `barcheck'.  When
+processing the music, LilyPond will verify that barchecks are found at
+the start of a measure.  This can help you track down errors.
+COMMENT(
 
 )verb(
-          d4 g, g |
-) COMMENT(
-
-) Three more notes:  The code(|) is a "barcheck".  When processing the
-music, LilyPond will check  that barchecks are found at the start of
-a bar precisely.  This makes it easy to spot where notes are forgotten. 
-verb(
-        e'4 [c8 d e fis]
+        e'4 
 ) COMMENT(
 
 ) So far, no notes were chromatically altered.  Here is the first one
@@ -259,1478 +267,737 @@ that is: code(fis). Mudela 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.
-verb(
-        c4 [d8( )c b a( ] )b4 [c8 b a g] |
-) COMMENT(
+COMMENT(
 
-) The next line shows something new: a slur is a symbol that is
-printed over several notes.  In mudela, one enters a slur by marking
-the beginning and ending note of the slur with an opening and closing
-parenthesis respectively.  In the line shown above this is done for
-two slurs.  Note that parentheses (slur markers) are between the
-notes, and the brackets (beam markers) around the notes. As you can
-see, the brackets and parentheses do not have to nest.
+)verb(
+        c8 d e fis
+)COMMENT(
 
-verb(
-        a4 [b8 a g fis] g2.  |
+)LilyPond guesses were beams can be added to eighth and shorter notes.
+In this case, a beam over 4 eighths is added.
+COMMENT(
+
+)verb(
+        c4 d8( )c b a( )b4 c8 b a g |
 ) COMMENT(
 
-) A duration that is to be augmented with a duration dot, is notated
-with a duration number followed by periods, as many as you want
-augmentation dots.COMMENT(
+) 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
+the notes.COMMENT( 
+)verb(
+        a4 [b8 a] [g fis] 
+)COMMENT(
+
+)Automatic beaming can be overridden by inserting beam marks
+(brackets).  Brackets are put around notes you want beamed.COMMENT(
 
 )verb(
-        \bar ":|";             % a repeat sign
-) COMMENT(
+        g2.  |
+)COMMENT(
 
-)
-Lily can not detect where you want your music to be repeated, so you
-have to instruct her: a special bar symbol can be entered by the
-code(\bar) command followed by a string that signifies the bar symbol
-that you want.  Then comes a semicolon to separate the string from the
-rest of the notes, analogously with code(\key) and code(\time).
-verb(
-     cis'4 [b8 cis] a4 |
+)A duration with augmentation dot  is notated
+with the duration number followed by a period.COMMENT(
+)verb(
+        }
 ) COMMENT(
 
-)
-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 without.
-verb(
-        [a8-. b-. cis-. d-. e-. fis-. ] % try some super and subscripts.
+) This ends the sequential music to be repeated.  LilyPond will typeset
+a repeat bar.  COMMENT(
+
+)verb(
+        cis'4 b8 cis a4 |
 ) COMMENT(
 
-)
-There is more to music than just pitches and rhythms.  An important
-aspect is articulation.  You can enter articulation signs either in an
-abbreviated form, by a dash and the the character for the
-articulation to use,  e.g. code(-.) for staccato as shown above.
-COMMENT(
+)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.  COMMENT(
 
 )verb(
-        fis a,  r8 cis8
+        a8-. b-. cis-. d-. e-. fis-.
+)COMMENT(
+
+)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
+staccato as shown above.  COMMENT(
+
+)verb(
+        fis a, r8 cis8
 ) COMMENT(
 
 )
-Rests are denoted by the special notename code(r).  You can also make
-an invisible rest by using the special notename code(s).
+Rests are denoted by the special notename `code(r)'.  You can also enter
+an invisible rest by using the special notename `code(s)'.
 verb(
         d2.-\fermata
 ) COMMENT(
 
-) Finally, all articulations have a verbose form, like code(\fermata).
-The ``command'' COMMENT(Hi Adrian :-) code(\fermata) is not part of
-the core of the language (most of the other discussed elements are),
-but it is an abbreviation of a more complicated description of a
-fermata.  code(\fermata) refers to that abbreviation and is therefore
-called an em(identifier).
+)All articulations have a verbose form, like code(\fermata).  The
+command `code(\fermata)' is not part of the core of the language (most
+of the other discussed elements are), but it is a shorthand for a more
+complicated description of a fermata.  code(\fermata) names that
+description and is therefore called an em(identifier). COMMENT(
 
-verb(
+)verb(
         }
 ) COMMENT(
 
 )
-This ends the sequential music.
+Here the music ends.
+COMMENT(
 
-verb(\paper {
-            linewidth = 10.0\cm;
-})
-This specifies a conversion from music to notation output.  Most of
+)verb(
+        \paper {
+                linewidth = 14.0\cm;
+        }
+)COMMENT(
+
+)This specifies a conversion from music to notation output.  Most of
 the details of this conversions (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 10 centimeter
-(approximately 4 inches).
+to be smaller.  We do this by setting the line width to 14 centimeters
+(approximately 6 inches).
+COMMENT(
 
-verb(
+)verb(
         }
-)
-Finally, the last brace ends the code(\score) block.
-
-
-
-There are a couple of things to note here.  The input format tries to
-capture the meaning of em(music), and not notation.  Therefore the
-format contains musical concepts like pitches and durations, instead
-of symbols and positions.  Second, the format tries to be
-em(context-free): a note will sound the same regardless of the current
-time signature, the key nop(etc.)
-
-The purpose of LilyPond informally is explained by the term `music
-typesetter'. As you may have figured out by now, this is not a really
-adequate name: not only does the program print musical symbols, it
-also tries to make esthetic decisions, and it also em(generates) both
-the symbols and the decisions from a high-level musical description.
-In other words, the function of LilyPond would be best described by
-`music compiler' or `music to notation compiler'.
-
-We find that ---once you master the language--- there are big
-advantages of using LilyPond over GUI oriented programs: first,
-entering music is quite efficient.  Second, it is possible to explain
-exactly what the meaning piece of mudela is, and you can transform
-these pieces automatically (eg, by transposing them).  Third, the
-program that is not interactive, so much less tradeoffs have to be
-made between processing speed and the beauty of the output: you get
-prettier output by using LilyPond.
+)COMMENT(
 
+)The last brace ends the code(\score) block.
 
-As you can see, the most interesting part of the input is music
-itself, in this case the sequence of notes.  We will therefore focus
-on entering music for now.  Consequently, when we mean
-verb(\score {
-        \notes { XXXX } 
-       \paper {  }
-})COMMENT(
+There are two things to note here. The format contains musical
+concepts like pitches and durations, instead of symbols and positions:
+the input format tries to capture the meaning of em(music), and not
+notation.  Therefore Second, the format tries to be em(context-free):
+a note will sound the same regardless of the current time signature,
+the key, etc.
 
-) we will leave out the the repetitive details for now and just print
-code(XXXX).
+The purpose of LilyPond is explained informally by the term `music
+typesetter'.  This is not a fully correct name: not only does the
+program print musical symbols, it also makes esthetic decisions.  All
+symbols and their placement is em(generated) from a high-level musical
+description.  In other words,  LilyPond would be best
+described by `music compiler' or `music to notation compiler'.
 
 
+sect(Lyrics and chords)
 
-sect(When you know the notes to nop(print)ellipsis())
+In this section we show how to typeset a song of unknown
+origin.footnote(The author would welcome information about the origin
+of this song.).
 
-The basic building block of music is the note.  We lightly touched
-notes in the previous example.  Here comes the full explanation A note
-is made of a pitch and a duration.  The pitch of the central C is
-written as code(c').  This is in line with musicological notation;
-there this pitch is transcribed as nop(c)sups(1) or c'.  A
-quarter-note duration is written as code(4).  So, to print a quarter
-note whose pitch is central C, you enter the following code(c'4).
+verb(\header {
+        title = "The river is flowing";
+        composer = "Traditional (?)";
+}
+\include "paper16.ly"
+melody = \notes \relative c' {
+        \partial 8;
+        g8 |
+        c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
+        c4 c8 d [es () d] c4 | d4 es8 d c4.
+        \bar "|.";
+}
 
-subsect(Duration)
+text = \lyrics {
+        The ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
+        ri -- ver is flo -- wing down to the sea.
+}
 
-The duration of a note is specified as a number: a whole note is
-denoted by 1, a half note by 2, a quarter by 4, and so on.  If you
-want to augment a duration with a dot, simply affix a period to the
-number.  You can also print notes longer than a whole.  You do this by
-using identifiers (code(\breve) and code(\longa):
-Here are some random notes to show how it works.
+accompaniment =\chords {
+        r8
+        c2-3- f-3-.7 d-min es4 c8-min r8
+        c2-min f-min7 g-7^3.5 c-min }
 
-verb(
-  c'\longa c'\breve  
-  c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 c'2. c'8. c'16
-)
-
-mudela()(
 \score {
-       \notes {
-         c'\longa c'\breve  
-         c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 c'2. c'8. c'16
-         }
-         \paper {
-               linewidth = -1.0;
-               \translator { \type "Score_engraver";
-                           \name "Score";
-                           \consists "Note_heads_engraver";
-                           \consists "Stem_engraver";
-                           \consists "Rhythmic_column_engraver";
-         }}}
-         
-)
+        \simultaneous {
+%         \accompaniment
+          \context ChordNames \accompaniment
+
+          \addlyrics
+            \context Staff = mel {        
+              \property Staff.noAutoBeaming = "1"
+              \property Staff.automaticMelismata = "1"
+              \melody 
+            }
+            \context Lyrics \text
+        }
+        \midi  { }
+        \paper { linewidth = 10.0\cm; }
+})
 
-subsect(Basic pitches)
-
-The pitch code(c')  consists of two parts: one part for the
-note name, and one for the octave.  The letter specifies which note
-name to use: note names simply are the letters code(a) to code(g).
-The number of apostrophes specifies the octave to use: the central C
-is denoted by code(c').footnote(By convention, the A above central C
-at concert pitch is the tone that is used to tune instruments.  Its
-frequency is about 440 Hz.)  The C which is an eighth higher (the C in
-the ``two-line octave'') is denoted by code(c''): every octave adds a
-quote.  A note name without quotes designates the pitch below code(c')
-(the C in the ``small octave''). If you want to go down even further,
-commas should be added, e.g., the C in the ``contra octave'' is
-expressed as code(c,,).footnote(The comma is meant to represent a
-sunken apostrophe.)
-
-This example demonstrates pitches
-mudela(fragment,verbatim,center)(
-   c,,4 c, c c' c'' c''' d'4 e'4 f'4 g'4
-)
 
+The result would look nop(this)footnote(The titling and font size shown
+may differ, since the titling in this document is not generated by
+file(ly2dvi).).
 
-subsect(Alterations)
-
-We have so far ignored chromatically altered pitches.  The names `a'
-to `g' for entering pitches are convenient: they are short,
-pronounceable and they resemble the words for pitches in normal
-musical vocabulary.
-
-Enter flats and sharps.  In English there is no standard terse word
-for C sharp or C flat.  For this reason, mudela uses a different,
-non-English convention for entering altered pitches: a note is made
-sharp by adding the suffix `--is' to its name, and flat by adding the
-suffix `--es'.  For a double sharp another `--is' suffix is added, for
-flats another `--es' nop(suffix.)  footnote(Variations on this
-convention are used in a number of germanic languages, notably Dutch,
-German, Swedish, and Norwegian.) The names for the alterations of C
-are given in bind(Table)ref(notename-tab).
-
-latexcommand(\begin{table}[h])
-  center(
-    table(2)(ll)(
-      row(cell(english)cell(LilyPond))
-      rowline()
-      row(cell(c double flat)cell(ceses))
-      row(cell(c flat)cell(ces))
-      row(cell(c natural)cell(c))
-      row(cell(c sharp)cell(cis))
-      row(cell(c double sharp)cell(cisis))
-    )
-  )
-  latexcommand(\caption{Default note names})
-  label(notename-tab)
-latexcommand(\end{table})
-
-Throughout this document we will continue to use these names.footnote(
-  Mudela defaults to Dutch notenames.  To make (Dutch) pronunciation
-  easier, the a-flat and e-flat are contracted to code(as) and
-  code(es).  Similarly, the a double flat and e double flat are
-  contracted to code(ases) and code(eses).  For consistency, the dutch
-  names also include code(aes), code(aeses), code(ees) and
-  code(eeses)) 
-
-If you are not comfortable with these names, you can make your own.
-Note names for different languages are included with the example
-initialisation files, amongst others English (C sharp is abbreviated
-to code(cs)), Italian, Swedish and Norwegian.  If you want to use
-these names, issue code(\include "LANGUAGE.ly") where you could
-substitute code(italiano), code(deutsch) etc.  for LANGUAGE.  You
-should include these files at toplevel, i.e., before opening a
-code(\score) block.
-
-
-sect(Chords)
-
-The previous examples all notes   that were to be played sequentially,  one
-note following the other.  You can also use LilyPond to typeset
-chords.  You do this  by expressing in mudela simultaneous music,
-i.e.,   notes that are to be played concurrently. 
-
-In Mudela you can form simultaneous music by enclosing notes in
-pointed parentheses, bind(i.e.)bind(langle())bind(and)rangle().  ASCII
-doesn't really have these delimiters, so Mudela uses the larger-than
-(code(>)) and smaller-than (code(<)) signs instead.  For example, a
-D-major chord is expressed as
-mudela(fragment,verbatim,center)(
-  <d'8  fis'8 a'8 d''8>
-)
+center(bf(Large(The river is flowing))
 
-Chords can be entered in the music in the same places that notes
-can.  As an example we give a snippet of ``Twinkle Twinkle Little
-Star'' in chords.  The chords may seem slightly unconventional, but
-they only serve to show how chords work.  We've aligned the chords in
-the input on their starting beat just to help you reading it.  This
-layout does not influence the typesetting result in any way.
-
-mudela(verbatim, fragment)(
-  \relative c' {
-  \time 2/4;
-  c4       c            <c g'>    <c e g>
-  <c e a>  <b d a'>     <b2 d g>
-  <a4 d f> <bes d f>    <bes c e> <g c e>
-  <e a d>  <a, g' cis'> <d2 f d'>
-  }
+var(Traditional (?))
 )
 
-There is one thing to note, in sequences of chords, the (relative)
-pitch of a is taken with reference to the first note of the previous
-chord.
+mudela(center)(\header {
+        title = "The river is flowing";
+        composer = "Traditional (?)";
+}
+\include "paper16.ly"
+melody = \notes \relative c' {
+        \partial 8;
+        g8 |
+        c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
+        c4 c8 d [es () d] c4 | d4 es8 d c4.
+        \bar "|.";
+}
 
-You can nest simultaneous and sequential music in any way you want,
-e.g., COMMENT(
+text = \lyrics {
+        The ri -- ver is flo- __ wing, flo -- wing and gro -- wing, the
+        ri -- ver is flo -- wing down to the sea.
+}
 
-)mudela(verbatim,fragment,center)(
-        < { g''4 g''4 }
-          { c'8 <c' e'> c' <c' e'> } >
-)COMMENT(
+accompaniment =\chords {
+        r8
+        c2-3- f-3-.7 d-min es4 c8-min r8
+        c2-min f-min7 g-7^3.5 c-min }
 
-)
-As you can see, LilyPond has some difficulty typesetting this
-elegantly.  To adequately solve this, you have to persuade LilyPond to
-make separate stems for both sequential music lists.   This is a topic
-that is covered in bind(Section)ref(sec:polyphonic).
-
-[Chords and relative mode]
-
-
-sect(Adding nuances: articulation and dynamics)
-
-Having just chords and notes does not give you real music.  Real music
-has more liveliness to it: music can have articulation, dynamics
-(louder and softer), etc.  This liveliness has notation, so LilyPond
-can print it.  We'll start out by explaining how to obtain the
-smallest grains of nuance: the articulation of a single note.  Articulation
-is entered by writing a dash and the name of the desired articulation
-mark.  You have to add a backslash in front of the name to distinguish
-it from the name of a note.  mudela(fragment,verbatim)(
-  c''4-\staccato
-  c''4-\tenuto )
-
-Typing a lot of staccato notes in this syntax will get tedious very
-quickly.  Therefore, Mudela has some handy abbreviations for
-articulation marks such as staccato and tenuto.  They are shown in the
-following example:
-
-mudela()(
-\score{ <
-        \property Score.textstyle = typewriter
-        \type Staff \notes {
-               c''4-.
-               c''4--
-               c''4-+
-               c''4-|
-               c''4->
-               c''4-^
-               }
-        \type Lyrics\lyrics {
-              "."4 "-" "+" "|" ">" "\^{ }" }
-        >
-        \paper { linewidth = 12.\cm; }
+\score {
+        \simultaneous {
+%         \accompaniment
+          \context ChordNames \accompaniment
+
+          \addlyrics
+            \context Staff = mel {
+              \property Staff.noAutoBeaming = "1"
+              \property Staff.automaticMelismata = "1"
+              \melody 
+            }
+            \context Lyrics \text
+        }
+        \midi  { }
+        \paper { linewidth = 10.0\cm; }
 })
 
-Text and digits for fingering can be entered in the same manner: add a
-dash and the text or digit to be printed:
-mudela(fragment,verbatim)(
-  c''4-1 g''4-5 c''-"Sul tasto" )
-COMMENT(Currently, the meaning of the
-syntax `note-dash-digit/articulation/text' is just ``add a superscript to this
-note.''  This is not in line with our goal to em(define) music with
-Mudela.  We hope that this will be fixed in a future version of the
-language.  In the meantime you can abuse this: the super- and
-subscripts can be forced into up or down position respectively by entering an
-a caret (code(^)) or an underscore, code(_) instead of the dash:
-mudela(fragment,verbatim,center)(
-  c'4-^ c'4^^ c'''4-^ c'''4_^
-))
-
-Dynamic markings are another way to add a nuance to a note.  They are
-entered by adding the name for the dynamic sign after the note.  You
-should not enter a dash between the name and the note.footnote(This
-  is inconsistent.  We hope that this will be fixed in a later
-  version of the language.)
-mudela(verbatim,fragment)(
-  c4 \ff c4 \fp c4 c4 \ppp c4 c4 \sfz
-)
-
-COMMENT(UGH)
-
-sect(Bridging the notes: beams, slurs and ties)
+Again, we will dissect the file line by line.COMMENT(
 
-Music typesetting does not use fixed symbols only.  A lot of symbols
-are variable: they run from one note to another. In LilyPond
-terminology, such a symbol is called a em(spanner).  To print a
-spanner, you have to attach a marker to the note that begins it and to
-the one that ends it.  These are the spanners that are entered like
-this:
-
-description(
-dit(The slur)
- The slur has the opening parenthesis as 
-start marker is.  The stopping marker is the closing parenthesis.
-For example:
-mudela(fragment,center,verbatim)( c'4( )c'4 )
-
-  The slur is quite flexible: you can nest nop(slurs,)footnote(This is
-inconsistent when compared to the syntax for articulation hints.  This
-will be fixed some time, we hope.) and you can connect a note with a
-slur on both the left and the right side:
-
-mudela(fragment,verbatim,center)(
-  c'4((   )c''4 )c'4( )g'4 
-)
+)verb(
+        \header {
+)COMMENT(
 
-dit(Beam)
+)Information about the music you are about to typeset goes into a
+code(\header) block.  The information in this block is not used by
+LilyPond, but it is included in the output.  file(ly2dvi) uses this
+information to print titles above the music.
+verb(
+        title = "The river is flowing";
+        composer = "Traditional (?)";)COMMENT(
 
-Another spanner is the beam.  The starting marker is the opening
-bracket, then ending marker is the closing bracket.  The brackets have
-to be em(around) the beamed notes.  footnote(Strictly speaking, a
-beam is not a musical concept: beaming doesn't change the meaning of
-music, it only clarifies the rhythmic structure.  One might argue that
-beams should not be present in a ``music'' language.  Unfortunately,
-LilyPond is not smart enough to insert beams into music on its own.
+)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
+assignment is finished with a semicolon.COMMENT(
 
-LilyPond does have code that guesses what the pattern should look
-like, so that you don't have to specify the beaming for complicated
-patterns.  Alas, the algorithm used is not foolproof
-yet: code([c8. c32 c32]) will produce incorrect results.)
+)verb(
+        \include "paper16.ly"
+)COMMENT(
 
-mudela(fragment,verbatim)(
-[c'8 c'] [c'16 c' c' c'] [c'16. c'32 c' c'16.]
-)
+)Smaller size for inclusion in a book.COMMENT(
 
-dit(The tie) The tie is similar to the slur: it  looks like a
-slur, but a slur connects whole chords, whereas the tie connects note
-heads.  Tied notes should be played as one long note.  In analogy with
-TeX()'s tie (which ties together words with a space), LilyPond's tie
-is entered as a tilde, `code(~)'.
-
-The input convention for the tilde is somewhat peculiar when used in
-conjunction with chords.  Internally, the extra information that is
-represented by the tilde has to be attached to a note (or to a rest,
-for that matter).  For this reason, you can't put the tilde between
-two chords (as in code( <c' g'> ~ <c' g'>)).  The tilde sign must be
-directly after a note of the chords.  It does not matter which
-one. The following example demonstrates the use of ties:
-mudela(fragment,verbatim,center)(
-  c''1 ~ c''4
-  <c'2. ~  g' es''> <c'4 g' es''> 
-)
+)verb(
+        melody = \notes \relative c' {
+)COMMENT(
 
-dit(Hairpins)
-Crescendi and decrescendi can be printed in hairpin style.  The
-starting marker for the crescendo is code(\<), and for the decrescendo
-code(\>).  Both have code(\!) as the ending marker.
-mudela(fragment, verbatim)(
-   c4 \< \! c4 \> \! c2
-      < c1
-        { s4 \< \! s4 \> \! s2 } >
-)
-This example shows a trick: by attaching the markings to space rests
-that run parallel to the whole note, you can have dynamic markings
-within a note. 
+)The structure of the file will be the same as the previous one, a
+code(\score) block with music in it.  To keep things readable, we will
+give the different parts of music names, and use names to construct
+music within the score block.
 
+verb(
+        \partial 8;
 )
 
-It is your job to make sure that each spanner that you start, also
-ends.  If it doesn't, then Bad Things are likely to happen. If you end
-spanners that are not started, LilyPond will warn you about illegal
-ending markers.
-
-sect(Commands)
-label(sec:commands)
-
-We have focused on printing notes. Notation contains many other
-constructs, constructs that help you with reading those notes.
-Examples of such constructs are clefs, time signatures, keys etc.
-LilyPond will try to generate these constructs as much as possible,
-but not all such hints can be inserted automatically, and you can also
-override some of the settings.  This can be done by inserting various
-commands between the music.  The general form of these commands is
-COMMENT(
-
-)center(code(\keyword argument argument ... ;))
+The piece starts an anacrusis of one eighth.  COMMENT(
 
-These are the commands that are currently supported:
-description(
-dit(code(\bar) var(bartype))
-  This command makes LilyPond print special bar
-  lines and repeat symbols.  You can also use it to allow line breaks
-  when entering cadenzas.  The argument var(bartype) is a string that
-  describes what kind of bar line to print.
+)verb(
+        c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
+        c4 c8 d [es () d] c4 | d4 es8 d c4.
+        \bar "|.";
+)COMMENT(
 
-mudela(fragment,verbatim)(
-    \bar "|:"; c'4 \bar ":|:";    c'4  \bar ":|";  c'4 \bar "||";
-    c'4 \bar "empty"; c'4 \bar "|.";
-)
+)We use explicit beaming.  Since this is a song,  we will turn automatic
+beams off, and use explicit beaming where needed.COMMENT(
 
-  The command `code(\bar "empty")' does not create any visible bar
-  line, but it tells LilyPond to allow a linebreak at that
-  position.  The `code(\bar)' command prints the specified symbol
-  immediately.  If you give a `code(\bar)' command at the end of a
-  measure then the specified symbol replaces the automatic bar line;
-  otherwise the specified symbol appears in the middle of the measure.
-  The code(\bar) command does not affect metric structure.
-
-dit(code(\cadenza) var(togglevalue)) This command toggles the
-automatic printing of barlines.  `code(\cadenza 1)' turns off the
-automatically generated bar lines.  They are switched on again with
-`code(\cadenza 0)'. Then a bar line is printed, and LilyPond will act
-as if you are again at the start of a measure.
-
-
-This is useful when typesetting music without a meter (such as an ad
- libitum cadenza).
-
-dit(code(\clef) var(clefname)) This command sets the current clef for notation,
-  i.e., a clef symbol is printed and the notes following this command
-  are shifted vertically.  The argument is a string, the name of the
-  new clef. The default clef is the treble clef.
-  mudela(fragment,verbatim)(
-    \clef "bass"; c'4
-    \clef "treble"; c'4
-    \clef "alto"; c'4    
-  )
-
-dit(code(\key) var(pitch) var(type)) This command changes the current
-  key signature.  The key signature is printed at the start of every
-  line. The var(type) argument is set to code(\major) or code(\minor)
-  to get major or minor keys, respectively. Omitting the second
-  argument gives major keys. The key of C-minor can thus be specified
-  as `code(\key es)' or `code(\key \c minor)'. 
-  
-dit(code(\keysignature) var(pitchlist))
-
-This command changes the current key signature.  Unlike the
-`code(\key)' command, this command can produce arbitrary key
-signatures, which can be useful for unconventional keys or modes.  The
-key signature is given in the form of a list of notes.  The notes will
-be printed in the key signature in the order that they appear on the
-list.  For example, the key of C-minor can be specified as
-`code(\keysignature bes es as)'.  The command `code(\keysignature fis
-es bis)' provides a more exotic example.
-
-
-dit(code(\time) var(numerator)code(/)var(denominator))
-  This command changes the current time signature.
-  The default value for this time signature is common time (4/4).
-
-dit(code(\partial) var(duration))
-  This command allows you to make
-  upsteps at the start of a piece.
-  The var(duration) argument has the same form as the duration of a
-  note.
-
-The `code(\partial)' command cannot be used to generate partial
-measures in the middle of the music.  
-Example:
-  mudela(fragment,verbatim)(
-    \time 4/4;
-    \partial 4;
-    [d'8 dis'] e' c''4 e'8 c''4 
-  )
-
-dit(code(\grouping) var(durationslist)) sets the metric structure of the measure.
-    Its effect can best be shown by an example:
-    mudela(fragment,verbatim)(
-        \time 5/16;
-        \grouping 16*3 16*2;
-        [c'8 c'16 c'8]
-        \grouping 16*2 16*3;
-        [c'8 c'16 c'8]
-        \grouping 16*5 ;
-        [c'8 c'16 c'8]
-    )
-
-In practice, you won't be needing this command very often: the
-grouping is switched automatically when you issue a code(\time)
-command.  It is set to a combination of groups
-of 2 and 3 beats, with as many groups of
-3 as possible (in other words: 4/4 is divided in two times two beats
-(2+2), 8/8 in 3+3+2)
-)
+)verb(
+        }
+)COMMENT(
 
-The commands described above aren't really music, but they can best be
-thought as as notes with no duration.  Since they are grammatically
-equivalent to notes, these commands can be used in the same places as
-notes:
-
-sect(Notation context)
-
-COMMENT(This section is about translation contexts, a topic of LilyPond that
-is somewhat advanced.  You don't have to understand this to use
-LilyPond to print simple music.  If you don't want to typeset fancy
-polyphonic music or tweak the LilyPond notation engine, you can skip
-the next two sections.)
-
-In bind(Section)ref(tutorial:more-staffs) it was explained that there
-are more ways to notate a simple chord: as a single voice on a single
-staff or in multiple staffs (and we'll soon see, that you can typeset
-it as multiple voices on a staff).  Obviously the concept of staff is
-not really something musical.  But what is it then?
-
-The most simplistic explanation is: a staff is a graphic peculiarity
-of the notation system.  In other words, a staff is a graphic device,
-a special picture of five lines on which one can print note heads.  We
-will call this view on the concept of staff `staff symbol' from now
-on.
-
-But 
-there is more to a staff than just the symbol.  A staff
-contains---besides a staff symbol--- some more components:
-itemize(
-it()A staff can have a key signature (printed at the left)
-it()A staff can have a time signature (printed at the left)
-it()A staff has bar lines
-it()A staff has a clef (printed at the left)
-) COMMENT(
+)This ends the definition of code(melody).  Note that there are no
+semicolons after assignments at top level.COMMENT( 
 
-)
-To explain what a staff really is, we'll try to print music without
-these components.   Without those, it is still
-possible to print music:
-mudela()(\score{
-\notes \relative c' {  \time 2/4; g'4 c,4 a'4 f4 e c d2 }
-\paper { 
-  linewidth = -1.;
-  \translator {
-  \StaffContext
-  \remove "Time_signature_engraver";
-  \remove "Bar_engraver";
-  \remove "Staff_symbol_engraver";
-  \remove "Clef_engraver";
-  \remove "Key_engraver";
-  }
- }
-})COMMENT(
-
-) As you can see, you can still make out the general form of the
-melody and the rhythm that is to be played, but the notation is
-difficult to read.  Moreover, the musical information is not complete.
-The stress pattern in the notes can't be deduced from this output.
-For this, we need a time signature:
-
-mudela()(
-\score {
-  \notes \relative c' {  \time 2/4; g'4 c,4 a'4 f4 e c d2 }
-  \paper{
-  linewidth = -1.;
-\translator{
-  \StaffContext
-  \remove "Bar_engraver";
-  \remove "Staff_symbol_engraver";
-  \remove "Clef_engraver";
-  \remove "Key_engraver";
-  }}
- }) COMMENT(
-
-)Technically speaking you know where the strong and weak beats are, but
-it is difficult to find them quickly.   Bar lines  help you in finding
-the location  of the notes within the measure:
-mudela()(
-\score {
-  \notes \relative c' {  \time 2/4; g'4 c,4 a'4 f4 e c d2 }
-  \paper{
-  linewidth = -1.;
-\translator{
-  \StaffContext
-  \remove "Staff_symbol_engraver";
-  \remove "Clef_engraver";
-  \remove "Key_engraver";}
-  }
- }
-)
+)verb(
+        text = \lyrics {
+)COMMENT(
 
-We can remedy part of the difficulties with reading pitches by adding a staff
-symbol:
+)Another identifier assignment.  This one is for the lyrics. 
+Lyrics are formed by syllables that have duration, and not by
+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 {). COMMENT(
 
-mudela()(\score{
-  \notes\relative c' { \time 2/4; g'4 c,4
-a'4 f4 e c d2 } \paper {
-  linewidth = -1.;
-  \translator {
-  \StaffContext
+)verb(
+        The4 ri -- ver is flo- __ wing,  flo -- wing and gro -- wing, the
+        ri- ver is flo- __ wing down to the sea.
+        }
+)COMMENT(
 
-  \remove "Clef_engraver";
-  \remove "Key_engraver";
-  }
- }
-})COMMENT(
+)The syllables  themselves are  separated by spaces.  You can get syllable
+extenders by entering `code(__)', and centered hyphens with
+`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.)
+COMMENT(
 
-)
-This makes the output decidedly easier to read, but you still don't
-know what the pitches of the notes above are.  So this is still not
-enough.  But suppose you see the following notation:
-mudela()(\score {
-  \notes \relative c' {\clef alto;  \time 2/4; g'4 c,4 a'4 f4 e c d2 }
-  \paper {
-    linewidth = -1.;
-  }
-})COMMENT(
-
-) Now you know the pitch of the notes: you look at the start of the line
-and see a clef, with this clef, you can determine the notated pitches.
-You have found the em(context) in which the notation is to be
-interpreted!
-
-So the context determines the relationship between a piece of music
-and its notation: you, the reader, use context to deduce music from
-notation.  Because LilyPond is a notation writer instead of a reader,
-context works the other way around for Lily: with context a piece of
-music can be converted to notation.
-
-We see that a staff forms context, and that context is needed to
-convert between notation and music.  In LilyPond we turn around this
-reasoning: LilyPond has a notion of notation context, and the staff is
-just one example of a notation context.  In fact, the arguments of the
-code(\type) command (Staff, GrandStaff) were all names of different
-contexts.
-
-We make one final observation before listing the standard notation
-contexts.  A score can contain many staffs; A staff can contain many
-voices.  This suggests that notation contexts are objects that can be
-nested.
-
-The following is a list of the contexts that are supported by
-LilyPond.  Each notation context is characterised by its name, the
-notation elements it creates, and the contexts that it can contain.
-description(
-dit(Voice) The code(Voice) context is a context that corresponds to a
-  voice on a staff.  This context handles the conversion of noteheads,
-  dynamic signs, stems, beams, super- and subscripts, slurs, ties and rests
-
-dit(Staff) The code(Staff) context handles clefs, bar lines, keys,
-  accidentals.  A code(Staff) context can contain code(Voice)
-  contexts.
-
-dit(RhythmicStaff) The code(RhythmicStaff) context is like the staff,
-  but much simpler: the notes are printed on one line, and pitches are
-  ignored.  code(RhythmicStaff) can contain code(Voice) contexts.
-
-dit(GrandStaff) A code(GrandStaff) context contains code(Staff)
-  contexts, and it adds a brace to the output at the
-  nop(left.)footnote(This is a major deficiency in the current
-  implementation.  Currently stems, slurs and beams cannot be printed
-  across two staffs.  In reality, a grand staff is a hybrid of one big
-  staff and two stacked staffs.)
-  
-  A code(GrandStaff) context can contain 
-  code(Staff)s. Typically, it will contain two code(Staff)s, one
-  treble staff, and one bass staff. The bar lines of the contained
-  staffs are connected vertically.
-
-dit(StaffGroup) A code(StaffGroup) context contains code(Staff) or
-  code(Lyrics) contexts, and prints a bracket at the left.  The bar
-  lines in the participating staffs are connected.
-
-dit(Lyrics) As its name suggests, The code(Lyrics) context deals with
-  typesetting lyrics.  This topic will be covered in
-  bind(Section)ref(tutorial:lyrics).
-  
-dit(Score) The code(Score) context is the toplevel context: no context can
-  contain a code(Score) context.  The code(Score) context handles the
-  administration of time signatures.  It also makes sure that items
-  such as clefs, time signatures, and key-signatures are aligned across staffs.
-  
-  The code(Score) can contain code(Staff), code(StaffGroup),
-  code(Lyrics), code(GrandStaff) and code(RhythmicStaff) contexts.
+)verb(
+        accompaniment =\chords {
+)COMMENT(
 
-COMMENT(do ChoireStaff)
-)
+)We'll put chords over the music.  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.
+COMMENT(
 
+)verb(
+        r8
+)COMMENT(
 
-If you are familiar with structured documents, you might see the
-analogy of a context with a stylesheet: a stylesheet is neither
-presentation nor information, but rather a recipe em(how) a specific
-piece of information should be presented.  The big difference with
-stylesheets is that in music notation the elements provided by context
-are essential to understanding what is notated.
+)There is no accompaniment during the anacrusis.COMMENT(
 
-The notions of ``current clef'' and ``current position within the
-measure'' are all properties of notation contexts.  Commands like
-code(\clef) and code(\cadenza) change these properties, and this
-explains why they are fundamentally different from musical expressions
-like notes and rests.
+)verb(
+        c2-3- f-3-.7
+)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.COMMENT(
 
-A notation context is not a primitive element of LilyPond, but rather
-  Later on, in bind(Section)ref(tutorial:engravers) we will explain
-  how you can create your own contexts.
+)verb(
+        d-min es4 c8-min r8
+)COMMENT(
 
+)Some modifiers have predefined names, eg. code(min) is  the same as
+code(3-), so code(d-min) is a minor code(d) chord.COMMENT(
 
-sect(Nested music: multiple staffs)
-label(tutorial:more-staffs)
+)verb(
+        c2-min f-min7 g-7^3.5 c-min }
+)COMMENT(
 
-Now we explain how to typeset music that runs in multiple staffs.
-Consider the following---somewhat unrealistic---example:
+)A named modifier code(min) and a normal modifier code(7) do not have
+to be separated by a dot.  Tones from a chord are removed with chord
+substractions.  Substractions 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. COMMENT(
 
-mudela(fragment)(
- \type GrandStaff <e'4 {\clef bass; g4^""} >
-)
+)verb(
+        \score {
+                \simultaneous {
+)COMMENT(
 
-In this example the music consists of two notes.  The above would
-sound the same if it were written as a single chord on a single staff,
-i.e., COMMENT(
+)We assemble the music in the code(\score) block.  Melody, lyrics and
+accompaniment have to sound at the same time, so they should be
+code(\simultaneous).COMMENT(
 
-)mudela(fragment)(
-        <g4 e'4>
+)verb(
+        %\accompaniment
 )COMMENT(
 
-) The Mudela construct for multiple staffs reflects the similarity
-between the two examples: to get multiple staffs in Mudela you enter a
-chord, with an additional instruction to tell LilyPond that the chord
-does not represent notes stacked together, but staffs stacked
-together.
-
-If a piece of music is to be interpreted as a staff, then this can be
-expressed with the code(\type) construct.  The following input says
-``the quarter note with pitch e should be put on a staff.''
+)Chord mode generates notes grouped in code(\simultaneous) music.  If
+you remove the comment sign, you can see the chords in normal
+notation: they will be printed as note heads on a separate
+staff. COMMENT(
 
-verb(
-  \type Staff e'4 
+)verb(
+        \context ChordNames \accompaniment
 )COMMENT(
 
-) The same can be done for the other note, i.e.,
+)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 em(context).  In
+LilyPond, these symbols are created by objects called `interpretation
+context'.  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'.
 
-verb(
-  \type Staff g4 
-) COMMENT(
+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
+mechanism in action.
 
-) If you want to stack these staffs, you must create a chord of both:
 
-verb(
-  < \type Staff e'4
-    \type Staff g4 
-  >
-)
+We don't want default contexts here, because we want 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.
+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
+Staff \accompaniment), and get the same effect.COMMENT(
 
-This looks reasonable, but the effect of this input is not what you
-might expect:
-mudela(fragment)(
-  < \type Staff e'4
-    \type Staff g4 
-  >
+)verb(
+        \addlyrics
 )COMMENT(
+        
+)The lyrics need to 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. (Besides, it looks
+silly.)COMMENT(
 
-) Since there are no names specified for the desired staffs, LilyPond
-thinks your wishes are fullfilled by putting the code(g) on the same
-staff as the code(e).  The correct solution is to label both staffs
-with different names, for example code(trebleStaff) and
-code(bassStaff).  This makes LilyPond distinguish between them, and
-create two staffs:
-
-mudela(verbatim,fragment)(
-  < \type Staff = trebleStaff e'4
-    \type Staff = bassStaff  g4 
-  >
+)verb(
+        \context Staff = mel {
 )COMMENT(
 
-) The names that you choose do not matter just as long as they are
-different.  This is almost right, except for the brace at the left and
-the clef of the second staff.  If you want a brace, then you have to
-tell LilyPond that the chord you just formed is to be interpreted as a
-so-called grand staff.  This is also done with the code(\type)
-command.  The bass clef is made with a clef command:  COMMENT(
+)This is the argument of code(\addlyrics).  We instantiate a
+code(Staff) context explicitly: should you chose to remove 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.COMMENT(
 
-) mudela(verbatim,fragment)(
-  \type GrandStaff <
-        \type Staff = treblestaff e'4
-        \type Staff = bassstaff { \clef "bass"; g4 }
-  >)COMMENT(
+)verb(
+        \property Staff.noAutoBeaming = "1"
+)COMMENT(
 
-)
+)An interpretation context has variables that tune its behaviour.  One
+of the variables is code(noAutoBeaming).  If set and non-zero (i.e.,
+true) LilyPond will not try to put automatic beaming on the current
+staff.COMMENT(
 
-sect(Polyphonic music (or: Notation context properties))
-label(sec:polyphonic)
-
-In the section on notation contexts we explained that a notation
-context can have properties that influence the conversion from music
-to notation.  A simple example of such a property is the clef: the
-type of a clef helps determines the vertical position of note heads in
-a staff.  Some of these properties can be modified by commands such as
-code(\clef) and code(\time).  But there is more: notation contexts
-also have properties are settable in a generic fashion.  We will
-demonstrate this feature by printing multiple voices on a staff.
-
-Printing more than one voice on a staff, is not unlike printing
-multiple   staffs stacked together.  This suggests that  the template
-to follow  is this:
-verb(
-  \type Staff <
-    \type Voice = one  ...
-    \type Voice = two  ...
-  >
-) COMMENT(
+)verb(
+        \property Staff.automaticMelismata = "1"
+)COMMENT(
 
-) On the ellipsis there should be music going from left to right, in
-other words, notes enclosed in braces.  Let us try the following
-simple melodies:
-
-mudela(fragment,verbatim)(
-\type "Staff" <
-  \type "Voice" = "one" { r4 as'4 () as'4 g'4 }
-  \type "Voice" = "two" { g'2 f'4 e'4 }
->)
-
-As you can see the result is not quite perfect.  The notes on the last
-two beats look like plain chords and not like separate voices.  What
-really happened was that the stems of the upper and lower voices were
-printed on top of each other.
-
-To remedy this, engravers traditionally make the stems of the lower
-voice point down, and the stems of the upper up, as shown in
-bind(Figure)ref(tutorial:multi-voice-fig).
-
-Surely the direction of a single stem is a property of the stem as a
-graphical object.  But the fact that all of the stems in a voice point
-in the same direction is not directly graphical.  Since this is a
-property shared by all the stems in the voice, this property is a
-property of the context code(Voice).  The context code(Voice) has an
-attribute whose value is the direction to use for stems.  You can
-change it to `up' by issuing the following phrase:
-verb(
-  \property "Voice"."ydirection" = "1"
-)
+)Similarly, we  don't want to print a  syllable when there is
+a slur. This sets up the Staff context to signal slurs while
+code(\addlyrics) is processed. COMMENT(
 
-This command should be read as ``change the property called
-code(ydirection) within the current code(Voice) context to the value
-code(-1).''  For the property code(ydirection) the value code(1) means
-`up', and code(-1) means `down'. So, the
-proper way to code the polyphonic example is given in
-bind(Figure)ref(tutorial:multi-voice-fig).
-
-latexcommand(\begin{figure}[h])
-mudela(fragment,verbatim,center)(
-  \type "Staff" <
-    \type "Voice" =  "one"  {
-      \property Voice.ydirection = "1"
-      r4 as'4 () as'4 g'4 }
-    \type "Voice" =  "two"  {
-      \property Voice.ydirection = "-1"
-      g'2 f'4 e'4 }
-  >
-)
-    latexcommand(\caption{multiple voices})
-    label(tutorial:multi-voice-fig)
-latexcommand(\end{figure})
-
-As you can see, this property also controls the directions of slurs,
-which explains the name code(ydirection).COMMENT(hmm)
-
-
-Other properties can also be set, and they can be within different
-contexts.  In general, you can set a property by specifying
-code(\property) var(contexttype)code(.)var(propertyname) code(=)
-var(value).  Both var(contexttype), var(propertyname) and var(value)
-should be strings.
-
-The effect of a property is pretty much hardwired into the
-implementation (and thus subject to change), so we will not deal with
-all the possible properties in detail. Among other characteristics that
-can be set are the layout of slurs and beams.  The initialisation file
-file(property.ly) explains most properties.
-
-sect(Lyrics)
-label(tutorial:lyrics)
-
-Since a lyrics can have durations just like notes, we consider them to
-be music too.  Entering lyrics in mudela has two aspects. First, you
-have to enter the text, i.e., the syllables along with their
-durations.  After this, you have to specify how to convert these to
-graphics.
-
-Lyrics consist of syllables, which are strings together with
-durations.  Previously we only entered note names, so for entering
-lyrics we have to instruct LilyPond that what we enter are not note
-names but strings.  This instruction is the keyword
-code(\lyrics).  After entering this keyword you can enter a musical
-construct---sequential music, simultaneous music, code(\type)
-entries, etc.--- but with syllables instead of pitches.  For example:
-COMMENT(
+)verb(
+          \melody
+        }
+)COMMENT(
 
-)verb(\lyrics { 'got8 me on my knees4, Le-8 lie! })COMMENT(
+)Finally, we put the melody on the current staff.  Note that the
+code(\property) directives and code(\melody) are grouped in sequential
+music,  so the property settings are done before the melody is
+processed.  COMMENT(
 
-) Next comes the conversion to notation.  LilyPond can't (yet) figure
-out that lyrics need different treatment than notes.  As a result, the
-default conversion will try to put the text you entered as note heads
-onto a staff, and this will fail.  This default must be overridden
-with a code(\type) keyword.  Printing syllables of text in a line is
-done by a context called code(Lyrics).  You can select this context
-with the code(\type) keyword.  Here is a simple example:
-COMMENT(
+)verb(
+        \context Lyrics \text
+)COMMENT(
 
-)mudela(fragment,verbatim)(
-\type Lyrics \lyrics { 'got8 me on my knees,4 Le-8 lie! })COMMENT(
+)The second argument of code(\addlyrics) is the text. The text also
+should not land on a Staff, but on a interpretation context for
+syllables, extenders, hyphens etc.  This context is called
+Lyrics.COMMENT(
 
-)The result is technically correct, but it needs a melody to make it
-performable: COMMENT(
+)verb(
+        }
+)COMMENT(
 
-)mudela(fragment,verbatim)(
-  <
-    \type Staff  { c''8. c''16 bes'8. a'16 g'4 f'8 g'4. }
-    \type Lyrics \lyrics { 'got8. me16 on8. my16 knees,4 Le-8 lie!4. }
-  >
-) COMMENT(
+)This ends code(\simultaneous).COMMENT(
 
-) The strings that makes up each syllable in the lyrics block are
-passed along to TeX() verbatim, so if you are proficient with TeX()
-you can do various nifty things.  Just keep in mind that a syllable
-either starts with a letter (a character in the range `code(a)' to
-`code(z)' or `code(A)' to `code(Z)'), or it is a string enclosed
-quotes. It ends with either a number for the duration, or a space.
-These tricks are demonstrated in the following example:
-COMMENT( urg
-\type Lyrics \lyrics { 'got8 m\textbf{e}8 on8. m$\cal_Y$16 knees,4 Le-8 lie!4.}
-\type Lyrics \lyrics { 'got8 m{\bf e}4 on8. m$\cal_Y$16 knees,4 Le-8 lie!4.}
+)verb(
+        \midi  { }
 )COMMENT(
 
-)mudela(fragment,verbatim)(<
-  \type Staff  { c''8. c''16 bes'8. a'16 g'4 f'8 g'4. }
-  \type Lyrics \lyrics { 'got8 me8 on8. m$\cal_Y$16 "3s,"4 Le-8 lie!4.}
->
+)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 { }).COMMENT(
+
+)verb(
+        \paper { linewidth = 10.0\cm; }
 )COMMENT(
 
+)We also want notation output.  The linewidth is short so the piece
+will be set in two lines. COMMENT(
 
-)
-COMMENT(Groen is de kleur van geluk.)
-COMMENT(Dat geldt zeker voor Bj"ork)
+)verb(
+        }
+)COMMENT(
 
-sect(Toplevel Mudela)
+)End the score block.
 
-Back in bind(Section)ref(sec:firsttune) we said we would defer
-discussion of toplevel constructions (e.g., code(\score)) to a later
-moment in time: and now we will look at these constructions.  In
-general, Mudela looks like set of nested `blocks'.  The general syntax
-for a block is code(\keyword { ... }).
+sect(Piano music)
 
-We will now discuss identifiers.  Generally you can define an
-identifier by entering code(identifierName = ... ) where there can be
-a variety of things on the ellipsis.
-COMMENT(
-Here is a (partial) list of what you can abbreviate with identifiers
-at top-level.
-itemize(
-it()The code(\score) block
-it()The code(\paper) block
-it()The code(\midi) block (to be explained in
-  bind(Section)ref(tutorial:sound))
-it()Music (sequential music, simultaneous music etc.)
-it()Durations
-it()Strings
-it()Translators (to be explained in bind(Section)ref(tutorial:engravers))
-it()Integers
-it()Reals  
-)
-)
+Our third subject is a piece 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. COMMENT(Sesam atlas vd
+Muziek. Deel II, blz 414)
 
-When you refer
-to the abbreviated entity, you must precede code(identifierName)
-with a backslash, i.e., code(\identifierName).  For example:
 mudela(verbatim)(
-  czerny = \notes { [c16 g e g] }
-  \score {
-    \notes \type GrandStaff <
-      { c''2 g''2 }
-      { \clef bass; \czerny \czerny \czerny \czerny}
-    >
-    \paper {
-      linewidth = -1.0;
-      stem_length = 6.0*\interline;
-    }
-  }
-)
+\include "paper16.ly";
 
+viola = \notes \relative c' \context Voice = viola {
+        <c4-\f g' c>
+        \property Voice.verticalDirection = \down g'8. b,16
+        s1 s2. r4
+        g
+}
 
-Another interesting feature of this example are the assignments within
-the paper block.  Some blocks, such as code(\paper), have a scope of
-their own.  In the case of the code(\paper) block, these variables
-influence the characteristics of the output.  As is shown, you can
-tune quantities like the stemlength, and enter simple
-nop(expressions.)footnote(The purpose of the negative linewidth is to
-prevent the music from being justified.)  The identifiers that are
-meaningful are for the paper block is strongly implementation
-dependent, so they will not be listed here.  Moreover, since most of
-the values are predefined to sensible defaults, there usually is no
-need to tune these values.
-
-Recall the properties of a context, that could be set with
-code(\property).  It is a very general mechanism to tune the output of
-the music, that is neatly separated from the real music.
-Unfortunately, it is not convenient to type or read, and the precise
-effect of a setting property isn't always apparent from its
-definition.  To remedy this, we can use an identifier to capture the
-meaning of a code(\property).
+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> }
+        <
+          { \times 2/3 { a8 g c } \! c2 }
+          \context Voice = oboeTwo {
+                \stemdown
+                \grace {
+                    \property Grace.verticalDirection = \down
+                    [f,16 g] }
+                f8 e e2
+        } >
+        \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 }
+
+hoomPahHoomPah = { [\hoomPah \hoomPah] }
+
+bassvoices = \notes \relative c' {
+        c4 g8. b,16
+        \hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah
+        \stemdown [c8 c'8] r4
+        <g d'> r4
+        < {\stemup r2 <e4 c'> <c8 g'> }
+          \context Voice = reallyLow  {\stemdown g2 ~ | g4 c8 } >
+}
 
-mudela(verbatim)(
-stemup = \property Voice.ydirection = "1"
-stemdown = \property Voice.ydirection = "-1"
-shift = \property Voice.hshift = "1"
 \score {
-  \type "Staff" \notes <
-    \type "Voice" =  "one"  { \stemup r4 as'4 () as'4 g'4 }
-    \type "Voice" =  "two"  { \stemup \shift g'2 f'4 e'4 }
-    \type "Voice" = "three" { \stemdown [d'8 dis'] [d' cis'] [c' b] c'4 } >
-  \paper{  linewidth = -1.0\pt; }
+        \context PianoStaff \notes <
+                \context Staff = top < \time 2/2;
+                        \context Voice = viola \viola
+                        \oboes
+                >
+                \context Staff = bottom < \time 2/2; \clef bass;
+                        \bassvoices
+                >
+        >
+        \midi { }
+        \paper {
+          indent = 0.0;
+          linewidth = 14.5 \cm; }
 })
 
-Several abbreviations like code(\stemup) are defined in the standard
-initialisation file file(property.ly).  Setting or changing context
-properties can have a similar effect as the commands that were
-discussed in bind(Section)ref(sec:commands).  Don't be fooled by the
-similarity in appearance between a declared property-setting entry and
-a real command like code(\clef) or code(\bar).  Real commands are
-hardcoded into the language and they have to be terminated by
-semicolons.
-
-You can also use identifiers to break up the heavy nesting that can
-occur in the code(\score) block.  Another useful application is
-parametrisation of the music: if you use identifiers in the
-code(\score) block, you can make variations of the music by simply
-redefining those identifiers.  One particular application of this is
-part extraction: by using identifiers and redefining them, one can
-print extracted parts and a full orchestral score from the same music
-definition.
-
-
-sect(Sound output)
-label(tutorial:sound)
-
-You get output by combining music with definition a conversion to
-output.  LilyPond currently supports one other conversion besides
-notation: the conversion from abstract music to sound. You can have
-LilyPond play the music that you entered.  The format that is used for
-this output is MIDI.  The result is not very pretty, but it is useful
-for prooflistening your files: typing errors stand out when you
-listen, especially if they involve accidentals.
-
-The only information that you need to enter is the
-tempo. (Unfortunately, at this time, this the only thing that can be
-tuned.  The syntax for the tempo is code(\tempo )var(duration) =
-var(beatsperminute);), for example: COMMENT(
+If it looks like incomprehensible gibberish to you... Then you are
+right.  The author has doctored this example to have as many quirks in
+one system as possible.COMMENT(
 
+)verb(viola = \notes \relative c'  \context Voice = viola {)COMMENT(
 
-)verb(
-\score {
-   ...music...
-   \midi { \tempo 4 = 76; }
-}) COMMENT(
+)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 nop(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.).COMMENT(
 
-)
+)verb(<c4-\f g' c>)COMMENT(
 
-sect(Contexts revisited: engravers)
-label(tutorial:engravers)
-
-As was promised, we will now take a dive into the more wizardrous parts
-of LilyPond: redefining (notation) contexts.  We previously explained
-that a context 
-itemize(
-it()has a name
-it()is a conversion from music to notation,
-it()can contain other contexts
-it()handles specific notation constructs
-)
+)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.COMMENT(
 
-This characterization almost automatically explains what the definition of a
-context should look like:
-itemize(
-it() It should have a name
-it()It should be part of the ``notation output definition,'' i.e., the
-  code(\paper) block
-it()
-  It should contain a specification of what other contexts may be contained
-  in the context we're defining.
-it()
-  It should contain a list of the notation constructs  to be
-  handled.
-)
+)verb(\property Voice.verticalDirection = \down)COMMENT(
 
-LilyPond can create notation for a large number of symbols.  This code
-is split up into basic building blocks. Each building block is called
-an em(engraver), and an engraver generally handles only one notation
-construct: the code(Clef_engraver) takes care of the clefs, the
-code(Time_signature_engraver) takes care of printing time signatures.
+)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)
+(identifier for the integer -1) the stems go down
+code(\up) (identifier for the integer 1) makes the stems go up.COMMENT(
 
-A notation context is formed by a group of engravers.  A special class
-in LilyPond---the code(Engraver_group_engraver)---allows engravers to
-cooperate in a group.  A variant of this grouping object is the
-code(Line_group_engraver_group), which puts the output of all the
-engravers (clefs, bars, etc) into a compound object, so that these
-symbols can be treated as a whole.
+)verb(        g'8. b,16)COMMENT(
 
-This explains the following definition, which is a simplified Staff context:
-verb(
-\translator
-{
-        \type "Line_group_engraver_group";
-        \name Staff ;
-
-        \consists "Bar_engraver";
-        \consists "Clef_engraver";
-        \consists "Key_engraver";
-        \consists "Local_key_engraver";
-        \consists "Time_signature_engraver";
-        \consists "Staff_symbol_engraver";
-
-        defaultClef = treble;
-          
-        \accepts "Voice";
-}) COMMENT(
-
-) This context, named Staff, puts its graphic objects into a compound
-object (a so-called ``Line group'').  At Staff level, bars, clefs,
-keys, accidentals, time signatures and the staff symbol are handled.
-A staff can contain a Voice context.  You can also preset properties
-of contexts: for instance, the clef that is printed upon starting a
-Staff, is the treble clef.
-
-You can also declare contexts, and reference them.  This is useful in
-combination with code(\remove "..."): code(\remove) does the opposite
-of code(\consists).
-
-The real context definitions are in the standard initialisation
-file file(engraver.ly).
-
-As a practical example, we will show how to typeset polymetric music,
-i.e., music where the meter can differ for each staff.  The solution
-is not very complicated: normally all timing information (time
-signature, rhythmic grouping) is synchronised across each staff.  This
-is done by having only one administration for timing information: in
-the default configuration there is only one code(Timing_engraver), in
-the code(Score) context.
-
-All staffs use the information in the code(Timing_engraver) for
-generating bar lines and time signatures.  So, we can have different
-timing for every staff, by moving the code(Timing_engraver) into the
- Staff context.
+)Relative octaves work a little differently with chords.  The starting
+point for the note following a chord is the first note of the chord.  So
+the code(g) gets an octave up quote: it is a fifth above the starting
+note of the previous chord (the central C).
 
-mudela(verbatim)(
-  \score {
-   \notes <
-     \type Staff = one { \time 2/4; c'4 c'4 c'4 c'4 c'4 c'4 }
-     \type Staff = two { \time 3/4; c'4 c'4 c'4 c'4 c'4 c'4 }
-   >
-   \paper { 
-     linewidth = -1.;
-     \translator {
-       \ScoreContext
-       \remove "Timing_engraver";
-     }
-     \translator {
-       \StaffContext
-       \consists "Timing_engraver";
-     }
-  }
-}
-)
+verb(s1 s2. r4)COMMENT(
+
+)code(s) is a `spacer' rest.  It does not print anything,  but it does
+have duration of a rest.   COMMENT(
 
+)verb(oboes = \notes \relative c'' \context Voice = oboe {)COMMENT(
 
-sect(Urtexts and context selection)
-label(tutorial:urtext)
+)Now comes a part for two oboes.  They play homophonically, so we
+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).COMMENT(
 
-In bind(Section)ref(tutorial:more-staffs), we have shown you how to
-make multiple staffs, and explained that you have to label every staff
-(or more precisely: different contexts), to make sure that new ones
-are created when you need them.  In this section, the real power of
-this mechanism will be unveiled.
+)verb(\stemup s4  g8. b,16 c8 r <e'8.-\p g> <f16 a>)COMMENT(
 
-By naming other contexts that you create, you can reference other
-contexts than the current context from within the music.  For example,
-from within the music that you enter for staff code(One), one could
-enter a small piece of music, and send it to staff code(Two), e.g.,
+)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.
 COMMENT(
 
-) mudela(fragment,verbatim)(
-  <
-    \type Staff = one { c''4 \type Staff = two { c4 c4 } c''4 }
-    \type Staff = two { \clef bass; g,4 g,4 g,4 g,4  }    
-  >
-)
+)verb(\grace <e8( g> < )d4 f> <c2 e>)COMMENT(
 
+)code(\grace) introduces grace notes.  It takes one argument, in this
+case a chord.  The slur started on the code(e) of the chord
+will be attached to the next nop(note.)footnote(LilyPond will squirm
+about unended Slurs.  In this case, you can ignore the warning).
+COMMENT(
 
+)verb(\times 2/3)COMMENT(
 
-The mechanism of context selection can be used to fabricate an
-nop(Urtext)footnote(em(Urtext) is the German word for `original text'.
-The Urtext edition of a piece of music, is an edition that reflects
-the original writing of the composer.  Such editions are useful for
-musicologists, and performers that want to perform authentic
-interpretations.  However, for mere mortals, the Urtext can be quite
-hard to read.  It might not contain fingering and beaming, and
-typically it is full of footnotes.  Moreover, common interpretations
-may have emerged---after the composer died.  For this reason, the
-music that can be had as Urtext usually is also available in enhanced
-and edited editions.  ) and an edited edition from em(one source).  We
-will use the first few bars of bind(J.)bind(S.)Bach's first Cello
-suite to demonstrate this.  The example makes heavy use of space
-rests; here they are used as a placeholder to attach articulation
-marks to.  
+)Tuplets are made with the code(\times) keyword.  It takes two
+arguments: a fraction and a piece of music.  The duration of the
+second argument is multiplied by the first argument.  Triplets make
+notes occupy 2/3 of their notated duration, so in this case the
+fraction is 2/3. COMMENT(
 
-mudela(verbatim)(
-  bach =  \notes \relative c { [g16 d' b' a] [b d, b' d,] }
-  
-  staffStuff = \notes { \clef bass; \time 4/4; s1 \bar "|."; }
-  
-  slursOne = \notes { s16( s s s s16 s s )s }
-  slursTwo = \notes { s16-. s s() s s16() s  s ()s }
-
-  \score{
-    { < \type Voice = celloVoice { \bach \bach }
-        \type Voice = celloVoice { \slursOne \slursOne }
-        \staffStuff
-      >
-      <
-        \type Voice = celloVoice { \bach \bach }
-        \type Voice = celloVoice { \slursTwo \slursTwo }
-        \staffStuff
-      >
-    }
-    \paper { linewidth = -1.;}
-  }
-)
-
-The slurs that you define should be put on the music that is defined
-by the code(\bach) identifier.  By labeling a code(Voice) context, and
-directing both the articulation and the notes to that same code(Voice)
-context, the articulation is put over the right notes.
+)verb({ <d8 \< f> <e g> <f a> })COMMENT(
 
+)The piece of music to be `tripletted' is sequential music containing
+three notes.  On the first chord (the code(d)), a crescendo is started
+with code(\<).COMMENT(
 
-sect(Transposing)
-label(tutorial:more-grammar)
+)verb(<)COMMENT(
 
+)At this point, the homophonic music splits into two rhythmically
+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: COMMENT(
 
-One of the things that you can do with music is
-em(transposing) it.  If you want to transpose a piece of music, then
-you should prefix the keyword code(\transpose) along with the pitch
-(relative to the central C) for the transposition.footnote(the
-code(\type Staff) is to make sure that no separate staffs are created
-for the code(\scale) and code(\transpose cis' \scale) part.)
+)verb( { \times 2/3 { a8 g c } \! c2 })COMMENT(
 
+)The crescendo is ended at the half note by the escaped exclamation
+mark `code(\!)'.  COMMENT(
+         
+)verb(\context Voice = oboeTwo {
+\stemdown)COMMENT(
 
-mudela(verbatim)(
-scale = \notes \relative c' { [c8 d e f] }
-\score {
-  \notes {
-    \type Staff { \scale \transpose cis'  \scale }
-    }
-  \paper { linewidth = -1.0; }
-})
+)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. COMMENT(
 
+)verb(\grace { )COMMENT(
 
-sect(Staff switching)
+)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
+code(\grace) is sequential music.COMMENT(
 
-We have seen that contexts can be nested.  This means that they form a
-tree.  It is possible to edit this tree: for example, a code(Voice)
-context can be taken out of a code(Staff) context, and put into
-another.  This has the effect of the voice switching staffs (something
-that often happens in keyboard music).  The syntax for this operation
-with these particular contexts is code(\translator Staff = newStaffName).
+)verb(\property Grace.verticalDirection = \down
+[f,16 g] })COMMENT(
 
-The effect is analogous to the first example in section
-ref(tutorial:urtext), but with the code(\translator) construction it
-is possible to split the real music and the commands that determine in
-which staff the music is printed.  For example:
+)Normally, grace notes are always stem up, but in this case, the upper
+voice interferes. We set the stems down here.
 
-mudela(verbatim)(
+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).
+COMMENT(
 
-% real music
-aVoice = \type Voice = voiceA \notes { c''4 c4 c4 c''4 }
-bVoice = \type Voice = voiceB \notes { g,4 g,4 g,4 g,4  }    
+)verb(
+  f8 e e2
+} >)COMMENT(
 
-% staff switching stuff
-switch = \type Voice = voiceA \notes { s4 \translator Staff = staffB s4
-                  s4 \translator Staff = staffA s4 }
+)This ends the two-part section. COMMENT(
 
-\score {
-  <
-    \type Staff = staffA < \aVoice \switch >
-    \type Staff = staffB < \bVoice \clef bass; >
-  >
-  \paper { linewidth = -1.; }
-}
-)
+)verb(\stemboth
+\grace <c,8( e> <)b8. d8.-\trill> <c16 e> | )COMMENT(
 
-Don't try to switch staffs when you are in the middle of a slur or
-beam, though: the spanners won't switch along.
+)code(\stemboth) ends the forced stem directions. From here, stems are
+positioned as if it were single part music.
 
-sect(Hairy durations: triplets)
+The bass has a little hoom-pah melody to demonstrate parts switching
+between staffs.  Since it is repetitive, we use identifiers:COMMENT(
 
-OUTDATED
+)verb(hoomPah  = \notes \transpose c' {)COMMENT(
 
-In the previous section we explained an operation that changes the
-pitches of music, transposition.  In this section we will explain an
-operation that modifies the duration of the notes that you enter.
-When notes are part of a triplet, then the real of duration of the
-notes are 2/3 part of what their shape indicates:
-mudela(fragment)(
-\times 2/3 {  c'4 c'4 c'4 }
-)
+)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 is a no-op.  Central C is transposed to
+central C.
 
-To support this notion, Mudela allows you to modify the duration of a
-note by multiplication or division.  A code(c'4) note that would be in  a
-triplet is written as code(c'4*2/3).  If you sequence a few of these
-notes, you get a triplet.footnote(We added a normal staff in the example to
-show the difference.)
-mudela(fragment,verbatim)(
-<  \type Staff = staffA { \times 2/3 { c'8 c'8 c'8 } c'4}
-   \type Staff = staffB { c''8 c''8 c''4 } >)
-
-LilyPond knows that these notes are no normal eighth notes, but the
-reader doesn't yet.  To help the reader a beam or a bracket with a `3'
-should be printed.  The special beam command `code([2/3)' and the
-matching close beam `code(]1/1)' will take care of that, and
-they also abbreviate the code(*2/3) part.  If you want brackets in
-stead of beams, you can use `code(\[2/3])' and `code(\]1/1)'.
-mudela(fragment,verbatim)(
-< \type Staff = staffA {
-    \times 2/3 { [ c'8 c'8 c'8 }
-    \times 2/3 {  c'8 c'8 c'8 }
-  }
-  \type Staff = staffB { [c''8 c''8 c''8 c''8] }
->)
-
-Other tuplets  can be entered in the same way.
-mudela(fragment,verbatim)(
-< \type Staff = staffA {
-    \time 7/8;
-    \times 7/6 { [c'8 c'8 c'8 c'8 c'8 c'8] }
-  }
-  \type Staff = staffB {
-    \time 7/8;
-    [c''8 c''8 c''8 c''8 c''8 c''8 c''8] } >
-)
+The purpose of this no-op is circumventing relative mode.  Relative
+mode can not be used in conjunction with transposition, so relative
+mode will leave the contents of code(\hoomPah) alone.  We can use it
+without having to worry about getting the motive in a wrong
+nop(octave)footnote(code(hoomPah = \relative ...) would be more
+intuitive to use, but that would not let me plug code(\transpose)
+:-CHAR(41).).COMMENT(
 
-For your convenience, code([2/3) can be further abbreviated to code([/3), and
-you can abbreviate code(]1/1) on the closing beam marker to code(]/1).
+)verb(c8 \translator Staff = top \stemdown )COMMENT(
 
-mudela(fragment,verbatim)(
-< \type Staff = staffA {
-    \times 2/3 { c'8 c'8 c'8 } c'4
-  }
-  \type Staff = staffB { [c''8 c''8] c''4 } >
-)
+)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
+precise, this code(\translator) entry switches the current voice to a
+code(Staff) named code(top). So we have to name the upper staff
+`code(top)'.  Stem directions are set to avoid interfering with the
+oboe voices.  COMMENT(
 
+)verb(c'8 \translator Staff = bottom \stemup })COMMENT(
 
-bf(Important) the construct with code([/3) and
-code([/1) is a hack that sets a mode in the parser.  This means that
-verb(id = \notes { c8 c8 c8 }
-notATriplet =\notes { [2/3 \id ]1/1 })
-does not produce a triplet.  It will hopefully
-soon be replaced by a construction that mixes more elegantly with the
-grammar for Music.
+)Then a note is put on the upper staff, and we switch again.  We have
+to name the lower staff `code(bottom)'. COMMENT(
 
+)verb(hoomPahHoomPah = { [\hoomPah \hoomPah] })COMMENT(
 
+)Put two of these fragments in sequence, and beam them.COMMENT(
 
+)verb(bassvoices = \notes \relative c' {
+c4 g8. b,16
+\hoomPahHoomPah \hoomPahHoomPah \hoomPahHoomPah
+\hoomPahHoomPah)COMMENT(
 
+)Entering the bass part is easy: the hoomPahHoomPah variable is
+referenced four times.COMMENT(
 
-sect(Titling)
-label(tutorial:titling)
+)verb(\context Voice = reallyLow  {\stemdown g2 ~ | g4 c8 } >)COMMENT(
 
-A piece of sheet music isn't complete without proper opening and
-closing titles.  LilyPond does not have any real support for setting
-text: that is a job best left to TeX().  But you can pass messages to
-TeX() from the input file.   You can  write TeX() macros to handle
-these messages.
-To do this, you add a code(\header) block
-to your input file.  The format is quite simple,
+)After skipping some lines, we see code(~).  This mark makes ties.COMMENT(
 
-verb(
-\header{
-    "key" =  "value";
-    "key" =  "value";
-    "key" =  "value";
-    % etc.
-})
+)verb(\context PianoStaff)COMMENT(
 
-When  the results of the music typesetting are output, the contents of
-code(\header) are also up into the TeX() file.  Tools like
-code(ly2dvi) can use this information to generate pretty titling for
-your input file. Consult the manual page of code(ly2dvi) for more
-details.
+)For piano music, a special context is needed to get cross staff
+beaming right.  It is called code(PianoStaff).COMMENT(
 
+)verb(\context Staff = bottom < \time 2/2; \clef bass;)COMMENT(
 
-The code(\header) block should be at toplevel in mudela, and
-preferably at the top of the file.  If you have an input file  with
-multiple code(\score) blocks, you should add a header to every score,
-describing the different sub parts of the music piece, eg.
+)The bottom staff must have a different clef.COMMENT(
 
+)verb(indent = 0.0;)COMMENT(
 
-verb(\header {
-        "composer" = "Ludwig Van Bavaria";
-        "title" = "Symphonie Megalomane";
-    }
-    \score{
-       ... % some music
-       \header { movement = "Mit roher Kraft wild herausfahrend!"; }
-      \paper { }
-    }
-    \score{
-       ... % some more music
-       \header { movement = "Saut\'e comme un oeuf."; }
-      \paper { }
-    }
-)
+)To make some more room on the line, the first (in this case the only)
+line is not indented.
 
-If you want you can also put the code(\header) block at the top of the
-input file; it will then be put into every output file automatically.
-This will make it clear what the file contains as soon as you open it.
+This example shows a lot of features, but the organisation isn't
+perfect.  For example, it would be less confusing to use a chord
+containing sequential music than a sequence of chords for the oboe
+parts.
 
+[TODO: demonstrate Hara-Kiri with scores and  part extraction.]
 
+sect(The end)        
+         
+That's all folks.  From here, you can either try fiddling with input
+files, or you can read the reference manual.