]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/templates.itely
51c27f4f573c702492c11ef2d807cd6f39324ffd
[lilypond.git] / Documentation / user / templates.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @c This file is part of lilypond.tely
3 @ignore
4     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5
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
9
10 @node Templates
11 @appendix Templates
12
13 This section of the manual contains templates with the LilyPond score
14 already set up for you.  Just add notes, run LilyPond, and enjoy
15 beautiful printed scores!
16
17 @c bad node name for ancient notation to avoid confict
18 @menu
19 * Single staff::                
20 * Piano templates::             
21 * String quartet::              
22 * Vocal ensembles::             
23 * Ancient notation templates::  
24 * Jazz combo::                  
25 * Lilypond-book templates::     
26 @end menu
27
28
29 @node Single staff
30 @appendixsec Single staff
31 @appendixsubsec Notes only
32
33 The first example gives you a staff with notes, suitable for a solo
34 instrument or a melodic fragment.  Cut and paste this into a file,
35 add notes, and you're finished!
36
37 @lilypond[quote,verbatim,ragged-right]
38 \version "2.9.13"
39 melody = \relative c' {
40    \clef treble
41    \key c \major
42    \time 4/4
43
44    a4 b c d
45 }
46
47 \score {
48    \new Staff \melody
49    \layout { }
50    \midi {}
51 }
52 @end lilypond
53
54 @appendixsubsec Notes and lyrics
55
56 The next example demonstrates a simple melody with lyrics.  Cut and
57 paste, add notes, then words for the lyrics.  This example turns off
58 automatic beaming, which is common for vocal parts.  If you want to use
59 automatic beaming, you'll have to change or comment out the relevant
60 line.
61
62 @lilypond[quote,verbatim,ragged-right]
63 \version "2.9.13"
64 melody = \relative c' {
65    \clef treble
66    \key c \major
67    \time 4/4
68
69    a4 b c d
70 }
71
72 text = \lyricmode {
73    Aaa Bee Cee Dee
74 }
75
76 \score{
77    <<
78       \new Voice = "one" {
79          \autoBeamOff
80          \melody
81       }
82       \new Lyrics \lyricsto "one" \text
83    >>
84    \layout { }
85    \midi { }
86 }
87 @end lilypond
88
89 @appendixsubsec Notes and chords
90
91 Want to prepare a lead sheet with a melody and chords?  Look no further!
92
93 @lilypond[quote,verbatim,ragged-right]
94 \version "2.9.13"
95 melody = \relative c' {
96    \clef treble
97    \key c \major
98    \time 4/4
99
100    f4 e8[ c] d4 g |
101    a2 ~ a2 |
102 }
103
104 harmonies = \chordmode {
105    c4:m f:min7 g:maj c:aug d2:dim b:sus
106 }
107
108 \score {
109    <<
110       \new ChordNames {
111          \set chordChanges = ##t
112          \harmonies
113       }
114    \new Staff \melody
115    >>
116
117    \layout{ }
118    \midi { }
119 }
120 @end lilypond
121
122 @appendixsubsec Notes, lyrics, and chords.
123
124 This template allows you to prepare a song with melody, words, and chords.
125
126 @lilypond[quote,verbatim,ragged-right]
127 \version "2.9.13"
128 melody = \relative c' {
129    \clef treble
130    \key c \major
131    \time 4/4
132
133    a b c d
134 }
135
136 text = \lyricmode {
137    Aaa Bee Cee Dee
138 }
139
140 harmonies = \chordmode {
141    a2 c2
142 }
143
144 \score {
145    <<
146       \new ChordNames {
147          \set chordChanges = ##t
148          \harmonies
149       }
150    \new Voice = "one" {
151       \autoBeamOff
152       \melody
153    }
154    \new Lyrics \lyricsto "one" \text
155    >>
156    \layout { }
157    \midi { }
158 }
159 @end lilypond
160
161 @node Piano templates
162 @appendixsec Piano templates
163 @appendixsubsec Solo piano
164
165 Here is a simple piano staff.
166
167 @lilypond[quote,verbatim,ragged-right]
168 \version "2.9.13"
169 upper = \relative c'' {
170    \clef treble
171    \key c \major
172    \time 4/4
173
174    a b c d
175 }
176
177 lower = \relative c {
178    \clef bass
179    \key c \major
180    \time 4/4
181
182    a2 c
183 }
184
185 \score {
186    \new PianoStaff <<
187       \set PianoStaff.instrumentName = "Piano  "
188       \new Staff = "upper" \upper
189       \new Staff = "lower" \lower
190    >>
191    \layout { }
192    \midi { }
193 }
194 @end lilypond
195
196 @appendixsubsec Piano and melody with lyrics
197
198 Here is a typical song format: one staff with the melody and lyrics, with
199 piano accompaniment underneath.
200
201 @lilypond[quote,verbatim,ragged-right]
202 \version "2.9.13"
203 melody = \relative c'' {
204    \clef treble
205    \key c \major
206    \time 4/4
207
208    a b c d
209 }
210
211 text = \lyricmode {
212    Aaa Bee Cee Dee
213 }
214
215 upper = \relative c'' {
216    \clef treble
217    \key c \major
218    \time 4/4
219
220    a b c d
221 }
222
223 lower = \relative c {
224    \clef bass
225    \key c \major
226    \time 4/4
227
228    a2 c
229 }
230
231 \score {
232    <<
233       \new Voice = "mel" {
234           \autoBeamOff
235           \melody
236       }
237       \new Lyrics \lyricsto mel \text
238
239       \new PianoStaff <<
240          \new Staff = "upper" \upper
241          \new Staff = "lower" \lower
242       >>
243    >>
244    \layout {
245       \context { \RemoveEmptyStaffContext }
246    }
247    \midi { }
248 }
249 @end lilypond
250
251
252 @appendixsubsec Piano centered lyrics
253
254 Instead of having a full staff for the melody and lyrics, you can place
255 the lyrics between the piano staff (and omit the separate melody staff).
256
257 @lilypond[quote,verbatim,ragged-right]
258 \version "2.9.13"
259 upper = \relative c'' {
260    \clef treble
261    \key c \major
262    \time 4/4
263
264    a b c d
265 }
266
267 lower = \relative c {
268    \clef bass
269    \key c \major
270    \time 4/4
271
272    a2 c
273 }
274
275 text = \lyricmode {
276    Aaa Bee Cee Dee
277 }
278
279 \score {
280   \new GrandStaff <<
281     \new Staff = upper { \new Voice = "singer" \upper }
282     \new Lyrics \lyricsto "singer" \text
283     \new Staff = lower {
284       \clef bass
285       \lower
286     }
287   >>
288   \layout {
289     \context { \GrandStaff \accepts "Lyrics" }
290     \context { \Lyrics \consists "Bar_engraver" }
291   }
292   \midi { }
293 }
294 @end lilypond
295
296
297 @appendixsubsec Piano centered dynamics
298
299 Many piano scores have the dynamics centered between the two
300 staffs.  This requires a bit of tweaking to implement, but
301 since the template is right here, you don't have to do the
302 tweaking yourself.
303
304 @lilypond[quote,verbatim,ragged-right]
305 \version "2.9.13"
306 upper = \relative c'' {
307   \clef treble
308   \key c \major
309   \time 4/4
310
311   a b c d
312 }
313
314 lower = \relative c {
315   \clef bass
316   \key c \major
317   \time 4/4
318
319   a2 c
320 }
321
322 dynamics = {
323   s2\fff\> s4
324   s\!\pp
325 }
326
327 pedal = {
328   s2\sustainDown s2\sustainUp
329 }
330
331 \score {
332   \new PianoStaff <<
333     \new Staff = "upper" \upper
334     \new Dynamics = "dynamics" \dynamics
335     \new Staff = "lower" <<
336       \clef bass
337       \lower
338     >>
339     \new Dynamics = "pedal" \pedal
340   >>
341   \layout {
342     \context {
343       \type "Engraver_group"
344       \name Dynamics
345       \alias Voice % So that \cresc works, for example.
346       \consists "Output_property_engraver"
347
348       \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
349       pedalSustainStrings = #'("Ped." "*Ped." "*")
350       pedalUnaCordaStrings = #'("una corda" "" "tre corde")
351
352       \consists "Piano_pedal_engraver"
353       \consists "Script_engraver"
354       \consists "Dynamic_engraver"
355       \consists "Text_engraver"
356
357       \override TextScript #'font-size = #2
358       \override TextScript #'font-shape = #'italic
359       \override DynamicText #'extra-offset = #'(0 . 2.5)
360       \override Hairpin #'extra-offset = #'(0 . 2.5)
361
362       \consists "Skip_event_swallow_translator"
363
364       \consists "Axis_group_engraver"
365     }
366     \context {
367       \PianoStaff
368       \accepts Dynamics
369     }
370   }
371 }
372 \score {
373   \new PianoStaff <<
374     \new Staff = "upper" << \upper \dynamics >>
375     \new Staff = "lower" << \lower \dynamics >>
376     \new Dynamics = "pedal" \pedal
377   >>
378   \midi {
379     \context {
380       \type "Performer_group"
381       \name Dynamics
382       \consists "Piano_pedal_performer"
383     }
384     \context {
385       \PianoStaff
386       \accepts Dynamics
387     }
388   }
389 }
390 @end lilypond
391
392
393 @node String quartet
394 @appendixsec String quartet
395 @appendixsubsec String quartet
396
397 This template demonstrates a string quartet.  It also uses a @code{\global}
398 section for time and key signatures.
399
400 @lilypond[quote,verbatim,ragged-right]
401 \version "2.9.13"
402
403 global= {
404   \time 4/4
405   \key c \major
406 }
407
408 violinOne = \new Voice { \relative c''{
409   \set Staff.instrumentName = "Violin 1 "
410
411   c2 d e1
412
413 \bar "|." }}
414 violinTwo = \new Voice { \relative c''{
415   \set Staff.instrumentName = "Violin 2 "
416
417   g2 f e1
418
419 \bar "|." }}
420 viola = \new Voice { \relative c' {
421   \set Staff.instrumentName = "Viola "
422   \clef alto
423
424   e2 d c1
425
426 \bar "|." }}
427 cello = \new Voice { \relative c' {
428   \set Staff.instrumentName = "Cello     "
429   \clef bass
430
431   c2 b a1
432
433 \bar "|."}}
434
435 \score {
436    \new StaffGroup <<
437       \new Staff << \global \violinOne >>
438       \new Staff << \global \violinTwo >>
439       \new Staff << \global \viola >>
440       \new Staff << \global \cello >>
441    >>
442    \layout { }
443    \midi { }
444 }
445 @end lilypond
446
447 @appendixsubsec String quartet parts
448
449 The previous example produces a nice string quartet, but what if you
450 needed to print parts?  This template demonstrates how to use the
451 @code{\tag} feature to easily split a piece into individual parts.
452
453 You need to split this template into separate files; the filenames
454 are contained in comments at the beginning of each file.  @code{piece.ly}
455 contains all the music definitions.  The other files -- @code{score.ly},
456 @code{vn1.ly}, @code{vn2.ly}, @code{vla.ly}, and
457 @code{vlc.ly} -- produce the appropiate part.
458
459 @verbatim
460 %%%%% piece.ly
461 \version "2.9.13"
462
463 global= {
464   \time 4/4
465   \key c \major
466 }
467
468 Violinone = \new Voice { \relative c''{
469   \set Staff.instrumentName = "Violin 1 "
470
471   c2 d e1
472
473 \bar "|." }}   %*********************************
474 Violintwo = \new Voice { \relative c''{
475   \set Staff.instrumentName = "Violin 2 "
476
477   g2 f e1
478
479 \bar "|." }}   %*********************************
480 Viola = \new Voice { \relative c' {
481   \set Staff.instrumentName = "Viola "
482   \clef alto
483
484   e2 d c1
485
486 \bar "|." }}   %*********************************
487 Cello = \new Voice { \relative c' {
488   \set Staff.instrumentName = "Cello     "
489   \clef bass
490
491   c2 b a1
492
493 \bar "|."}}   %**********************************
494
495 music = {
496   <<
497     \tag #'score \tag #'vn1 \new Staff { << \global \Violinone >> }
498     \tag #'score \tag #'vn2 \new Staff { << \global \Violintwo>> }
499     \tag #'score \tag #'vla \new Staff { << \global \Viola>> }
500     \tag #'score \tag #'vlc \new Staff { << \global \Cello>> }
501   >>
502 }
503
504
505
506 %%%%% score.ly
507 \version "2.9.13"
508 \include "piece.ly"
509 #(set-global-staff-size 14)
510 \score {
511   \new StaffGroup \keepWithTag #'score \music
512   \layout { }
513   \midi { }
514 }
515
516
517 %%%%% vn1.ly
518 \version "2.9.13"
519 \include "piece.ly"
520 \score {
521   \keepWithTag #'vn1 \music
522   \layout { }
523 }
524
525
526 %%%%% vn2.ly
527 \version "2.9.13"
528 \include "piece.ly"
529 \score {
530   \keepWithTag #'vn2 \music
531   \layout { }
532 }
533
534
535 %%%%% vla.ly
536 \version "2.9.13"
537 \include "piece.ly"
538 \score {
539   \keepWithTag #'vla \music
540   \layout { }
541 }
542
543
544 %%%%% vlc.ly
545 \version "2.9.13"
546 \include "piece.ly"
547 \score {
548   \keepWithTag #'vlc \music
549   \layout { }
550 }
551 @end verbatim
552
553
554 @node Vocal ensembles
555 @appendixsec Vocal ensembles
556
557 @appendixsubsec SATB vocal score
558
559 Here is a standard four-part SATB vocal score.  With larger ensembles,
560 it's often useful to include a section which is included in all
561 parts.  For example, the time signature and key signatures are almost
562 always the same for all parts.
563
564 @lilypond[quote,verbatim,ragged-right]
565 \version "2.9.13"
566 global = {
567    \key c \major
568    \time 4/4
569 }
570
571 sopMusic = \relative c'' {
572    c4 c c8[( b)] c4
573 }
574 sopWords = \lyricmode {
575    hi hi hi hi
576 }
577
578 altoMusic = \relative c' {
579    e4 f d e
580 }
581 altoWords =\lyricmode {
582    ha ha ha ha
583 }
584
585 tenorMusic = \relative c' {
586    g4 a f g
587 }
588 tenorWords = \lyricmode {
589    hu hu hu hu
590 }
591
592 bassMusic = \relative c {
593    c4 c g c
594 }
595 bassWords = \lyricmode {
596    ho ho ho ho
597 }
598
599 \score {
600    \new ChoirStaff <<
601       \new Lyrics = sopranos { s1 }
602       \new Staff = women <<
603          \new Voice =
604            "sopranos" { \voiceOne << \global \sopMusic >> }
605          \new Voice =
606            "altos" { \voiceTwo << \global \altoMusic >> }
607       >>
608       \new Lyrics = "altos" { s1 }
609       \new Lyrics = "tenors" { s1 }
610       \new Staff = men <<
611          \clef bass
612          \new Voice =
613            "tenors" { \voiceOne <<\global \tenorMusic >> }
614          \new Voice =
615            "basses" { \voiceTwo <<\global \bassMusic >> }
616       >>
617       \new Lyrics = basses { s1 }
618
619       \context Lyrics = sopranos \lyricsto sopranos \sopWords
620       \context Lyrics = altos \lyricsto altos \altoWords
621       \context Lyrics = tenors \lyricsto tenors \tenorWords
622       \context Lyrics = basses \lyricsto basses \bassWords
623    >>
624
625    \layout {
626       \context {
627          % a little smaller so lyrics
628          % can be closer to the staff
629          \Staff
630          \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
631       }
632    }
633 }
634 @end lilypond
635
636
637 @appendixsubsec SATB vocal score and automatic piano reduction
638
639 This template adds an automatic piano reduction to the SATB vocal
640 score.  This demonstrates one of the strengths of LilyPond -- you
641 can use a music definition more than once.  If you make any changes
642 to the vocal notes (say, tenorMusic), then the changes will also
643 apply to the piano reduction.
644
645 @lilypond[quote,verbatim,ragged-right]
646 \version "2.9.13"
647 global = {
648    \key c \major
649    \time 4/4
650 }
651
652 sopMusic = \relative c'' {
653    c4 c c8[( b)] c4
654 }
655 sopWords = \lyricmode {
656    hi hi hi hi
657 }
658
659 altoMusic = \relative c' {
660    e4 f d e
661 }
662 altoWords =\lyricmode {
663    ha ha ha ha
664 }
665
666 tenorMusic = \relative c' {
667    g4 a f g
668 }
669 tenorWords = \lyricmode {
670    hu hu hu hu
671 }
672
673 bassMusic = \relative c {
674    c4 c g c
675 }
676 bassWords = \lyricmode {
677    ho ho ho ho
678 }
679
680 \score {
681   <<
682     \new ChoirStaff <<
683       \new Lyrics = sopranos { s1 }
684       \new Staff = women <<
685         \new Voice =
686           "sopranos" { \voiceOne << \global \sopMusic >> }
687         \new Voice =
688           "altos" { \voiceTwo << \global \altoMusic >> }
689       >>
690       \new Lyrics = "altos" { s1 }
691       \new Lyrics = "tenors" { s1 }
692       \new Staff = men <<
693         \clef bass
694         \new Voice =
695           "tenors" { \voiceOne <<\global \tenorMusic >> }
696         \new Voice =
697           "basses" { \voiceTwo <<\global \bassMusic >> }
698       >>
699       \new Lyrics = basses { s1 }
700
701       \context Lyrics = sopranos \lyricsto sopranos \sopWords
702       \context Lyrics = altos \lyricsto altos \altoWords
703       \context Lyrics = tenors \lyricsto tenors \tenorWords
704       \context Lyrics = basses \lyricsto basses \bassWords
705     >>
706   \new PianoStaff <<
707     \new Staff <<
708       \set Staff.printPartCombineTexts = ##f
709       \partcombine
710       << \global \sopMusic >>
711       << \global \altoMusic >>
712     >>
713     \new Staff <<
714       \clef bass
715       \set Staff.printPartCombineTexts = ##f
716       \partcombine
717       << \global \tenorMusic >>
718       << \global \bassMusic >>
719     >>
720    >>
721   >>
722   \layout {
723     \context {
724       % a little smaller so lyrics
725       % can be closer to the staff
726       \Staff
727         \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
728     }
729   }
730 }
731 @end lilypond
732
733 @appendixsubsec SATB with aligned contexts
734
735 Here all the lyrics lines are placed using @code{alignAboveContext}
736 and @code{alignBelowContext}.
737
738 @lilypond[quote,verbatim,ragged-right]
739 \version "2.10.0"
740 global = {
741   \key c \major
742   \time 4/4
743 }
744
745 sopMusic = \relative c'' {
746   c4 c c8[( b)] c4
747 }
748 sopWords = \lyricmode {
749   hi hi hi hi
750 }
751
752 altoMusic = \relative c' {
753   e4 f d e
754 }
755 altoWords =\lyricmode {
756   ha ha ha ha
757 }
758
759 tenorMusic = \relative c' {
760   g4 a f g
761 }
762 tenorWords = \lyricmode {
763   hu hu hu hu
764 }
765
766 bassMusic = \relative c {
767   c4 c g c
768 }
769 bassWords = \lyricmode {
770   ho ho ho ho
771 }
772
773 \score {
774   \new ChoirStaff <<
775      \new Staff = women <<
776         \new Voice =
777           "sopranos" { \voiceOne << \global \sopMusic >> }
778         \new Voice =
779           "altos" { \voiceTwo << \global \altoMusic >> }
780      >>
781      \new Lyrics \with {alignAboveContext=women} \lyricsto sopranos \sopWords
782      \new Lyrics \with {alignBelowContext=women} \lyricsto altos \altoWords
783 % we could remove the line about this with the line below, since we want
784 % the alto lyrics to be below the alto Voice anyway.
785 %    \new Lyrics \lyricsto altos \altoWords
786
787      \new Staff = men <<
788         \clef bass
789         \new Voice =
790           "tenors" { \voiceOne <<\global \tenorMusic >> }
791         \new Voice =
792           "basses" { \voiceTwo <<\global \bassMusic >> }
793      >>
794
795      \new Lyrics \with {alignAboveContext=men} \lyricsto tenors \tenorWords
796      \new Lyrics \with {alignBelowContext=men} \lyricsto basses \bassWords
797 % again, we could replace the line above this with the line below.
798 %    \new Lyrics \lyricsto basses \bassWords
799   >>
800
801   \layout {
802      \context {
803         % a little smaller so lyrics
804         % can be closer to the staff
805         \Staff
806         \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
807      }
808   }
809 }
810
811
812 \score {
813   \new ChoirStaff <<
814      \new Staff = women <<
815         \new Voice =
816           "sopranos" { \voiceOne << \global \sopMusic >> }
817         \new Voice =
818           "altos" { \voiceTwo << \global \altoMusic >> }
819      >>
820
821      \new Lyrics \with {alignAboveContext=women} \lyricsto sopranos \sopWords
822      \new Lyrics \lyricsto altos \altoWords
823
824      \new Staff = men <<
825         \clef bass
826         \new Voice =
827           "tenors" { \voiceOne <<\global \tenorMusic >> }
828         \new Voice =
829           "basses" { \voiceTwo <<\global \bassMusic >> }
830      >>
831
832      \new Lyrics \with {alignAboveContext=men} \lyricsto tenors \tenorWords
833      \new Lyrics \lyricsto basses \bassWords
834   >>
835
836   \layout {
837      \context {
838         % a little smaller so lyrics
839         % can be closer to the staff
840         \Staff
841         \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
842      }
843   }
844
845 @end lilypond
846
847
848 @c bad node name to avoid node name confict
849 @node Ancient notation templates
850 @appendixsec Ancient notation templates
851
852 @appendixsubsec Transcription of mensural music
853
854 When transcribing mensural music, an incipit at the beginning of the
855 piece is useful to indicate the original key and tempo.  While today
856 musicians are used to bar lines in order to faster recognize rhythmic
857 patterns, bar lines were not yet invented during the period of
858 mensural music; in fact, the meter often changed after every few
859 notes.  As a compromise, bar lines are often printed between the
860 staves rather than on the staves.
861
862 @lilypond[quote,verbatim,line-width=11.0\cm]
863 \version "2.9.13"
864
865 global = {
866   \set Score.skipBars = ##t
867
868   % incipit
869   \once \override Score.SystemStartBracket #'transparent = ##t
870   \override Score.SpacingSpanner #'spacing-increment = #1.0 % tight spacing
871   \key f \major
872   \time 2/2
873   \once \override Staff.TimeSignature #'style = #'neomensural
874   \override Voice.NoteHead #'style = #'neomensural
875   \override Voice.Rest #'style = #'neomensural
876   \set Staff.printKeyCancellation = ##f
877   \cadenzaOn % turn off bar lines
878   \skip 1*10
879   \once \override Staff.BarLine #'transparent = ##f
880   \bar "||"
881   \skip 1*1 % need this extra \skip such that clef change comes
882             % after bar line
883   \bar ""
884
885   % main
886   \revert Score.SpacingSpanner #'spacing-increment % CHECK: no effect?
887   \cadenzaOff % turn bar lines on again
888   \once \override Staff.Clef #'full-size-change = ##t
889   \set Staff.forceClef = ##t
890   \key g \major
891   \time 4/4
892   \override Voice.NoteHead #'style = #'default
893   \override Voice.Rest #'style = #'default
894
895   % FIXME: setting printKeyCancellation back to #t must not
896   % occur in the first bar after the incipit.  Dto. for forceClef.
897   % Therefore, we need an extra \skip.
898   \skip 1*1
899   \set Staff.printKeyCancellation = ##t
900   \set Staff.forceClef = ##f
901
902   \skip 1*7 % the actual music
903
904   % let finis bar go through all staves
905   \override Staff.BarLine #'transparent = ##f
906
907   % finis bar
908   \bar "|."
909 }
910
911 discantusNotes = {
912   \transpose c' c'' {
913     \set Staff.instrumentName = "Discantus  "
914
915     % incipit
916     \clef "neomensural-c1"
917     c'1. s2   % two bars
918     \skip 1*8 % eight bars
919     \skip 1*1 % one bar
920
921     % main
922     \clef "treble"
923     d'2. d'4 |
924     b e' d'2 |
925     c'4 e'4.( d'8 c' b |
926     a4) b a2 |
927     b4.( c'8 d'4) c'4 |
928     \once \override NoteHead #'transparent = ##t c'1 |
929     b\breve |
930   }
931 }
932
933 discantusLyrics = \lyricmode {
934   % incipit
935   IV-
936
937   % main
938   Ju -- bi -- |
939   la -- te De -- |
940   o, om --
941   nis ter -- |
942   ra, __ om- |
943   "..." |
944   -us. |
945 }
946
947 altusNotes = {
948   \transpose c' c'' {
949     \set Staff.instrumentName = "Altus  "
950
951     % incipit
952     \clef "neomensural-c3"
953     r1        % one bar
954     f1. s2    % two bars
955     \skip 1*7 % seven bars
956     \skip 1*1 % one bar
957
958     % main
959     \clef "treble"
960     r2 g2. e4 fis g | % two bars
961     a2 g4 e |
962     fis g4.( fis16 e fis4) |
963     g1 |
964     \once \override NoteHead #'transparent = ##t g1 |
965     g\breve |
966   }
967 }
968
969 altusLyrics = \lyricmode {
970   % incipit
971   IV-
972
973   % main
974   Ju -- bi -- la -- te | % two bars
975   De -- o, om -- |
976   nis ter -- ra, |
977   "..." |
978   -us. |
979 }
980
981 tenorNotes = {
982   \transpose c' c' {
983     \set Staff.instrumentName = "Tenor  "
984
985     % incipit
986     \clef "neomensural-c4"
987     r\longa   % four bars
988     r\breve   % two bars
989     r1        % one bar
990     c'1. s2   % two bars
991     \skip 1*1 % one bar
992     \skip 1*1 % one bar
993
994     % main
995     \clef "treble_8"
996     R1 |
997     R1 |
998     R1 |
999     r2 d'2. d'4 b e' | % two bars
1000     \once \override NoteHead #'transparent = ##t e'1 |
1001     d'\breve |
1002   }
1003 }
1004
1005 tenorLyrics = \lyricmode {
1006   % incipit
1007   IV-
1008
1009   % main
1010   Ju -- bi -- la -- te | % two bars
1011   "..." |
1012   -us. |
1013 }
1014
1015 bassusNotes = {
1016   \transpose c' c' {
1017     \set Staff.instrumentName = "Bassus  "
1018
1019     % incipit
1020     \clef "bass"
1021     r\maxima  % eight bars
1022     f1. s2    % two bars
1023     \skip 1*1 % one bar
1024
1025     % main
1026     \clef "bass"
1027     R1 |
1028     R1 |
1029     R1 |
1030     R1 |
1031     g2. e4 |
1032     \once \override NoteHead #'transparent = ##t e1 |
1033     g\breve |
1034   }
1035 }
1036
1037 bassusLyrics = \lyricmode {
1038   % incipit
1039   IV-
1040
1041   % main
1042   Ju -- bi- |
1043   "..." |
1044   -us. |
1045 }
1046
1047 \score {
1048   \new StaffGroup = choirStaff <<
1049     \new Voice =
1050       "discantusNotes" << \global \discantusNotes >>
1051     \new Lyrics =
1052       "discantusLyrics" \lyricsto discantusNotes { \discantusLyrics }
1053     \new Voice =
1054       "altusNotes" << \global \altusNotes >>
1055     \new Lyrics =
1056       "altusLyrics" \lyricsto altusNotes { \altusLyrics }
1057     \new Voice =
1058       "tenorNotes" << \global \tenorNotes >>
1059     \new Lyrics =
1060       "tenorLyrics" \lyricsto tenorNotes { \tenorLyrics }
1061     \new Voice =
1062       "bassusNotes" << \global \bassusNotes >>
1063     \new Lyrics =
1064       "bassusLyrics" \lyricsto bassusNotes { \bassusLyrics }
1065   >>
1066   \layout {
1067     \context {
1068       \Score
1069
1070       % no bars in staves
1071       \override BarLine #'transparent = ##t
1072
1073       % incipit should not start with a start delimiter
1074       \remove "System_start_delimiter_engraver"
1075     }
1076     \context {
1077       \Voice
1078
1079       % no slurs
1080       \override Slur #'transparent = ##t
1081
1082       % Comment in the below "\remove" command to allow line
1083       % breaking also at those barlines where a note overlaps
1084       % into the next bar.  The command is commented out in this
1085       % short example score, but especially for large scores, you
1086       % will typically yield better line breaking and thus improve
1087       % overall spacing if you comment in the following command.
1088       %\remove "Forbid_line_break_engraver"
1089     }
1090   }
1091 }
1092 @end lilypond
1093
1094
1095 @appendixsubsec Gregorian transcription template
1096
1097 This example demonstrates how to do modern transcription of Gregorian
1098 music.  Gregorian music has no measure, no stems; it uses only half and
1099 quarter noteheads, and special marks, indicating rests of different length.
1100
1101 @lilypond[quote,verbatim,ragged-right]
1102 \include "gregorian-init.ly"
1103 \version "2.9.13"
1104
1105 chant = \relative c' {
1106   \set Score.timing = ##f
1107   f4 a2 \divisioMinima
1108   g4 b a2 f2 \divisioMaior
1109   g4( f) f( g) a2 \finalis
1110 }
1111
1112 verba = \lyricmode {
1113   Lo -- rem ip -- sum do -- lor sit a -- met
1114 }
1115
1116 \score {
1117   \new Staff <<
1118     \new Voice = "melody" {
1119       \chant
1120     }
1121     \new Lyrics = "one" \lyricsto melody \verba
1122   >>
1123
1124   \layout {
1125     \context {
1126       \Staff
1127       \remove "Time_signature_engraver"
1128       \remove "Bar_engraver"
1129       \override Stem #'transparent = ##t
1130     }
1131     \context {
1132       \Voice
1133       \override Stem #'length = #0
1134     }
1135     \context {
1136       \Score
1137       barAlways = ##t
1138     }
1139   }
1140 }
1141 @end lilypond
1142
1143
1144 @node Jazz combo
1145 @appendixsec Jazz combo
1146
1147 This is a much more complicated template, for a jazz ensemble.  Note that all
1148 instruments are notated in @code{\key c \major}.  This refers to the key in
1149 concert pitch; LilyPond will automatically transpose the key if the music
1150 is within a @code{\transpose} section.
1151
1152 @c TODO must clean up this jazz combo example
1153 @c   - transpositions stated in names (ie "trumpet in Bb" or whatever)
1154 @c   - one global section, instead of "global" (time) and "key"
1155 @c   - does it need those wierd macros?  sl, nsl, etc.
1156 @c   - maybe ask Amelie Zapf to clean it up, or whether I should just
1157 @c     make whatever changes I feel like.
1158
1159 @c FIXME: produces a warning ; key change merge.
1160 @c The `line-width' argument is for the \header.
1161
1162 @lilypond[quote,verbatim,ragged-right,line-width]
1163 \version "2.9.13"
1164 \header {
1165   title = "Song"
1166   subtitle = "(tune)"
1167   composer = "Me"
1168   meter = "moderato"
1169   piece = "Swing"
1170   tagline = \markup {
1171     \column {
1172       "LilyPond example file by Amelie Zapf,"
1173       "Berlin 07/07/2003"
1174     }
1175   }
1176   texidoc = "Jazz tune for combo
1177              (horns, guitar, piano, bass, drums)."
1178 }
1179
1180 #(set-global-staff-size 16)
1181 \include "english.ly"
1182
1183 %%%%%%%%%%%% Some macros %%%%%%%%%%%%%%%%%%%
1184
1185 sl = {
1186   \override NoteHead #'style = #'slash
1187   \override Stem #'transparent = ##t
1188 }
1189 nsl = {
1190   \revert NoteHead #'style
1191   \revert Stem #'transparent
1192 }
1193 cr = \override NoteHead #'style = #'cross
1194 ncr = \revert NoteHead #'style
1195
1196 %% insert chord name style stuff here.
1197
1198 jzchords = { }
1199
1200
1201 %%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%%
1202
1203 global = {
1204   \time 4/4
1205 }
1206
1207 Key = { \key c \major }
1208
1209 % ############ Horns ############
1210
1211 % ------ Trumpet ------
1212 trpt = \transpose c d \relative c'' {
1213   \Key
1214   c1 c c
1215 }
1216 trpharmony = \transpose c' d {
1217   \jzchords
1218 }
1219 trumpet = {
1220   \global
1221   \set Staff.instrumentName = #"Trumpet"
1222   \clef treble
1223   <<
1224     \trpt
1225   >>
1226 }
1227
1228 % ------ Alto Saxophone ------
1229 alto = \transpose c a \relative c' {
1230   \Key
1231   c1 c c
1232 }
1233 altoharmony = \transpose c' a {
1234   \jzchords
1235 }
1236 altosax = {
1237   \global
1238   \set Staff.instrumentName = #"Alto Sax"
1239   \clef treble
1240   <<
1241     \alto
1242   >>
1243 }
1244
1245 % ------ Baritone Saxophone ------
1246 bari = \transpose c a' \relative c {
1247   \Key
1248   c1 c \sl d4^"Solo" d d d \nsl
1249 }
1250 bariharmony = \transpose c' a \chordmode {
1251   \jzchords s1 s d2:maj e:m7
1252 }
1253 barisax = {
1254   \global
1255   \set Staff.instrumentName = #"Bari Sax"
1256   \clef treble
1257   <<
1258     \bari
1259   >>
1260 }
1261
1262 % ------ Trombone ------
1263 tbone = \relative c {
1264   \Key
1265   c1 c c
1266 }
1267 tboneharmony = \chordmode {
1268   \jzchords
1269 }
1270 trombone = {
1271   \global
1272   \set Staff.instrumentName = #"Trombone"
1273   \clef bass
1274   <<
1275     \tbone
1276   >>
1277 }
1278
1279 % ############ Rhythm Section #############
1280
1281 % ------ Guitar ------
1282 gtr = \relative c'' {
1283   \Key
1284   c1 \sl b4 b b b \nsl c1
1285 }
1286 gtrharmony = \chordmode {
1287   \jzchords
1288   s1 c2:min7+ d2:maj9
1289 }
1290 guitar = {
1291   \global
1292   \set Staff.instrumentName = #"Guitar"
1293   \clef treble
1294   <<
1295     \gtr
1296   >>
1297 }
1298
1299 %% ------ Piano ------
1300 rhUpper = \relative c'' {
1301   \voiceOne
1302   \Key
1303   c1 c c
1304 }
1305 rhLower = \relative c' {
1306   \voiceTwo
1307   \Key
1308   e1 e e
1309 }
1310
1311 lhUpper = \relative c' {
1312   \voiceOne
1313   \Key
1314   g1 g g
1315 }
1316 lhLower = \relative c {
1317   \voiceTwo
1318   \Key
1319   c1 c c
1320 }
1321
1322 PianoRH = {
1323   \clef treble
1324   \global
1325   \set Staff.midiInstrument = "acoustic grand"
1326   <<
1327     \new Voice = "one" \rhUpper
1328     \new Voice = "two" \rhLower
1329   >>
1330 }
1331 PianoLH = {
1332   \clef bass
1333   \global
1334   \set Staff.midiInstrument = "acoustic grand"
1335   <<
1336     \new Voice = "one" \lhUpper
1337     \new Voice = "two" \lhLower
1338   >>
1339 }
1340
1341 piano = {
1342   <<
1343     \set PianoStaff.instrumentName = #"Piano"
1344     \new Staff = "upper" \PianoRH
1345     \new Staff = "lower" \PianoLH
1346   >>
1347 }
1348
1349 % ------ Bass Guitar ------
1350 Bass = \relative c {
1351   \Key
1352   c1 c c
1353 }
1354 bass = {
1355   \global
1356   \set Staff.instrumentName = #"Bass"
1357   \clef bass
1358   <<
1359     \Bass
1360   >>
1361 }
1362
1363 % ------ Drums ------
1364 up = \drummode {
1365   hh4 <hh sn>4 hh <hh sn> hh <hh sn>4
1366   hh4 <hh sn>4
1367   hh4 <hh sn>4
1368   hh4 <hh sn>4
1369 }
1370
1371 down = \drummode {
1372   bd4 s bd s bd s bd s bd s bd s
1373 }
1374
1375 drumContents = {
1376   \global
1377   <<
1378     \set DrumStaff.instrumentName = #"Drums"
1379     \new DrumVoice { \voiceOne \up }
1380     \new DrumVoice { \voiceTwo \down }
1381   >>
1382 }
1383
1384 %%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%%
1385
1386 \score {
1387   <<
1388     \new StaffGroup = "horns" <<
1389       \new Staff = "trumpet" \trumpet
1390       \new Staff = "altosax" \altosax
1391       \new ChordNames = "barichords" \bariharmony
1392       \new Staff = "barisax" \barisax
1393       \new Staff = "trombone" \trombone
1394     >>
1395
1396     \new StaffGroup = "rhythm" <<
1397       \new ChordNames = "chords" \gtrharmony
1398       \new Staff = "guitar" \guitar
1399       \new PianoStaff = "piano" \piano
1400       \new Staff = "bass" \bass
1401       \new DrumStaff { \drumContents }
1402     >>
1403   >>
1404
1405   \layout {
1406     \context { \RemoveEmptyStaffContext }
1407     \context {
1408       \Score
1409       \override BarNumber #'padding = #3
1410       \override RehearsalMark #'padding = #2
1411       skipBars = ##t
1412     }
1413   }
1414
1415   \midi { }
1416 }
1417 @end lilypond
1418
1419 @ignore
1420
1421 This isn't very useful, and only duplicates material in
1422 "global issues".  And if this info changes, this section often
1423 gets forgotten.
1424
1425 @no de Other templates
1426 @se ction Other templates
1427 @su bsection All headers
1428
1429 This template displays all available headers.  Some of them are only
1430 used in the Mutopia project; they don't affect the printed output at
1431 all.  They are used if you want the piece to be listed with different
1432 information in the Mutopia database than you wish to have printed on the
1433 music.  For example, Mutopia lists the composer of the famous D major
1434 violin concerto as TchaikovskyPI, whereas perhaps you wish to print
1435 "Petr Tchaikowski" on your music.
1436
1437 @ The `line-width' is for \header.
1438 @li lypond[quote,verbatim,ragged-right,line-width]
1439 \version "2.9.13"
1440 \header {
1441   dedication = "dedication"
1442   title = "Title"
1443   subtitle = "Subtitle"
1444   subsubtitle = "Subsubtitle"
1445   composer = "Composer (xxxx-yyyy)"
1446   opus = "Opus 0"
1447   piece = "Piece I"
1448   meter = "meter"
1449   instrument = "Instrument"
1450   arranger = "Arranger"
1451   poet = "Poet"
1452   texttranslator = "Translator"
1453   copyright = "public domain"
1454
1455   % These are headers used by the Mutopia Project
1456   % http://www.mutopiaproject.org/
1457   mutopiatitle = ""
1458   mutopiacomposer = ""
1459   mutopiapoet = ""
1460   mutopiainstrument = ""
1461   date = "composer's dates"
1462   source = "urtext "
1463   maintainer = "your name here"
1464   maintainerEmail = "your email here"
1465   maintainerWeb = "your home page"
1466   lastupdated = "2004/Aug/26"
1467 }
1468
1469 \score {
1470   { c'4 }
1471   \header {
1472     piece = "piece1"
1473     opus = "opus1"
1474   }
1475 }
1476
1477 \score {
1478   { c'4 }
1479   \header {
1480     piece = "piece2"
1481     opus = "opus2"
1482   }
1483 }
1484 @end lilypond
1485 @end ignore
1486
1487
1488 @node Lilypond-book templates
1489 @appendixsec Lilypond-book templates
1490
1491 These templates are for use with @code{lilypond-book}.  If you're not familiar
1492 with this program, please refer to @ref{LilyPond-book}.
1493
1494 @appendixsubsec LaTeX
1495
1496 You can include LilyPond fragments in a LaTeX document.
1497
1498 @example
1499 \documentclass[]@{article@}
1500
1501 \begin@{document@}
1502
1503 Normal LaTeX text.
1504
1505 \begin@{lilypond@}
1506 \relative c'' @{
1507 a4 b c d
1508 @}
1509 \end@{lilypond@}
1510
1511 More LaTeX text.
1512
1513 \begin@{lilypond@}
1514 \relative c'' @{
1515 d4 c b a
1516 @}
1517 \end@{lilypond@}
1518 \end@{document@}
1519 @end example
1520
1521 @appendixsubsec Texinfo
1522
1523 You can include LilyPond fragments in Texinfo; in fact, this entire manual
1524 is written in Texinfo.
1525
1526 @example
1527 \input texinfo
1528 @@node Top
1529
1530 Texinfo text
1531
1532 @@lilypond[verbatim,fragment,ragged-right]
1533 a4 b c d
1534 @@end lilypond
1535
1536 More Texinfo text
1537
1538 @@lilypond[verbatim,fragment,ragged-right]
1539 d4 c b a
1540 @@end lilypond
1541
1542 @@bye
1543 @end example