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