]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/putting.itely
identifier => variable.
[lilypond.git] / Documentation / user / putting.itely
index 0cc5ecd908ff926d5c6b9226482325ee3f4d314f..b1a5dfa976ae845617ba4e3ad87ddcd028ed1de8 100644 (file)
@@ -1,4 +1,12 @@
 @c -*- coding: utf-8; mode: texinfo; -*-
+@c This file is part of lilypond-learning.tely
+@ignore
+    Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
+
+    When revising a translation, copy the HEAD committish of the
+    version that you are working on.  See TRANSLATION for details.
+@end ignore
+
 @node Putting it all together
 @chapter Putting it all together
 
@@ -8,8 +16,7 @@ create @code{\score} blocks.
 
 @menu
 * Extending the templates::     
-* How LilyPond files work::     
-* Score is a single musical expression::  
+* Scores and parts::            
 @end menu
 
 
@@ -20,13 +27,21 @@ You've read the tutorial, you know how to write music.  But how can you
 get the staves that you want?  The templates are ok, but what if you
 want something that isn't covered?
 
+@menu
+* Soprano and cello::           
+* Another example of extending templates::  
+@end menu
+
+@node Soprano and cello
+@unnumberedsubsec Soprano and cello
+
 Start off with the template that seems closest to what you want to end
 up with.  Let's say that you want to write something for soprano and
