]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/examples.itely
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / Documentation / user / examples.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.7.39"
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 { \tempo 4=60 }
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.7.39"
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 { \tempo 4=60 }
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.7.39"
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 { \tempo 4=60}
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.7.39"
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 { \tempo 4=60 }
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.7.39"
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.instrument = "Piano  "
180       \new Staff = "upper" \upper
181       \new Staff = "lower" \lower
182    >>
183    \layout { }
184    \midi { \tempo 4=60 }
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.7.39"
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 { \tempo 4=60 }
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.7.39"
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 { \tempo 4=60 }
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.7.39"
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.7.39"
395
396 global= {
397   \time 4/4
398   \key c \major
399 }
400
401 violinOne = \new Voice { \relative c''{
402   \set Staff.instrument = "Violin 1 "
403
404   c2 d e1
405
406 \bar "|." }}
407 violinTwo = \new Voice { \relative c''{
408   \set Staff.instrument = "Violin 2 "
409
410   g2 f e1
411
412 \bar "|." }}
413 viola = \new Voice { \relative c' {
414   \set Staff.instrument = "Viola "
415   \clef alto
416
417   e2 d c1
418
419 \bar "|." }}
420 cello = \new Voice { \relative c' {
421   \set Staff.instrument = "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 { \tempo 4=60}
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.7.39"
455
456 global= {
457   \time 4/4
458   \key c \major
459 }
460
461 Violinone = \new Voice { \relative c''{
462   \set Staff.instrument = "Violin 1 "
463
464   c2 d e1
465
466 \bar "|." }}   %*********************************
467 Violintwo = \new Voice { \relative c''{
468   \set Staff.instrument = "Violin 2 "
469
470   g2 f e1
471
472 \bar "|." }}   %*********************************
473 Viola = \new Voice { \relative c' {
474   \set Staff.instrument = "Viola "
475   \clef alto
476
477   e2 d c1
478
479 \bar "|." }}   %*********************************
480 Cello = \new Voice { \relative c' {
481   \set Staff.instrument = "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.7.39"
501 \include "piece.ly"
502 #(set-global-staff-size 14)
503 \score {
504   \new StaffGroup \keepWithTag #'score \music
505   \layout { }
506   \midi { \tempo 4 = 60 }
507 }
508
509
510 %%%%% vn1.ly
511 \version "2.7.39"
512 \include "piece.ly"
513 \score {
514   \keepWithTag #'vn1 \music
515   \layout { }
516 }
517
518
519 %%%%% vn2.ly
520 \version "2.7.39"
521 \include "piece.ly"
522 \score {
523   \keepWithTag #'vn2 \music
524   \layout { }
525 }
526
527
528 %%%%% vla.ly
529 \version "2.7.39"
530 \include "piece.ly"
531 \score {
532   \keepWithTag #'vla \music
533   \layout { }
534 }
535
536
537 %%%%% vlc.ly
538 \version "2.7.39"
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.7.39"
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.7.39"
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
727 @c bad node name to avoid node name confict
728 @node Ancient notation templates
729 @appendixsec Ancient notation templates
730
731 @appendixsubsec Transcription of mensural music
732
733 When transcribing mensural music, an incipit at the beginning of the
734 piece is useful to indicate the original key and tempo.  While today
735 musicians are used to bar lines in order to faster recognize rhythmic
736 patterns, bar lines were not yet invented during the period of
737 mensural music; in fact, the meter often changed after every few
738 notes.  As a compromise, bar lines are often printed between the
739 staves rather than on the staves.
740
741 @lilypond[quote,verbatim,line-width=11.0\cm]
742 \version "2.7.39"
743
744 global = {
745   \set Score.skipBars = ##t
746
747   % incipit
748   \once \override Score.SystemStartBracket #'transparent = ##t
749   \override Score.SpacingSpanner #'spacing-increment = #1.0 % tight spacing
750   \key f \major
751   \time 2/2
752   \once \override Staff.TimeSignature #'style = #'neomensural
753   \override Voice.NoteHead #'style = #'neomensural
754   \override Voice.Rest #'style = #'neomensural
755   \set Staff.printKeyCancellation = ##f
756   \cadenzaOn % turn off bar lines
757   \skip 1*10
758   \once \override Staff.BarLine #'transparent = ##f
759   \bar "||"
760   \skip 1*1 % need this extra \skip such that clef change comes
761             % after bar line
762   \bar ""
763
764   % main
765   \revert Score.SpacingSpanner #'spacing-increment % CHECK: no effect?
766   \cadenzaOff % turn bar lines on again
767   \once \override Staff.Clef #'full-size-change = ##t
768   \set Staff.forceClef = ##t
769   \key g \major
770   \time 4/4
771   \override Voice.NoteHead #'style = #'default
772   \override Voice.Rest #'style = #'default
773
774   % FIXME: setting printKeyCancellation back to #t must not
775   % occur in the first bar after the incipit.  Dto. for forceClef.
776   % Therefore, we need an extra \skip.
777   \skip 1*1
778   \set Staff.printKeyCancellation = ##t
779   \set Staff.forceClef = ##f
780
781   \skip 1*7 % the actual music
782
783   % let finis bar go through all staves
784   \override Staff.BarLine #'transparent = ##f
785
786   % finis bar
787   \bar "|."
788 }
789
790 discantusNotes = {
791   \transpose c' c'' {
792     \set Staff.instrument = "Discantus  "
793
794     % incipit
795     \clef "neomensural-c1"
796     c'1. s2   % two bars
797     \skip 1*8 % eight bars
798     \skip 1*1 % one bar
799
800     % main
801     \clef "treble"
802     d'2. d'4 |
803     b e' d'2 |
804     c'4 e'4.( d'8 c' b |
805     a4) b a2 |
806     b4.( c'8 d'4) c'4 |
807     \once \override NoteHead #'transparent = ##t c'1 |
808     b\breve |
809   }
810 }
811
812 discantusLyrics = \lyricmode {
813   % incipit
814   IV-
815
816   % main
817   Ju -- bi -- |
818   la -- te De -- |
819   o, om --
820   nis ter -- |
821   ra, __ om- |
822   "..." |
823   -us. |
824 }
825
826 altusNotes = {
827   \transpose c' c'' {
828     \set Staff.instrument = "Altus  "
829
830     % incipit
831     \clef "neomensural-c3"
832     r1        % one bar
833     f1. s2    % two bars
834     \skip 1*7 % seven bars
835     \skip 1*1 % one bar
836
837     % main
838     \clef "treble"
839     r2 g2. e4 fis g | % two bars
840     a2 g4 e |
841     fis g4.( fis16 e fis4) |
842     g1 |
843     \once \override NoteHead #'transparent = ##t g1 |
844     g\breve |
845   }
846 }
847
848 altusLyrics = \lyricmode {
849   % incipit
850   IV-
851
852   % main
853   Ju -- bi -- la -- te | % two bars
854   De -- o, om -- |
855   nis ter -- ra, |
856   "..." |
857   -us. |
858 }
859
860 tenorNotes = {
861   \transpose c' c' {
862     \set Staff.instrument = "Tenor  "
863
864     % incipit
865     \clef "neomensural-c4"
866     r\longa   % four bars
867     r\breve   % two bars
868     r1        % one bar
869     c'1. s2   % two bars
870     \skip 1*1 % one bar
871     \skip 1*1 % one bar
872
873     % main
874     \clef "treble_8"
875     R1 |
876     R1 |
877     R1 |
878     r2 d'2. d'4 b e' | % two bars
879     \once \override NoteHead #'transparent = ##t e'1 |
880     d'\breve |
881   }
882 }
883
884 tenorLyrics = \lyricmode {
885   % incipit
886   IV-
887
888   % main
889   Ju -- bi -- la -- te | % two bars
890   "..." |
891   -us. |
892 }
893
894 bassusNotes = {
895   \transpose c' c' {
896     \set Staff.instrument = "Bassus  "
897
898     % incipit
899     \clef "bass"
900     r\maxima  % eight bars
901     f1. s2    % two bars
902     \skip 1*1 % one bar
903
904     % main
905     \clef "bass"
906     R1 |
907     R1 |
908     R1 |
909     R1 |
910     g2. e4 |
911     \once \override NoteHead #'transparent = ##t e1 |
912     g\breve |
913   }
914 }
915
916 bassusLyrics = \lyricmode {
917   % incipit
918   IV-
919
920   % main
921   Ju -- bi- |
922   "..." |
923   -us. |
924 }
925
926 \score {
927   \new StaffGroup = choirStaff <<
928     \new Voice =
929       "discantusNotes" << \global \discantusNotes >>
930     \new Lyrics =
931       "discantusLyrics" \lyricsto discantusNotes { \discantusLyrics }
932     \new Voice =
933       "altusNotes" << \global \altusNotes >>
934     \new Lyrics =
935       "altusLyrics" \lyricsto altusNotes { \altusLyrics }
936     \new Voice =
937       "tenorNotes" << \global \tenorNotes >>
938     \new Lyrics =
939       "tenorLyrics" \lyricsto tenorNotes { \tenorLyrics }
940     \new Voice =
941       "bassusNotes" << \global \bassusNotes >>
942     \new Lyrics =
943       "bassusLyrics" \lyricsto bassusNotes { \bassusLyrics }
944   >>
945   \layout {
946     \context {
947       \Score
948       \override BarLine #'transparent = ##t
949       \remove "System_start_delimiter_engraver"
950     }
951     \context {
952       \Voice
953       \override Slur #'transparent = ##t
954     }
955   }
956 }
957 @end lilypond
958
959
960 @appendixsubsec Gregorian transcription template
961
962 This example demonstrates how to do modern transcription of Gregorian
963 music.  Gregorian music has no measure, no stems; it uses only half and
964 quarter noteheads, and special marks, indicating rests of different length.
965
966 @lilypond[quote,verbatim,ragged-right]
967 \include "gregorian-init.ly"
968 \version "2.8.0"
969
970 chant = \relative c' {
971   \set Score.timing = ##f
972   f4 a2 \divisioMinima
973   g4 b a2 f2 \divisioMaior
974   g4( f) f( g) a2 \finalis
975 }
976
977 verba = \lyricmode {
978   Lo -- rem ip -- sum do -- lor sit a -- met
979 }
980
981 \score {
982   \new Staff <<
983     \new Voice = "melody" {
984       \chant
985     }
986     \new Lyrics = "one" \lyricsto melody \verba
987   >>
988
989   \layout {
990     \context {
991       \Staff
992       \remove "Time_signature_engraver"
993       \remove "Bar_engraver"
994       \override Stem #'transparent = ##t
995     }
996     \context {
997       \Voice
998       \override Stem #'length = #0
999     }
1000     \context {
1001       \Score
1002       barAlways = ##t
1003     }
1004   }
1005 }
1006 @end lilypond
1007
1008
1009 @node Jazz combo
1010 @appendixsec Jazz combo
1011
1012 This is a much more complicated template, for a jazz ensemble.  Note that all
1013 instruments are notated in @code{\key c \major}.  This refers to the key in
1014 concert pitch; LilyPond will automatically transpose the key if the music
1015 is within a @code{\transpose} section.
1016
1017 @c TODO must clean up this jazz combo example
1018 @c   - transpositions stated in names (ie "trumpet in Bb" or whatever)
1019 @c   - one global section, instead of "global" (time) and "key"
1020 @c   - does it need those wierd macros?  sl, nsl, etc.
1021 @c   - maybe ask Amelie Zapf to clean it up, or whether I should just
1022 @c     make whatever changes I feel like.
1023
1024 @c FIXME: produces a warning ; key change merge.
1025 @c The `line-width' argument is for the \header.
1026
1027 @lilypond[quote,verbatim,ragged-right,line-width]
1028 \version "2.7.39"
1029 \header {
1030   title = "Song"
1031   subtitle = "(tune)"
1032   composer = "Me"
1033   meter = "moderato"
1034   piece = "Swing"
1035   tagline = \markup {
1036     \column {
1037       "LilyPond example file by Amelie Zapf,"
1038       "Berlin 07/07/2003"
1039     }
1040   }
1041   texidoc = "Jazz tune for combo
1042              (horns, guitar, piano, bass, drums)."
1043 }
1044
1045 #(set-global-staff-size 16)
1046 \include "english.ly"
1047
1048 %%%%%%%%%%%% Some macros %%%%%%%%%%%%%%%%%%%
1049
1050 sl = {
1051   \override NoteHead #'style = #'slash
1052   \override Stem #'transparent = ##t
1053 }
1054 nsl = {
1055   \revert NoteHead #'style
1056   \revert Stem #'transparent
1057 }
1058 cr = \override NoteHead #'style = #'cross
1059 ncr = \revert NoteHead #'style
1060
1061 %% insert chord name style stuff here.
1062
1063 jzchords = { }
1064
1065
1066 %%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%%
1067
1068 global = {
1069   \time 4/4
1070 }
1071
1072 Key = { \key c \major }
1073
1074 % ############ Horns ############
1075
1076 % ------ Trumpet ------
1077 trpt = \transpose c d \relative c'' {
1078   \Key
1079   c1 c c
1080 }
1081 trpharmony = \transpose c' d {
1082   \jzchords
1083 }
1084 trumpet = {
1085   \global
1086   \set Staff.instrument = #"Trumpet"
1087   \clef treble
1088   <<
1089     \trpt
1090   >>
1091 }
1092
1093 % ------ Alto Saxophone ------
1094 alto = \transpose c a \relative c' {
1095   \Key
1096   c1 c c
1097 }
1098 altoharmony = \transpose c' a {
1099   \jzchords
1100 }
1101 altosax = {
1102   \global
1103   \set Staff.instrument = #"Alto Sax"
1104   \clef treble
1105   <<
1106     \alto
1107   >>
1108 }
1109
1110 % ------ Baritone Saxophone ------
1111 bari = \transpose c a' \relative c {
1112   \Key
1113   c1 c \sl d4^"Solo" d d d \nsl
1114 }
1115 bariharmony = \transpose c' a \chordmode {
1116   \jzchords s1 s d2:maj e:m7
1117 }
1118 barisax = {
1119   \global
1120   \set Staff.instrument = #"Bari Sax"
1121   \clef treble
1122   <<
1123     \bari
1124   >>
1125 }
1126
1127 % ------ Trombone ------
1128 tbone = \relative c {
1129   \Key
1130   c1 c c
1131 }
1132 tboneharmony = \chordmode {
1133   \jzchords
1134 }
1135 trombone = {
1136   \global
1137   \set Staff.instrument = #"Trombone"
1138   \clef bass
1139   <<
1140     \tbone
1141   >>
1142 }
1143
1144 % ############ Rhythm Section #############
1145
1146 % ------ Guitar ------
1147 gtr = \relative c'' {
1148   \Key
1149   c1 \sl b4 b b b \nsl c1
1150 }
1151 gtrharmony = \chordmode {
1152   \jzchords
1153   s1 c2:min7+ d2:maj9
1154 }
1155 guitar = {
1156   \global
1157   \set Staff.instrument = #"Guitar"
1158   \clef treble
1159   <<
1160     \gtr
1161   >>
1162 }
1163
1164 %% ------ Piano ------
1165 rhUpper = \relative c'' {
1166   \voiceOne
1167   \Key
1168   c1 c c
1169 }
1170 rhLower = \relative c' {
1171   \voiceTwo
1172   \Key
1173   e1 e e
1174 }
1175
1176 lhUpper = \relative c' {
1177   \voiceOne
1178   \Key
1179   g1 g g
1180 }
1181 lhLower = \relative c {
1182   \voiceTwo
1183   \Key
1184   c1 c c
1185 }
1186
1187 PianoRH = {
1188   \clef treble
1189   \global
1190   \set Staff.midiInstrument = "acoustic grand"
1191   <<
1192     \new Voice = "one" \rhUpper
1193     \new Voice = "two" \rhLower
1194   >>
1195 }
1196 PianoLH = {
1197   \clef bass
1198   \global
1199   \set Staff.midiInstrument = "acoustic grand"
1200   <<
1201     \new Voice = "one" \lhUpper
1202     \new Voice = "two" \lhLower
1203   >>
1204 }
1205
1206 piano = {
1207   <<
1208     \set PianoStaff.instrument = #"Piano"
1209     \new Staff = "upper" \PianoRH
1210     \new Staff = "lower" \PianoLH
1211   >>
1212 }
1213
1214 % ------ Bass Guitar ------
1215 Bass = \relative c {
1216   \Key
1217   c1 c c
1218 }
1219 bass = {
1220   \global
1221   \set Staff.instrument = #"Bass"
1222   \clef bass
1223   <<
1224     \Bass
1225   >>
1226 }
1227
1228 % ------ Drums ------
1229 up = \drummode {
1230   hh4 <hh sn>4 hh <hh sn> hh <hh sn>4
1231   hh4 <hh sn>4
1232   hh4 <hh sn>4
1233   hh4 <hh sn>4
1234 }
1235
1236 down = \drummode {
1237   bd4 s bd s bd s bd s bd s bd s
1238 }
1239
1240 drumContents = {
1241   \global
1242   <<
1243     \set DrumStaff.instrument = #"Drums"
1244     \new DrumVoice { \voiceOne \up }
1245     \new DrumVoice { \voiceTwo \down }
1246   >>
1247 }
1248
1249 %%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%%
1250
1251 \score {
1252   <<
1253     \new StaffGroup = "horns" <<
1254       \new Staff = "trumpet" \trumpet
1255       \new Staff = "altosax" \altosax
1256       \new ChordNames = "barichords" \bariharmony
1257       \new Staff = "barisax" \barisax
1258       \new Staff = "trombone" \trombone
1259     >>
1260
1261     \new StaffGroup = "rhythm" <<
1262       \new ChordNames = "chords" \gtrharmony
1263       \new Staff = "guitar" \guitar
1264       \new PianoStaff = "piano" \piano
1265       \new Staff = "bass" \bass
1266       \new DrumStaff { \drumContents }
1267     >>
1268   >>
1269
1270   \layout {
1271     \context { \RemoveEmptyStaffContext }
1272     \context {
1273       \Score
1274       \override BarNumber #'padding = #3
1275       \override RehearsalMark #'padding = #2
1276       skipBars = ##t
1277     }
1278   }
1279
1280   \midi { \tempo 4 = 75 }
1281 }
1282 @end lilypond
1283
1284 @ignore
1285
1286 This isn't very useful, and only duplicates material in
1287 "global issues".  And if this info changes, this section often
1288 gets forgotten.
1289
1290 @no de Other templates
1291 @se ction Other templates
1292 @su bsection All headers
1293
1294 This template displays all available headers.  Some of them are only
1295 used in the Mutopia project; they don't affect the printed output at
1296 all.  They are used if you want the piece to be listed with different
1297 information in the Mutopia database than you wish to have printed on the
1298 music.  For example, Mutopia lists the composer of the famous D major
1299 violin concerto as TchaikovskyPI, whereas perhaps you wish to print
1300 "Petr Tchaikowski" on your music.
1301
1302 @ The `line-width' is for \header.
1303 @li lypond[quote,verbatim,ragged-right,line-width]
1304 \version "2.7.39"
1305 \header {
1306   dedication = "dedication"
1307   title = "Title"
1308   subtitle = "Subtitle"
1309   subsubtitle = "Subsubtitle"
1310   composer = "Composer (xxxx-yyyy)"
1311   opus = "Opus 0"
1312   piece = "Piece I"
1313   meter = "meter"
1314   instrument = "Instrument"
1315   arranger = "Arranger"
1316   poet = "Poet"
1317   texttranslator = "Translator"
1318   copyright = "public domain"
1319
1320   % These are headers used by the Mutopia Project
1321   % http://www.mutopiaproject.org/
1322   mutopiatitle = ""
1323   mutopiacomposer = ""
1324   mutopiapoet = ""
1325   mutopiainstrument = ""
1326   date = "composer's dates"
1327   source = "urtext "
1328   maintainer = "your name here"
1329   maintainerEmail = "your email here"
1330   maintainerWeb = "your home page"
1331   lastupdated = "2004/Aug/26"
1332 }
1333
1334 \score {
1335   { c'4 }
1336   \header {
1337     piece = "piece1"
1338     opus = "opus1"
1339   }
1340 }
1341
1342 \score {
1343   { c'4 }
1344   \header {
1345     piece = "piece2"
1346     opus = "opus2"
1347   }
1348 }
1349 @end lilypond
1350 @end ignore
1351
1352
1353 @node Lilypond-book templates
1354 @appendixsec Lilypond-book templates
1355
1356 These templates are for use with @code{lilypond-book}.  If you're not familiar
1357 with this program, please refer to @ref{LilyPond-book}.
1358
1359 @appendixsubsec LaTeX
1360
1361 You can include LilyPond fragments in a LaTeX document.
1362
1363 @example
1364 \documentclass[]@{article@}
1365
1366 \begin@{document@}
1367
1368 Normal LaTeX text.
1369
1370 \begin@{lilypond@}
1371 \relative c'' @{
1372 a4 b c d
1373 @}
1374 \end@{lilypond@}
1375
1376 More LaTeX text.
1377
1378 \begin@{lilypond@}
1379 \relative c'' @{
1380 d4 c b a
1381 @}
1382 \end@{lilypond@}
1383 \end@{document@}
1384 @end example
1385
1386 @appendixsubsec Texinfo
1387
1388 You can include LilyPond fragments in Texinfo; in fact, this entire manual
1389 is written in Texinfo.
1390
1391 @example
1392 \input texinfo
1393 @@node Top
1394
1395 Texinfo text
1396
1397 @@lilypond[verbatim,fragment,ragged-right]
1398 a4 b c d
1399 @@end lilypond
1400
1401 More Texinfo text
1402
1403 @@lilypond[verbatim,fragment,ragged-right]
1404 d4 c b a
1405 @@end lilypond
1406
1407 @@bye
1408 @end example