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