-cello.  In this case, we would start with ``Notes and lyrics'' (for the
+cello.  In this case, we would start with @q{Notes and lyrics} (for the
 soprano part).
 
 @example
-\version "2.9.13"
+\version "2.11.23"
 melody = \relative c' @{
   \clef treble
   \key c \major
@@ -52,10 +67,10 @@ text = \lyricmode @{
 @}
 @end example
 
-Now we want to add a cello part.  Let's look at the ``Notes only'' example:
+Now we want to add a cello part.  Let's look at the @q{Notes only} example:
 
 @example
-\version "2.9.13"
+\version "2.11.23"
 melody = \relative c' @{
   \clef treble
   \key c \major
@@ -91,7 +106,7 @@ normally use bass clef.  We'll also give the cello some different
 notes.
 
 @example
-\version "2.9.13"
+\version "2.11.23"
 sopranoMusic = \relative c' @{
   \clef treble
   \key c \major
@@ -161,7 +176,7 @@ 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.9.13"
+\version "2.11.23"
 sopranoMusic = \relative c' {
   \clef treble
   \key c \major
@@ -199,251 +214,143 @@ celloMusic = \relative c {
 @end lilypond
 
 
+@node Another example of extending templates
+@unnumberedsubsec Another example of extending templates
 
-@node How LilyPond files work
-@section How LilyPond files work
-
-The LilyPond input format is quite free-form, giving experienced
-users a lot of flexibility to structure their files however they
-wish.  However, this flexibility can make things confusing for
-new users.  This section will explain some of this structure, but
-may gloss over some details in favor of simplicity.  For a complete
-description of the input format, see @ref{File structure}.
-
-Most examples in this manual are little snippets -- for example
+TODO: somebody else fill this in.  You guys like vocal stuff,
+right?  Get to it.  :)  -gp
 
-@example
-c4 a b c
-@end example
 
-As you are (hopefully) aware by now, this will not compile by
-itself.  These examples are shorthand for complete
-examples.  They all need at least curly braces to compile
 
-@example
-@{
-  c4 a b c
-@}
-@end example
+@node Scores and parts
+@section Scores and parts
 
-Most examples also make use of the @code{\relative c'}
-(or @code{c''}) command.  This is not necessary to merely
-compile the examples, but in most cases the output will
-look very odd if you omit the @code{\relative c'}.
+TODO: this is really old stuff from the really old tutorial.
+Rewrite, fix, etc.  -gp
 
-@lilypond[quote,fragment,ragged-right,verbatim]
-\relative c'' {
-  c4 a b c
-}
-@end lilypond
+In orchestral music, all notes are printed twice.  Once in a part for
+the musicians, and once in a full score for the conductor.  Variables can
+be used to avoid double work.  The music is entered once, and stored in
+a variable.  The contents of that variable is then used to generate
+both the part and the full score.
 
-Now we get to the only real stumbling block: LilyPond
-input in this form is actually @emph{another}
-shorthand.  Although it compiles and displays the
-correct output, it is shorthand for
+It is convenient to define the notes in a special file.  For example,
+suppose that the file @file{horn-music.ly} contains the following part
+of a horn/@/bassoon duo
 
 @example
-\score @{
-  \relative c'' @{
-    c4 a b c
-  @}
+hornNotes = \relative c @{
+  \time 2/4
+  r4 f8 a cis4 f e d
 @}
 @end example
 
-A @code{\score} must begin with a single music
-expression.  Remember that a music expression could
-be anything from a single note to a huge
+@noindent
+Then, an individual part is made by putting the following in a file
 
 @example
+\include "horn-music.ly"
+\header @{
+  instrument = "Horn in F"
+@}
+
 @{
-  \new GrandStaff <<
-    insert the whole score of a Wagner opera in here
-  >>
+ \transpose f c' \hornNotes
 @}
 @end example
 
-@noindent
-Since everything is inside @code{@{ ... @}}, it counts
-as one music expression.
-
-The @code{\score} can contain other things, such as
+The line
 
 @example
-\score @{
-  @{ c'4 a b c' @}
-  \layout @{ @}
-  \midi @{ @}
-  \header @{ @}
-@}
+\include "horn-music.ly"
 @end example
 
 @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 accepts.
+substitutes the contents of @file{horn-music.ly} at this position in
+the file, so @code{hornNotes} is defined afterwards.  The command
+@code{\transpose f@tie{}c'} indicates that the argument, being
+@code{\hornNotes}, should be transposed by a fifth upwards.  Sounding
+@samp{f} is denoted by notated @code{c'}, which corresponds with the
+tuning of a normal French Horn in@tie{}F.  The transposition can be seen
+in the following output
+
+@lilypond[quote,ragged-right]
+\transpose f c' \relative c {
+  \time 2/4
+  r4 f8 a cis4 f e d
+}
+@end lilypond
 
-Another great shorthand is the ability to define
-variables.  All the templates use this
+In ensemble pieces, one of the voices often does not play for many
+measures.  This is denoted by a special rest, the multi-measure
+rest.  It is entered with a capital @samp{R} followed by a duration
+(@code{1}@tie{}for a whole note, @code{2}@tie{}for a half note,
+etc.).  By multiplying the
+duration, longer rests can be constructed.  For example, this rest
+takes 3@tie{}measures in 2/4 time
 
 @example
-melody = \relative c' @{
-  c4 a b c
-@}
-
-\score @{
-  @{ \melody @}
-@}
+R2*3
 @end example
 
-When LilyPond looks at this file, it takes the value of
-@code{melody} (everything after the equals sign) and
-inserts it whenever it sees
-@code{\melody}.  There's nothing special about the
-names -- it could be @code{melody}, @code{global},
-@code{pianorighthand}, or @code{foofoobarbaz}.  You
-can use whatever variable names you want.  For
-more details, see
-@ref{Saving typing with identifiers and functions}.
-
-For a complete definition
-of the input format, see @ref{File structure}.
-
-
-@node Score is a single musical expression
-@section Score is a single musical expression
-
-In the previous section, @ref{How LilyPond files work},
-we saw the general organization of LilyPond input
-files.  But we seemed to skip over the most important
-part: how do we figure out what to write after
-@code{\score}?
-
-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 single music expression.}
-@end quotation
-
-@noindent
-You may find it useful to review
-@ref{Music expressions explained}.  In that section, we
-saw how to build big music expressions from small
-pieces -- we started from notes, then chords, etc.  Now
-we're going to start from a big music expression and
-work our way down.
+When printing the part, multi-rests
+must be condensed.  This is done by setting a run-time variable
 
 @example
-\score @{
-  @{   % this brace begins the overall music expression
-    \new GrandStaff <<
-      insert the whole score of a Wagner opera in here
-    >>
-  @}   % this brace ends the overall music expression
-  \layout @{ @}
-@}
+\set Score.skipBars = ##t
 @end example
 
-A whole Wagner opera would easily double the length of
-this manual, so let's just do a singer and piano.  We
-don't need a @code{GrandStaff} for this ensemble, so we
-shall remove it.  We @emph{do} need a singer and a piano,
-though.
+@noindent
+This command sets the property @code{skipBars} in the
+@code{Score} context to true (@code{##t}).  Prepending the rest and
+this option to the music above, leads to the following result
+
+@lilypond[quote,ragged-right]
+\transpose f c' \relative c {
+  \time 2/4
+  \set Score.skipBars = ##t
+  R2*3
+  r4 f8 a cis4 f e d
+}
+@end lilypond
 
-@example
-\score @{
-  @{
-    <<
-      \new Staff = "singer" <<
-      >>
-      \new PianoStaff = piano <<
-      >>
-    >>
-  @}
-  \layout @{ @}
-@}
-@end example
 
-Remember that we use @code{<<} and @code{>>} to show
-simultaneous music.  And we definitely want to show
-the vocal part and piano part at the same time!
+The score is made by combining all of the music together.  Assuming
+that the other voice is in @code{bassoonNotes} in the file
+@file{bassoon-music.ly}, a score is made with
 
 @example
-\score @{
-  @{
-    <<
-      \new Staff = "singer" <<
-        \new Voice = "vocal" @{ @}
-      >>
-      \new Lyrics \lyricsto vocal \new Lyrics @{ @}
-      \new PianoStaff = "piano" <<
-        \new Staff = "upper" @{ @}
-        \new Staff = "lower" @{ @}
-      >>
-    >>
-  @}
-  \layout @{ @}
-@}
-@end example
-
-Now we have a lot more details.  We have the singer's
-staff: it contains a @code{Voice} (in LilyPond, this
-term refers to a set of notes, not necessarily vocal
-notes -- for example, a violin generally plays one
-voice) and some lyrics.  We also have a piano staff:
-it contains an upper staff (right hand) and a lower
-staff (left hand).
-
-At this stage, we could start filling in notes.  Inside
-the curly braces next to @code{\new Voice = vocal},
-we could start writing
+\include "bassoon-music.ly"
+\include "horn-music.ly"
 
-@example
-\relative c'' @{
-  a4 b c d
-@}
+<<
+  \new Staff \hornNotes
+  \new Staff \bassoonNotes
+>>
 @end example
 
-But if we did that, the @code{\score} section would
-get pretty long, and it would be harder to understand
-what was happening.  So let's use identifiers (or
-variables) instead.
+@noindent
+leading to
+
+@lilypond[quote,ragged-right]
+\relative c <<
+  \new Staff {
+    \time 2/4 R2*3
+    r4 f8 a cis4 f e d
+  }
+  \new Staff {
+    \clef bass
+    r4 d,8 f | gis4 c | b bes |
+    a8 e f4 | g d | gis f
+  }
+>>
+@end lilypond
 
-@example
-melody = @{ @}
-text = @{ @}
-upper = @{ @}
-lower = @{ @}
-\score @{
-  @{
-    <<
-      \new Staff = "singer" <<
-        \new Voice = "vocal" @{ \melody @}
-      >>
-      \new Lyrics \lyricsto vocal \new Lyrics @{ \text @}
-      \new PianoStaff = "piano" <<
-        \new Staff = "upper" @{ \upper @}
-        \new Staff = "lower" @{ \lower @}
-      >>
-    >>
-  @}
-  \layout @{ @}
-@}
-@end example
+More in-depth information on preparing parts and scores can be found
+in the notation manual; see @ruser{Orchestral music}.
+
+Setting run-time variables (@q{properties}) is discussed in
+@ruser{Changing context properties on the fly}.
 
-@noindent
-Remember that you can use almost any name you like.  The
-limitations on identifier names are detailed in
-@ref{File structure}.
-
-When writing a @code{\score} section, or when reading
-one, just take it slowly and carefully.  Start with
-the outer layer, then work on each smaller
-layer.  It also really helps to be strict with
-indentation -- make sure that each item on the same
-layer starts on the same horizontal position in your
-text editor!