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