]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/tex/tutorial.yo
release: 1.1.39
[lilypond.git] / Documentation / tex / tutorial.yo
index 3aef3a08915becfd2c7c6bd39047c3372c312e49..b8c65bdf4fef51d9e92fbd05f240bb10599f282a 100644 (file)
@@ -1,3 +1,4 @@
+mailto(gnu-music-discuss@gnu.org)
 COMMENT(-*-text-*-)
 
 redef(var)(1)(whenlatex(latexcommand({\normalfont\scshape )ARG1+latexcommand(}))\
@@ -93,20 +94,20 @@ mudela(verbatim)(
 \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 ":|";             
-
-        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-. ] 
+           \key g;
+           \time 3/4;          
+
+       \repeat 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-.
         g4 fis e |
         fis a,  r8 cis8
         d2.-\fermata
@@ -208,6 +209,12 @@ verb(
 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(
+       \repeat 2 {
+) COMMENT(
+
+) This command tells LilyPond that the enclosed piece of music must
+be played twice.
 verb(
         d4
 ) COMMENT(
@@ -216,15 +223,6 @@ verb(
 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(
 
-)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(
-
 )verb(
         a b
 )COMMENT(
@@ -234,16 +232,6 @@ duration is the same as the code(g), there is no need to enter the
 duration (It is not illegal to enter it anyway.  You would then enter
 code(a8 b8)) COMMENT(
 
-)verb(
-          c]
-) 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(
-
 )verb(
           d4 g, g |
 ) COMMENT(
@@ -252,7 +240,7 @@ the current time signature.  COMMENT(
 music, LilyPond will check  that barchecks are found at the start of
 a bar.  This can help you track down notes you forgot to enter. 
 verb(
-        e'4 [c8 d e fis]
+        e'4 c8 d e fis
 ) COMMENT(
 
 ) So far, no notes were chromatically altered.  Here is the first one
@@ -261,43 +249,35 @@ that is: code(fis). Mudela by default uses Dutch note names, and
 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] |
+        c4 d8( )c b a( )b4 c8 b a g |
 ) COMMENT(
 
 ) The next line shows something new: 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.
-
+the notes.  As you can see, parentheses do not have to nest.
 verb(
-        a4 [b8 a g fis] g2.  |
+        a4 b8 a g fis g2.  |
 ) 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(
-
-)verb(
-        \bar ":|";             % a repeat sign
+augmentation dots.
+verb(
+       }
 ) 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, just like with code(\key) and code(\time).
+) The end of the repeated music.  LilyPond will typset a repeat bar.
 verb(
-     cis'4 [b8 cis] a4 |
+     cis'4 b8 cis a4 |
 ) 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( [a8-. b-. cis-. d-. e-. fis-. ] % try some super and subscripts.)COMMENT(
+)verb( a8-. b-. cis-. d-. e-. fis-. % try some super and subscripts.)COMMENT(
 
 )There is more to music than just pitches and rhythms.  An important
 aspect is articulation.  You can enter articulation signs either in an
@@ -495,6 +475,7 @@ 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. 
 
+subsect(Where the chords have no names)
 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
@@ -541,6 +522,42 @@ that is covered in bind(Section)ref(sec:polyphonic).
 
 [Chords and relative mode]
 
+subsect(Chords with names)
+
+In the previous section we have been talking more about `stacked notes'
+rather than `chords'.
+If you need to enter a lot of chords that have proper names, you can use 
+the code(\chords) mode as an alternative:
+COMMENT(
+)mudela(verbatim,fragment,center)(
+    \chords\transpose c''{ c1 d e }
+) 
+COMMENT( URG?
+    \chords\relative c''{ c1 d e }
+)
+
+subsect(Names with chords)
+
+A more common problem is the typesetting of chord names.  LilyPond has
+a special kind of staff for this, the code(ChordNames) staff.  
+The code(ChordNames) staff accepts music just as a normal staff, 
+but typesets only the name of each chord:
+COMMENT(
+
+)mudela(verbatim,center)(
+\score{
+  \type ChordNames {
+    \chords
+      { c1 d-min e-maj5+.9 }
+    \notes\relative c
+      { <c1 es g> }
+  }
+  \paper{
+    linewidth=-1.0;
+  }
+}
+) Because the ChordNames staff accepts normal music, it can be transposed,
+and you may enter it any way you like, either as chords or as notes.
 
 sect(Adding nuances: articulation and dynamics)
 
@@ -1214,11 +1231,14 @@ COMMENT(
 \type Lyrics \lyrics { 'got8 me on my knees,4 Le-8 lie! })COMMENT(
 
 )The result is technically correct, but it needs a melody to make it
-performable: COMMENT(
+perfor0mable: COMMENT(
 
 )mudela(fragment,verbatim)(
   <
-    \type Staff  { c''8. c''16 bes'8. a'16 g'4 f'8 g'4. }
+    \type Staff  { 
+      \property Voice.beamAuto = "0" % no beams in melody
+      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(
@@ -1238,7 +1258,10 @@ urg
 )COMMENT(
 
 )mudela(fragment,verbatim)(<
-  \type Staff  { c''8. c''16 bes'8. a'16 g'4 f'8 g'4. }
+  \type Staff  { 
+    \property Voice.beamAuto = "0" % no beams in melody
+    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.}
 >
 )COMMENT(
@@ -1340,8 +1363,7 @@ 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(
-
+var(beatsperminute);, for example: COMMENT(
 
 )verb(
 \score {
@@ -1592,8 +1614,35 @@ switch = \type Voice = voiceA \notes { s4 \translator Staff = staffB s4
 }
 )
 
-Don't try to switch staffs when you are in the middle of a slur or
-beam, though: the spanners won't switch along.
+If you want to switch staffs you are in the middle of a slur or a
+beam, you should take special precautions.  In the paper block,
+you must tell how far the staffs will be apart:
+mudela(verbatim,center)(
+\score{
+  \type GrandStaff <
+    \type Staff=one \notes{ s2 }
+    \type Staff=two \notes\relative c{
+      \time 4/8;
+      \clef "bass";
+      \stemup [c8( e
+       \translator Staff=one \stemup 
+      g )c]
+    }
+  >
+  \paper {
+    linewidth=-1.0;
+    % slur damping gets confused
+    slur_slope_damping = 100.0;
+    \translator{
+      % we're using a grand staff
+      \GrandStaffContext  
+      minVerticalAlign = 3.0*\staffheight;
+      maxVerticalAlign = 3.0*\staffheight;
+    }
+  }
+}
+)
+as LilyPond cannot determine the interstaff distance.
 
 sect(Tuplets)
 
@@ -1601,7 +1650,7 @@ The notes in a triplet take 2/3 of their notated duration.  The syntax
 for triplet in LilyPond reflects this.  To make a triplet, you enter
 COMMENT(
 
-)mudela(fragment,center)(
+)mudela(verbatim,fragment,center)(
        \type Voice \times 2/3 { c''4 c''4 c''4 }
 )COMMENT(
 
@@ -1612,7 +1661,7 @@ don't need this, if a Voice context is already instantiated, like in
 the following example:
 COMMENT(
 
-)mudela(fragment,center)(
+)mudela(fragment,verbatim,center)(
        c''4 \times 2/3 { c''4 c''4 c''4 } c''4
 )COMMENT(
 
@@ -1620,11 +1669,49 @@ COMMENT(
 
 Of course, you can also use different ratios, and use beamed notes or
 rests:
+COMMENT( BROKEN
+
+lilypond: score-element.cc:134: class Paper_def * Score_element::paper() const: Assertion `pscore_l_' failed.
+
 mudela(fragment)(
        \type Voice \times 4/5 { [c''8 c''16 c''16] r8 [g'8 g'8] }
 )
+)
 If you make a tuplet of  beamed notes, where the beam is as wide as
 the bracket, the bracket is omitted.
 
 sect(Repeats)
 
+A repeated piece of music can consist of two parts: one part to be 
+repeated, and optionally, a list of alternative endings:
+COMMENT(
+)mudela(verbatim,fragment,center)(
+    \relative c'{
+       \time 2/4;
+       g' a
+        \repeat 2 { b c }
+       \alternative { 
+           { d c } { d e }
+       }
+       f g
+    }
+) The number code(repeat-count) defines how many times the piece should be 
+played.  You may leave out the code(\alternative) part.  There must not 
+be more alternative endings than the code(repeat-count).
+
+A somewhat less intuitive form may be needed for lyrics, when there are
+a couple alternatives, but nothing is repeated.  The code(\repeat) command
+must be present, but it may specify an empty music list:
+COMMENT(
+)mudela(verbatim,fragment,center)(
+    \type Lyrics \lyrics {
+       \repeat 2 { }
+       \alternative < 
+           { Let's not sing 
+             this twice } 
+           { Rather sing 
+             this in- stead } 
+       > 
+    }
+)
+