]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/fundamental.itely
Change Info docs setup and clean up Documentation/user/GNUmakefile
[lilypond.git] / Documentation / user / fundamental.itely
index 9082a9e8e870443971339d44537e4060437c4914..1e56b0e4f250f3d2d11292d75891b65d8fdbf93f 100644 (file)
@@ -40,7 +40,7 @@ description of the input format, see @ruser{File structure}.
 A basic example of a lilypond input file is
 
 @example
-\version "2.11.23"
+\version "2.11.38"
 \score @{
   @var{...compound music expression...}  % all the music goes here!
   \header @{ @}
@@ -53,7 +53,7 @@ A basic example of a lilypond input file is
 There are many variations of this basic pattern, but this
 example serves as a useful starting place.
 
-Up to this point none of the examples you have seen have used a
+Up to this point none of the examples you have seen has used a
 @code{\score@{@}} command.  This is because LilyPond automatically
 adds the extra commands which are needed when you give it simple 
 input.  LilyPond treats input like this:
@@ -90,7 +90,7 @@ command, leaving the others to default.
 
 A @code{\score} block must always contain just one music 
 expression, and
-this must appear first within the @code{\score @{..@}} block.
+this must appear immediately after the @code{\score} command.
 Remember that a music expression could be anything from a single
 note to a huge compound expression like
 
@@ -106,8 +106,8 @@ note to a huge compound expression like
 Since everything is inside @code{@{ ... @}}, it counts
 as one music expression.
 
-As we saw previously, the @code{\score} can contain other things,
-such as
+As we saw previously, the @code{\score} block can contain other 
+things, such as
 
 @example
 \score @{
@@ -121,7 +121,7 @@ such as
 @noindent
 Some people put some of those commands outside the @code{\score}
 block -- for example, @code{\header} is often placed above the
-@code{\score}.  That's just another shorthand that LilyPond
+@code{\score} command.  That's just another shorthand that LilyPond
 accepts.
 
 Two more commands you have not previously seen are
@@ -131,9 +131,13 @@ MIDI output respectively.  They are described fully in the
 Notation Reference -- @ruser{Score layout} and
 @ruser{Creating MIDI files}.
 
-The @code{\book} command allows
-several @code{\score} blocks to be combined into one output.
-If there are several @code{\book} blocks each one produces a
+You may code multiple @code{\score} blocks.  Each will be
+treated as a separate score, but they will be all combined into
+a single output file.  A @code{\book} command is not necessary
+-- one will be implicitly created.  However, if you would like
+separate output files from one @code{.ly} file then the
+@code{\book} command should be used to separate the different
+sections: each @code{\book} block will produce a
 separate output file.  For details see @ruser{Multiple scores
 in a book}.
 
@@ -187,7 +191,7 @@ We didn't skip over it at all.  The big mystery is simply that
 there @emph{is} no mystery.  This line explains it all:
 
 @quotation
-@emph{A @code{\score} must begin with a compound music expression.}
+@emph{A @code{\score} block must begin with a compound music expression.}
 @end quotation
 
 @noindent
@@ -226,12 +230,14 @@ it.  We @emph{do} need a singer and a piano, though.
 @}
 @end example
 
-Remember that we use @code{<<} and @code{>>} to show simultaneous
+Remember that we use @code{<< ... >>} instead of
+@code{@{ ... @}} to show simultaneous
 music.  And we definitely want to show the vocal part and piano
 part at the same time, not one after the other!  However, the
-@code{<< .. >>} construct is not really necessary for the Singer
+@code{<< ... >>} construct is not really necessary for the Singer
 staff, as it contains only one music expression, but Staves often
-do require simultaneous Voices within them, so using @code{<< .. >>}
+do require simultaneous Voices within them, so using 
+@code{<< ... >>}
 rather than braces is a good habit to adopt. We'll add some real
 music later; for now let's just put in some dummy notes and lyrics.
 
@@ -240,7 +246,7 @@ music later; for now let's just put in some dummy notes and lyrics.
   <<
     \new Staff = "singer" <<
       \new Voice = "vocal" { c'1 }
-      \addlyrics { One }
+      \addlyrics { And }
     >>
     \new PianoStaff = "piano" <<
       \new Staff = "upper" { c'1 }
@@ -263,7 +269,7 @@ braces next to @code{\new Voice = vocal}, we could start writing
 
 @example
 \relative c'' @{
-  a4 b c d
+  r4 d8\noBeam g, c4 r
 @}
 @end example
 
@@ -274,7 +280,7 @@ of the previous section, remember?  So, adding a few notes, we
 now have a piece of real music:
 
 @lilypond[verbatim,quote,ragged-right]
-melody = \relative c'' { r4 d8\noBeam g, c r4 }
+melody = \relative c'' { r4 d8\noBeam g, c4 r }
 text   = \lyricmode { And God said, }
 upper  = \relative c'' { <g d g,>2~ <g d g,> }
 lower  = \relative c { b2 e2 }
@@ -789,18 +795,21 @@ and placing the music in voice four:
 @end lilypond
 
 @noindent
-and exposes a problem commonly encountered with multiple
-voices: the stems of notes can collide with note heads
+We see that this fixes the stem direction, but exposes a 
+problem sometimes encountered with multiple voices -- the 
+stems of the notes in one voice can collide with the note heads
 in other voices.  In laying out the notes, LilyPond allows the
 notes or chords from two voices to occupy the same vertical
 note column provided the stems are in opposite directions, but
-the notes from a third voice are displaced to avoid the stems
-colliding.  This often works well, but in this example the
+the notes from the third and fourth voices are displaced to if
+necessary to avoid the note heads
+colliding.  This usually works well, but in this example the
 notes of the lowest voice are clearly not well placed by default.
 LilyPond provides several ways to adjust the horizontal placing
 of notes.  We are not quite ready yet to see how to correct this,
-so we shall leave this problem until a later section 
-(see @ref{Fixing overlapping notation} )
+so we shall leave this problem until a later section
+(see the force-hshift property in @ref{Fixing overlapping 
+notation} )
 
 @node Explicitly instantiating voices
 @subsection Explicitly instantiating voices
@@ -1079,6 +1088,7 @@ SopTwoLyrics = \lyricmode {
     >>
     \new Staff <<
       \new Voice = "SopTwo" {
+        \global
         \SopTwoMusic
       }
       \new Lyrics \lyricsto "SopTwo" {
@@ -1127,7 +1137,7 @@ VerseFour  = \lyricmode {
     >>
     \new Staff <<
       \clef "bass"
-      \new Voice = "Tenor" { \voiceOne \TenorMusic }
+      \new Voice = "Tenor" { \voiceOne \TimeKey \TenorMusic }
       \new Voice = "Bass"  { \voiceTwo \BassMusic  }
     >>
   >>
@@ -1185,7 +1195,7 @@ For example: a @code{Staff} context can contain many
 contain many @code{Staff} contexts.
 
 @quotation
-@image{context-example,5cm,,}
+@sourceimage{context-example,5cm,,}
 @end quotation
 
 Each context has the responsibility for enforcing some notation rules,
@@ -1214,11 +1224,9 @@ In addition to the @code{Score,} @code{Staff} and
 the score and staff levels to control staff groups, such as the
 @code{PianoStaff} and @code{ChoirStaff} contexts.  There
 are also alternative staff and voice contexts, and contexts for
-lyrics, percussion, fret boards, figured bass, etc.  A complete
-list is shown in the Notation Reference.
-TODO: Add link
+lyrics, percussion, fret boards, figured bass, etc.
 
-The names of all context types are formed from one or more 
+The names of all context types are formed from one or more
 words, each word being capitalised and joined immediately to the 
 preceding word with no hyphen or underscore, e.g., 
 @code{GregorianTranscriptionStaff}.
@@ -1429,11 +1437,11 @@ because we omitted the context name.
 @lilypond[quote,verbatim,ragged-right]
 <<
   \new Staff \relative c'' {
-    \set Staff.instrumentName = "Soprano"
+    \set Staff.instrumentName = #"Soprano"
     c4 c
  }
   \new Staff \relative c' {
-  \set instrumentName = "Alto"  % Wrong!
+  \set instrumentName = #"Alto"  % Wrong!
   d4 d 
  }
 >>
@@ -1462,8 +1470,8 @@ if it is set in the @code{Staff} context, but
 some properties can be set in more than one context.
 For example, the property @code{extraNatural} is by
 default set to ##t (true) for all staves.  
-If it is set to ##f (false) in the @code{Staff} context 
-it applies just to the accidentals on that staff.  
+If it is set to ##f (false) in one particular @code{Staff} 
+context it applies just to the accidentals on that staff.
 If it is set to false in the @code{Score} context
 it applies to all staves.
 
@@ -1504,7 +1512,8 @@ in the input file and will take effect from the time they are
 encountered until the end of the score or until the property is 
 @code{\set} or @code{\unset} again.  Let's try changing the 
 font size, which affects the size of the note heads (among 
-other things) several times.
+other things) several times.  The change is from the default
+value, not the current value.
 
 @lilypond[quote,verbatim,ragged-right,relative=1,fragment]
 c4 
@@ -1580,15 +1589,15 @@ engraver is removed from a context it can no longer produce its
 output.  This is a crude way of modifying the output, but it
 can sometimes be useful.
 
-@unnumberedsubsubsec Changing a single context
+@subsubsection Changing a single context
 
 To remove an engraver from a single context we use the
 @code{\with} command placed immediately after the context creation 
 command, as in the previous section.
 
-As an 
-illustration let's repeat an example from the previous 
-section with the staff lines removed.  Remember that the 
+As an
+illustration let's repeat an example from the previous
+section with the staff lines removed.  Remember that the
 staff lines are produced by the Staff_symbol_engraver.
 
 @lilypond[quote,verbatim,ragged-right]
@@ -1661,7 +1670,7 @@ the notes in all the voices on that staff:
 >>
 @end lilypond
 
-@unnumberedsubsubsec Changing all contexts of the same type
+@subsubsection Changing all contexts of the same type
 
 The examples above show how to remove or add engravers to
 individual contexts.  It is also possible to remove or add 
@@ -1730,12 +1739,11 @@ cello.  In this case, we would start with @q{Notes and lyrics} (for the
 soprano part).
 
 @example
-\version "2.11.23"
+\version "2.11.38"
 melody = \relative c' @{
   \clef treble
   \key c \major
   \time 4/4
-
   a4 b c d
 @}
 
@@ -1759,12 +1767,11 @@ text = \lyricmode @{
 Now we want to add a cello part.  Let's look at the @q{Notes only} example:
 
 @example
-\version "2.11.23"
+\version "2.11.38"
 melody = \relative c' @{
   \clef treble
   \key c \major
   \time 4/4
-
   a4 b c d
 @}
 
@@ -1775,32 +1782,33 @@ melody = \relative c' @{
 @}
 @end example
 
-We don't need two @code{\version} commands.  We'll need the @code{melody}
-section.  We don't want two @code{\score} sections -- if we had two
-@code{\score}s, we'd get the two parts separately.  We want them together,
-as a duet.  Within the @code{\score} section, we don't need two
-@code{\layout} or @code{\midi}.
-
-If we simply cut and paste the @code{melody} section, we would end up with
-two @code{melody} sections.  So let's rename them.  We'll call the section
-for the soprano @code{sopranoMusic} and the section for the cello
-@code{celloMusic}.  While we're doing this, let's rename @code{text}
-to be @code{sopranoLyrics}.  Remember to rename both instances of all
-these names -- both the initial definition (the
-@code{melody = relative c' @{ } part) and the name's use (in the
+We don't need two @code{\version} commands.  We'll need the 
+@code{melody} section.  We don't want two @code{\score} sections
+-- if we had two @code{\score}s, we'd get the two parts separately.
+We want them together, as a duet.  Within the @code{\score} 
+section, we don't need two @code{\layout} or @code{\midi}.
+
+If we simply cut and paste the @code{melody} section, we would 
+end up with two @code{melody} definitions.  This would not generate
+an error, but the second one would be used for both melodies.
+So let's rename them to make them distinct.  We'll call the 
+section for the soprano @code{sopranoMusic} and the section for
+the cello @code{celloMusic}.  While we're doing this, let's rename
+@code{text} to be @code{sopranoLyrics}.  Remember to rename both
+instances of all these names -- both the initial definition (the
+@code{melody = \relative c' @{ } part) and the name's use (in the
 @code{\score} section).
 
-While we're doing this, let's change the cello part's staff -- celli
-normally use bass clef.  We'll also give the cello some different
-notes.
+While we're doing this, let's change the cello part's staff -- 
+celli normally use bass clef.  We'll also give the cello some 
+different notes.
 
 @example
-\version "2.11.23"
+\version "2.11.38"
 sopranoMusic = \relative c' @{
   \clef treble
   \key c \major
   \time 4/4
-
   a4 b c d
 @}
 
@@ -1812,7 +1820,6 @@ celloMusic = \relative c @{
   \clef bass
   \key c \major
   \time 4/4
-
   d4 g fis8 e d4
 @}
 
@@ -1866,12 +1873,11 @@ This looks a bit messy; the indentation is messed up now.  That is
 easily fixed.  Here's the complete soprano and cello template.
 
 @lilypond[quote,verbatim,ragged-right]
-\version "2.11.23"
+\version "2.11.37"
 sopranoMusic = \relative c' {
   \clef treble
   \key c \major
   \time 4/4
-
   a4 b c d
 }
 
@@ -1883,7 +1889,6 @@ celloMusic = \relative c {
   \clef bass
   \key c \major
   \time 4/4
-
   d4 g fis8 e d4
 }
 
@@ -1907,7 +1912,7 @@ celloMusic = \relative c {
 @node Four-part SATB vocal score
 @subsection Four-part SATB vocal score
 
-Most vocal scores of music written for four-part mixed choir 
+Most vocal scores of music written for four-part mixed choir
 with orchestral accompaniment such as Mendelssohn's Elijah or
 Handel's Messiah have the choral music and words on four
 staves, one for each of SATB, with a piano reduction of the
@@ -1916,7 +1921,7 @@ from Handel's Messiah:
 
 @c The following should appear as music without code
 @lilypond[quote,ragged-right]
-\version "2.11.23"
+\version "2.11.38"
 global = { \key d \major \time 4/4 }
 sopMusic = \relative c'' {
   \clef "treble"
@@ -1927,7 +1932,7 @@ sopWords = \lyricmode {
 }
 altoMusic = \relative a' {
   \clef "treble"
-  r4 a2 a4 | fis4. fis8 a2 | g4 fis fis2 |
+  r4 a2 a4 | fis4. fis8 a2 | g4 fis e2 |
 }
 altoWords = \sopWords
 tenorMusic = \relative c' {
@@ -2090,7 +2095,7 @@ Combining all these together and adding the music
 for the three bars of the example above gives:
 
 @lilypond[quote,verbatim,ragged-right]
-\version "2.11.23"
+\version "2.11.38"
 global = { \key d \major \time 4/4 }
 sopMusic = \relative c'' {
   \clef "treble"
@@ -2188,7 +2193,7 @@ music definitions and one to define the time signature
 and key:
 
 @example
-\version "2.11.23"
+\version "2.11.38"
 \header @{
   title = "Jesu, meine Freude"
   composer = "J S Bach"
@@ -2297,7 +2302,7 @@ may vary.  All that remains now
 is to add the music, and combine all the parts together.
 
 @lilypond[quote,verbatim,ragged-right]
-\version "2.11.23"
+\version "2.11.38"
 \header {
   title = "Jesu, meine Freude"
   composer = "J S Bach"
@@ -2346,3 +2351,6 @@ PedalOrganMusic = \relative c {
 
 
 
+
+
+