Revert "update fret diagrams regression test"
[lilypond/csorensen.git] / Documentation / user / working.itely
blob0e29d7bf6916d66dac27ac97eb59235e7224966e
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond-learning.tely
3 @ignore
4     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
6     When revising a translation, copy the HEAD committish of the
7     version that you are working on.  See TRANSLATION for details.
8 @end ignore
10 @c \version "2.11.38"
12 @node Working on LilyPond projects
13 @chapter Working on LilyPond projects
15 This section explains how to solve or avoid certain common
16 problems.  If you have programming experience, many of these
17 tips may seem obvious, but it is still advisable to read
18 this chapter.
21 @menu
22 * Suggestions for writing LilyPond input files::  
23 * When things don't work::      
24 * Scores and parts::            
25 @end menu
28 @node Suggestions for writing LilyPond input files
29 @section Suggestions for writing LilyPond input files
31 Now you're ready to begin writing larger LilyPond input files -- 
32 not just the little examples in the tutorial, but whole pieces.
33 But how should you go about doing it?
35 As long as LilyPond can understand your input files and produce
36 the output that you want, it doesn't matter what your input files
37 look like.  However, there are a few other things to consider when
38 writing LilyPond input files.
40 @itemize
41 @item What if you make a mistake?  The structure of a LilyPond
42 file can make certain errors easier (or harder) to find.
44 @item What if you want to share your input files with somebody
45 else?  In fact, what if you want to alter your own input files in
46 a few years?  Some LilyPond input files are understandable at
47 first glance; others may leave you scratching your head
48 for an hour.
50 @item What if you want to upgrade your LilyPond file for use
51 with a later version of LilyPond?  The input syntax changes
52 occasionally as LilyPond improves.  Most changes can be
53 done automatically with @code{convert-ly}, but some changes
54 might require manual assistance.  LilyPond input files can be
55 structured in order to be easier (or harder) to update.
56 @end itemize
58 @menu
59 * General suggestions::         
60 * Typesetting existing music::  
61 * Large projects::              
62 * Saving typing with variables and functions::  
63 * Style sheets::                
64 @end menu
67 @node General suggestions
68 @subsection General suggestions
70 Here are a few suggestions that can help you to avoid or fix
71 problems:
73 @itemize
74 @item @strong{Include @code{\version} numbers in every file}.  Note that all
75 templates contain @code{\version} information.  We
76 highly recommend that you always include the @code{\version}, no matter
77 how small your file is.  Speaking from personal experience, it's
78 quite frustrating to try to remember which version of LilyPond you were
79 using a few years ago.  @command{convert-ly} requires you to declare
80 which version of LilyPond you used.
82 @item @strong{Include checks}: @ruser{Bar and bar number checks},
83 @ruser{Octave checks}.  If you include checks every so often, then
84 if you make a mistake, you can pinpoint it quicker.  How often is
85 @q{every so often}?  It depends on the complexity of the music.
86 For very simple music, perhaps just once or twice.  For very
87 complex music, perhaps every bar.
89 @item @strong{One bar per line of text}.  If there is anything complicated,
90 either in the music
91 itself or in the output you desire, it's often good to write only one bar
92 per line.  Saving screen space by cramming eight bars per line just isn't
93 worth it if you have to @q{debug} your input files.
95 @item @strong{Comment your input files}.  Use either bar numbers 
96 (every so often) or
97 references to musical themes (@q{second theme in violins,} @q{fourth
98 variation,} etc.).  You may not need comments when you're writing the piece
99 for the first time, but if you want to go back to change something two or
100 three years later, or if you pass the source over to a friend, it will
101 be much more
102 challenging to determine your intentions or how your file is structured if
103 you didn't comment the file.
105 @item @strong{Indent your braces}.  A lot of problems are caused by an
106 imbalance
107 in the number of @code{@{} and @code{@}}.
109 @item @strong{Explicitly add durations} at the beginnings of sections
110 and variables.  If you specify @code{c4 d e} at the beginning of a
111 phrase (instead of just @code{c d e}) you can save yourself some
112 problems if you rearrange your music later.
114 @item @strong{Separate tweaks} from music definitions.  See
115 @ref{Saving typing with variables and functions}, and
116 @ref{Style sheets}.
118 @end itemize
121 @node Typesetting existing music
122 @subsection Typesetting existing music
124 If you are entering music from an existing score (i.e., typesetting a
125 piece of existing sheet music),
127 @itemize
129 @item Enter one manuscript (the physical copy) system at a time (but still
130 only one bar per line of text), and
131 check each system when you finish it.  You may use the
132 @code{showLastLength} command to speed up processing -- see
133 @ruser{Skipping corrected music}.
135 @item Define @code{mBreak = @{ \break @}} and insert @code{\mBreak}
136 in the input file whenever the manuscript has a line break.  This
137 makes it much easier to compare the LilyPond music to the original
138 music.  When you are finished proofreading your score, you may
139 define @code{mBreak = @{ @}} to remove all those line breaks.  This
140 will allow LilyPond to place line breaks wherever it feels are
141 best.
143 @end itemize
146 @node Large projects
147 @subsection Large projects
149 When working on a large project, having a clear structure to your
150 lilypond input files becomes vital.
152 @itemize
154 @item @strong{Use an variable for each voice}, with a minimum of
155 structure inside the definition.  The structure of the
156 @code{\score} section is the most likely thing to change;
157 the @code{violin} definition is extremely unlikely to change
158 in a new version of LilyPond.
160 @example
161 violin = \relative c'' @{
162 g4 c'8. e16
165 \score @{
166   \new GrandStaff @{
167     \new Staff @{
168       \violin
169     @}
170   @}
172 @end example
174 @item @strong{Separate tweaks from music definitions}.  This
175 point was made in previously, but for large
176 projects it is absolutely vital.  We might need to change
177 the definition of @code{fthenp}, but then we only need
178 to do this once, and we can still avoid touching anything
179 inside @code{violin}.
181 @example
182 fthenp = _\markup@{
183   \dynamic f \italic \small @{ 2nd @} \hspace #0.1 \dynamic p @}
184 violin = \relative c'' @{
185 g4\fthenp c'8. e16
187 @end example
189 @end itemize
192 @node Saving typing with variables and functions
193 @subsection Saving typing with variables and functions
195 @cindex variables
196 @cindex variables
198 By this point, you've seen this kind of thing:
200 @lilypond[quote,verbatim,ragged-right]
201 hornNotes = \relative c'' { c4 b dis c }
202 \score {
203   {
204     \hornNotes
205   }
207 @end lilypond
209 You may even realize that this could be useful in minimalist music:
211 @lilypond[quote,verbatim,ragged-right]
212 fragA = \relative c'' { a4 a8. b16 }
213 fragB = \relative c'' { a8. gis16 ees4 }
214 violin = \new Staff { \fragA \fragA \fragB \fragA }
215 \score {
216   {
217     \violin
218   }
220 @end lilypond
222 However, you can also use these variables (also known as
223 variables, macros, or (user-defined) command) for tweaks:
225 @lilypond[quote,verbatim,ragged-right]
226 dolce = \markup{ \italic \bold dolce }
227 padText = { \once \override TextScript #'padding = #5.0 }
228 fthenp=_\markup{ \dynamic f \italic \small { 2nd } \hspace #0.1 \dynamic p }
229 violin = \relative c'' {
230   \repeat volta 2 {
231     c4._\dolce b8 a8 g a b |
232     \padText
233     c4.^"hi there!" d8 e' f g d |
234     c,4.\fthenp b8 c4 c-. |
235   }
237 \score {
238   {
239     \violin
240   }
241 \layout{ragged-right=##t}
243 @end lilypond
245 These variables are obviously useful for saving
246 typing.  But they're worth considering even if you
247 only use them once -- they reduce complexity.  Let's
248 look at the previous example without any
249 variables.  It's a lot harder to read, especially
250 the last line.
252 @example
253 violin = \relative c'' @{
254   \repeat volta 2 @{
255     c4._\markup@{ \italic \bold dolce @} b8 a8 g a b |
256     \once \override TextScript #'padding = #5.0
257     c4.^"hi there!" d8 e' f g d |
258     c,4.\markup@{ \dynamic f \italic \small @{ 2nd @}
259       \hspace #0.1 \dynamic p @} b8 c4 c-. |
260   @}
262 @end example
264 So far we've seen static substitution -- when LilyPond
265 sees @code{\padText}, it replaces it with the stuff that
266 we've defined it to be (ie the stuff to the right of
267 @code{padtext=}).
269 LilyPond can handle non-static substitution, too (you
270 can think of these as functions).
272 @lilypond[quote,verbatim,ragged-right]
273 padText =
274 #(define-music-function (parser location padding) (number?)
275   #{
276     \once \override TextScript #'padding = #$padding
277   #})
279 \relative c''' {
280   c4^"piu mosso" b a b
281   \padText #1.8
282   c4^"piu mosso" d e f
283   \padText #2.6
284   c4^"piu mosso" fis a g
286 @end lilypond
288 Using variables is also a good way to reduce work if the
289 LilyPond input syntax changes (see @ref{Updating old input files}).  If
290 you have a single definition (such as @code{\dolce}) for all your
291 input files (see @ref{Style sheets}), then if the syntax changes, you
292 only need to update your single @code{\dolce} definition,
293 instead of making changes throughout every @code{.ly} file.
296 @node Style sheets
297 @subsection Style sheets
299 The output that LilyPond produces can be heavily modified; see
300 @ref{Tweaking output}, for details.  But what if you have many
301 input files that you want to apply your tweaks to?  Or what if you
302 simply want to separate your tweaks from the actual music?  This
303 is quite easy to do.
305 Let's look at an example.  Don't worry if you don't understand
306 the parts with all the @code{#()}.  This is explained in
307 @ref{Advanced tweaks with Scheme}.
309 @lilypond[quote,verbatim,ragged-right]
310 mpdolce = #(make-dynamic-script (markup #:hspace 1 #:translate (cons 5 0)
311   #:line(#:dynamic "mp" #:text #:italic "dolce" )))
312 tempoMark = #(define-music-function (parser location markp) (string?)
314   \once \override Score . RehearsalMark #'self-alignment-X = #left
315   \once \override Score . RehearsalMark #'extra-spacing-width = #'(+inf.0 . -inf.0)
316   \mark \markup { \bold $markp }
319 \relative c'' {
320   \tempo 4=50
321   a4.\mpdolce d8 cis4--\glissando a | b4 bes a2
322   \tempoMark "Poco piu mosso"
323   cis4.\< d8 e4 fis | g8(\! fis)-. e( d)-. cis2
325 @end lilypond
327 There are some problems with overlapping output; we'll fix those using
328 the techniques in @ref{Moving objects}.  But let's also
329 do something about the @code{mpdolce} and @code{tempoMark}
330 definitions.  They produce the output we desire, but we might want
331 to use them in another piece.  We could simply copy-and-paste them
332 at the top of every file, but that's an annoyance.  It also leaves
333 those definitions in our input files, and I personally find all
334 the @code{#()} somewhat ugly.  Let's hide them in another file:
336 @example
337 %%% save this to a file called "definitions.ly"
338 mpdolce = #(make-dynamic-script (markup #:hspace 1 #:translate (cons 5 0)
339   #:line(#:dynamic "mp" #:text #:italic "dolce" )))
340 tempoMark = #(define-music-function (parser location markp) (string?)
342   \once \override Score . RehearsalMark #'self-alignment-X = #left
343   \once \override Score . RehearsalMark #'extra-spacing-width = #'(+inf.0 . -inf.0)
344   \mark \markup @{ \bold $markp @}
345 #@})
346 @end example
348 Now let's modify our music (let's save this file as @file{"music.ly"}).
350 @c  We have to do this awkward example/lilypond-non-verbatim
351 @c  because we can't do the \include stuff in the manual.
353 @example
354 \include "definitions.ly"
356 \relative c'' @{
357   \tempo 4=50
358   a4.\mpdolce d8 cis4--\glissando a | b4 bes a2
359   \once \override Score.RehearsalMark #'padding = #2.0
360   \tempoMark "Poco piu mosso"
361   cis4.\< d8 e4 fis | g8(\! fis)-. e( d)-. cis2
363 @end example
365 @lilypond[quote,ragged-right]
366 mpdolce = #(make-dynamic-script (markup #:hspace 1 #:translate (cons 5 0)
367   #:line(#:dynamic "mp" #:text #:italic "dolce" )))
368 tempoMark = #(define-music-function (parser location markp) (string?)
370   \once \override Score . RehearsalMark #'self-alignment-X = #left
371   \once \override Score . RehearsalMark #'extra-spacing-width = #'(+inf.0 . -inf.0)
372   \mark \markup { \bold $markp }
375 \relative c'' {
376   \tempo 4=50
377   a4.\mpdolce d8 cis4--\glissando a | b4 bes a2
378   \once \override Score.RehearsalMark #'padding = #2.0
379   \tempoMark "Poco piu mosso"
380   cis4.\< d8 e4 fis | g8(\! fis)-. e( d)-. cis2
382 @end lilypond
384 That looks better, but let's make a few changes.  The glissando is hard
385 to see, so let's make it thicker and closer to the note heads.  Let's
386 put the metronome marking above the clef, instead of over the first
387 note.  And finally, my composition professor hates @q{C} time signatures,
388 so we'd better make that @q{4/4} instead.
390 Don't change @file{music.ly}, though.  Replace our @file{definitions.ly}
391 with this:
393 @example
394 %%%  definitions.ly
395 mpdolce = #(make-dynamic-script (markup #:hspace 1 #:translate (cons 5 0)
396   #:line( #:dynamic "mp" #:text #:italic "dolce" )))
397 tempoMark = #(define-music-function (parser location markp) (string?)
399   \once \override Score . RehearsalMark #'self-alignment-X = #left
400   \once \override Score . RehearsalMark #'extra-spacing-width = #'(+inf.0 . -inf.0)
401   \mark \markup @{ \bold $markp @}
402 #@})
404 \layout@{
405   \context @{ \Score
406     \override MetronomeMark #'extra-offset = #'(-9 . 0)
407     \override MetronomeMark #'padding = #'3
408   @}
409   \context @{ \Staff
410     \override TimeSignature #'style = #'numbered
411   @}
412   \context @{ \Voice
413     \override Glissando #'thickness = #3
414     \override Glissando #'gap = #0.1
415   @}
417 @end example
419 @lilypond[quote,ragged-right]
420 mpdolce = #(make-dynamic-script (markup #:hspace 1 #:translate (cons 5 0)
421   #:line( #:dynamic "mp" #:text #:italic "dolce" )))
422 tempoMark = #(define-music-function (parser location markp) (string?)
424   \once \override Score . RehearsalMark #'self-alignment-X = #left
425   \once \override Score . RehearsalMark #'extra-spacing-width = #'(+inf.0 . -inf.0)
426   \mark \markup { \bold $markp }
429 \layout{
430   \context { \Score
431     \override MetronomeMark #'extra-offset = #'(-9 . 0)
432     \override MetronomeMark #'padding = #'3
433   }
434   \context { \Staff
435     \override TimeSignature #'style = #'numbered
436   }
437   \context { \Voice
438     \override Glissando #'thickness = #3
439     \override Glissando #'gap = #0.1
440   }
443 \relative c'' {
444   \tempo 4=50
445   a4.\mpdolce d8 cis4--\glissando a | b4 bes a2
446   \once \override Score.RehearsalMark #'padding = #2.0
447   \tempoMark "Poco piu mosso"
448   cis4.\< d8 e4 fis | g8(\! fis)-. e( d)-. cis2
450 @end lilypond
452 That looks nicer!  But now suppose that I want to publish this
453 piece.  My composition professor doesn't like @q{C} time
454 signatures, but I'm somewhat fond of them.  Let's copy the
455 current @file{definitions.ly} to @file{web-publish.ly} and
456 modify that.  Since this music is aimed at producing a pdf which
457 will be displayed on the screen, we'll also increase the
458 overall size of the output.
460 @example
461 %%%  definitions.ly
462 mpdolce = #(make-dynamic-script (markup #:hspace 1 #:translate (cons 5 0)
463   #:line( #:dynamic "mp" #:text #:italic "dolce" )))
464 tempoMark = #(define-music-function (parser location markp) (string?)
466   \once \override Score . RehearsalMark #'self-alignment-X = #left
467   \once \override Score . RehearsalMark #'extra-spacing-width = #'(+inf.0 . -inf.0)
468   \mark \markup @{ \bold $markp @}
469 #@})
471 #(set-global-staff-size 23)
472 \layout@{
473   \context @{ \Score
474     \override MetronomeMark #'extra-offset = #'(-9 . 0)
475     \override MetronomeMark #'padding = #'3
476   @}
477   \context @{ \Staff
478   @}
479   \context @{ \Voice
480     \override Glissando #'thickness = #3
481     \override Glissando #'gap = #0.1
482   @}
484 @end example
486 @lilypond[quote,ragged-right]
487 mpdolce = #(make-dynamic-script (markup #:hspace 1 #:translate (cons 5 0)
488   #:line( #:dynamic "mp" #:text #:italic "dolce" )))
489 tempoMark = #(define-music-function (parser location markp) (string?)
491   \once \override Score . RehearsalMark #'self-alignment-X = #left
492   \once \override Score . RehearsalMark #'extra-spacing-width = #'(+inf.0 . -inf.0)
493   \mark \markup { \bold $markp }
496 #(set-global-staff-size 23)
497 \layout{
498   \context { \Score
499     \override MetronomeMark #'extra-offset = #'(-9 . 0)
500     \override MetronomeMark #'padding = #'3
501   }
502   \context { \Voice
503     \override Glissando #'thickness = #3
504     \override Glissando #'gap = #0.1
505   }
508 \relative c'' {
509   \tempo 4=50
510   a4.\mpdolce d8 cis4--\glissando a | b4 bes a2
511   \once \override Score.RehearsalMark #'padding = #2.0
512   \tempoMark "Poco piu mosso"
513   cis4.\< d8 e4 fis | g8(\! fis)-. e( d)-. cis2
515 @end lilypond
517 Now in our music, I simply replace
518 @code{\include "definitions.ly"} with
519 @code{\include "web-publish.ly"}.  Of course, we could make this
520 even more convenient.  We could make a @file{definitions.ly} file which
521 contains only the definitions of @code{mpdolce} and @code{tempoMark}, a
522 @file{web-publish.ly} file which contains only the @code{\layout}
523 section listed above, and a @file{university.ly} file which
524 contains only the tweaks to produce the output that my professor
525 prefers.  The top of @file{music.ly} would then look like this:
527 @example
528 \include "definitions.ly"
530 %%%  Only uncomment one of these two lines!
531 \include "web-publish.ly"
532 %\include "university.ly"
533 @end example
535 This approach can be useful even if you are only producing
536 one set of parts.  I use half a dozen different
537 @q{style sheet} files for my projects.  I begin every music
538 file with @code{\include "../global.ly"}, which contains
540 @example
541 %%%   global.ly
542 \version @w{"@version{}"}
543 #(ly:set-option 'point-and-click #f)
544 \include "../init/init-defs.ly"
545 \include "../init/init-layout.ly"
546 \include "../init/init-headers.ly"
547 \include "../init/init-paper.ly"
548 @end example
551 @node When things don't work
552 @section When things don't work
554 @menu
555 * Updating old input files::          
556 * Troubleshooting (taking it all apart)::  
557 * Minimal examples::            
558 @end menu
560 @node Updating old input files
561 @subsection Updating old input files
563 The LilyPond input syntax occasionally changes.  As LilyPond itself
564 improves, the syntax (input language) is modified accordingly.  Sometimes
565 these changes are made to make the input easier to read and write or
566 sometimes the changes are made to accommodate new features of LilyPond.
568 LilyPond comes with a file that makes this updating easier:
569 @code{convert-ly}.  For details about how to run this program, see
570 @rprogram{Updating files with convert-ly}.
572 Unfortunately, @code{convert-ly} cannot handle all input changes.  It
573 takes care of simple search-and-replace changes (such as @code{raggedright}
574 becoming @code{ragged-right}), but some changes are too
575 complicated.  The syntax changes that @code{convert-ly} cannot handle
576 are listed in @rprogram{Updating files with convert-ly}.
578 For example, in LilyPond 2.4 and earlier, accents and non-English
579 letters were entered using LaTeX -- for example,
580 @code{No\"el} (this would print the French word for
581 @q{Christmas}).  In LilyPond 2.6 and above, the special
582 @code{ë} must be entered directly into the LilyPond file as an
583 UTF-8 character.  @code{convert-ly} cannot change all the LaTeX
584 special characters into UTF-8 characters; you must manually update
585 your old LilyPond input files.
588 @node Troubleshooting (taking it all apart)
589 @subsection Troubleshooting (taking it all apart)
591 Sooner or later, you will write a file that LilyPond cannot
592 compile.  The messages that LilyPond gives may help
593 you find the error, but in many cases you need to do some
594 investigation to determine the source of the problem.
596 The most powerful tools for this purpose are the
597 single line comment (indicated by @code{%}) and the block
598 comment (indicated by @code{%@{ ... %@}}).  If you don't
599 know where a problem is, start commenting out huge portions
600 of your input file.  After you comment out a section, try
601 compiling the file again.  If it works, then the problem
602 must exist in the portion you just commented.  If it doesn't
603 work, then keep on commenting out material until you have
604 something that works.
606 In an extreme case, you might end up with only
608 @example
609 \score @{
610   <<
611     % \melody
612     % \harmony
613     % \bass
614   >>
615   \layout@{@}
617 @end example
619 @noindent
620 (in other words, a file without any music)
622 If that happens, don't give up.  Uncomment a bit -- say,
623 the bass part -- and see if it works.  If it doesn't work,
624 then comment out all of the bass music (but leave
625 @code{\bass} in the @code{\score} uncommented.
627 @example
628 bass = \relative c' @{
630   c4 c c c
631   d d d d
634 @end example
636 Now start slowly uncommenting more and more of the
637 @code{bass} part until you find the problem line.
639 Another very useful debugging technique is constructing
640 @ref{Minimal examples}.
643 @node Minimal examples
644 @subsection Minimal examples
646 A minimal example is an example which is as small as possible.  These
647 examples are much easier to understand than long examples.  Minimal
648 examples are used for
650 @itemize
651 @item Bug reports
652 @item Sending a help request to mailing lists
653 @item Adding an example to the @uref{http://lsr.dsi.unimi.it/,
654 LilyPond Snippet Repository}
655 @end itemize
657 To construct an example which is as small as possible, the rule is
658 quite simple: remove anything which is not necessary.  When trying to
659 remove unnecessary parts of a file, it is a very good idea to comment
660 out lines instead of deleting them.  That way, if you discover that you
661 actually @emph{do} need some lines, you can uncomment them, instead of
662 typing them in from scratch.
664 There are two exceptions to the @qq{as small as possible} rule:
666 @itemize
667 @item Include the @code{\version} number.
668 @item If possible, use @code{\paper@{ ragged-right=##t @}} at the
669 top of your example.
670 @end itemize
672 The whole point of a minimal example is to make it easy to read:
674 @itemize
675 @item Avoid using complicated notes, keys, or time signatures, unless you
676 wish to demonstrate something is about the behavior of those items.
677 @item Do not use @code{\override} commands unless that is the point of the
678 example.
679 @end itemize
683 @node Scores and parts
684 @section Scores and parts
686 TODO: this is really old stuff from the really old tutorial.
687 Rewrite, fix, etc.  Or maybe delete entirely.  -gp
688 Include section on tags   -td
689 and then move to section 5. Working ...  -td
691 In orchestral music, all notes are printed twice.  Once in a part for
692 the musicians, and once in a full score for the conductor.  Variables can
693 be used to avoid double work.  The music is entered once, and stored in
694 a variable.  The contents of that variable is then used to generate
695 both the part and the full score.
697 It is convenient to define the notes in a special file.  For example,
698 suppose that the file @file{horn-music.ly} contains the following part
699 of a horn/@/bassoon duo
701 @example
702 hornNotes = \relative c @{
703   \time 2/4
704   r4 f8 a cis4 f e d
706 @end example
708 @noindent
709 Then, an individual part is made by putting the following in a file
711 @example
712 \include "horn-music.ly"
713 \header @{
714   instrument = "Horn in F"
718  \transpose f c' \hornNotes
720 @end example
722 The line
724 @example
725 \include "horn-music.ly"
726 @end example
728 @noindent
729 substitutes the contents of @file{horn-music.ly} at this position in
730 the file, so @code{hornNotes} is defined afterwards.  The command
731 @code{\transpose f@tie{}c'} indicates that the argument, being
732 @code{\hornNotes}, should be transposed by a fifth upwards.  Sounding
733 @code{f} is denoted by notated @code{c'}, which corresponds with the
734 tuning of a normal French Horn in@tie{}F.  The transposition can be seen
735 in the following output
737 @lilypond[quote,ragged-right]
738 \transpose f c' \relative c {
739   \time 2/4
740   r4 f8 a cis4 f e d
742 @end lilypond
744 In ensemble pieces, one of the voices often does not play for many
745 measures.  This is denoted by a special rest, the multi-measure
746 rest.  It is entered with a capital @code{R} followed by a duration
747 (@code{1}@tie{}for a whole note, @code{2}@tie{}for a half note,
748 etc.).  By multiplying the
749 duration, longer rests can be constructed.  For example, this rest
750 takes 3@tie{}measures in 2/4 time
752 @example
753 R2*3
754 @end example
756 When printing the part, multi-rests
757 must be condensed.  This is done by setting a run-time variable
759 @example
760 \set Score.skipBars = ##t
761 @end example
763 @noindent
764 This command sets the property @code{skipBars} in the
765 @code{Score} context to true (@code{##t}).  Prepending the rest and
766 this option to the music above, leads to the following result
768 @lilypond[quote,ragged-right]
769 \transpose f c' \relative c {
770   \time 2/4
771   \set Score.skipBars = ##t
772   R2*3
773   r4 f8 a cis4 f e d
775 @end lilypond
778 The score is made by combining all of the music together.  Assuming
779 that the other voice is in @code{bassoonNotes} in the file
780 @file{bassoon-music.ly}, a score is made with
782 @example
783 \include "bassoon-music.ly"
784 \include "horn-music.ly"
787   \new Staff \hornNotes
788   \new Staff \bassoonNotes
790 @end example
792 @noindent
793 leading to
795 @lilypond[quote,ragged-right]
796 \relative c <<
797   \new Staff {
798     \time 2/4 R2*3
799     r4 f8 a cis4 f e d
800   }
801   \new Staff {
802     \clef bass
803     r4 d,8 f | gis4 c | b bes |
804     a8 e f4 | g d | gis f
805   }
807 @end lilypond