]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/examples.itely
\context => \new update to docs; a few other small changes.
[lilypond.git] / Documentation / user / examples.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @node Example templates
3 @chapter 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 * Other templates::             
18 * Lilypond-book templates::     
19 @end menu
20
21
22 @node Single staff
23 @section Single staff
24 @subsection Notes only
25
26 The first example gives you a staff with notes, suitable for a solo
27 instrument or a melodic fragment.  Cut and paste this into a file,
28 add notes, and you're finished!
29
30 @lilypond[quote,verbatim,ragged-right]
31 \version "2.7.32"
32 melody = \relative c' {
33    \clef treble
34    \key c \major
35    \time 4/4
36
37    a4 b c d
38 }
39
40 \score {
41    \new Staff \melody
42    \layout { }
43    \midi { \tempo 4=60 }
44 }
45 @end lilypond
46
47 @subsection Notes and lyrics
48
49 The next example demonstrates a simple melody with lyrics.  Cut and
50 paste, add notes, then words for the lyrics.  This example turns off
51 automatic beaming, which is common for vocal parts.  If you want to use
52 automatic beaming, you'll have to change or comment out the relevant
53 line.
54
55 @lilypond[quote,verbatim,ragged-right]
56 \version "2.7.32"
57 melody = \relative c' {
58    \clef treble
59    \key c \major
60    \time 4/4
61
62    a4 b c d
63 }
64
65 text = \lyricmode {
66    Aaa Bee Cee Dee
67 }
68
69 \score{
70    <<
71       \new Voice = "one" {
72          \autoBeamOff
73          \melody
74       }
75       \new Lyrics \lyricsto "one" \text
76    >>
77    \layout { }
78    \midi { \tempo 4=60 }
79 }
80 @end lilypond
81
82 @subsection Notes and chords
83
84 Want to prepare a lead sheet with a melody and chords?  Look no further!
85
86 @lilypond[quote,verbatim,ragged-right]
87 \version "2.7.32"
88 melody = \relative c' {
89    \clef treble
90    \key c \major
91    \time 4/4
92
93    f4 e8[ c] d4 g |
94    a2 ~ a2 |
95 }
96
97 harmonies = \chordmode {
98    c4:m f:min7 g:maj c:aug d2:dim b:sus
99 }
100
101 \score {
102    <<
103       \new ChordNames {
104          \set chordChanges = ##t
105          \harmonies
106       }
107    \new Staff \melody
108    >>
109
110    \layout{ }
111    \midi { \tempo 4=60}
112 }
113 @end lilypond
114
115 @subsection Notes, lyrics, and chords.
116
117 This template allows you to prepare a song with melody, words, and chords.
118
119 @lilypond[quote,verbatim,ragged-right]
120 \version "2.7.32"
121 melody = \relative c' {
122    \clef treble
123    \key c \major
124    \time 4/4
125
126    a b c d
127 }
128
129 text = \lyricmode {
130    Aaa Bee Cee Dee
131 }
132
133 harmonies = \chordmode {
134    a2 c2
135 }
136
137 \score {
138    <<
139       \new ChordNames {
140          \set chordChanges = ##t
141          \harmonies
142       }
143    \new Voice = "one" {
144       \autoBeamOff
145       \melody
146    }
147    \new Lyrics \lyricsto "one" \text
148    >>
149    \layout { }
150    \midi { \tempo 4=60 }
151 }
152 @end lilypond
153
154 @node Piano templates
155 @section Piano templates
156 @subsection Solo piano
157
158 Here is a simple piano staff.
159
160 @lilypond[quote,verbatim,ragged-right]
161 \version "2.7.32"
162 upper = \relative c'' {
163    \clef treble
164    \key c \major
165    \time 4/4
166
167    a b c d
168 }
169
170 lower = \relative c {
171    \clef bass
172    \key c \major
173    \time 4/4
174
175    a2 c
176 }
177
178 \score {
179    \new PianoStaff <<
180       \set PianoStaff.instrument = "Piano  "
181       \new Staff = "upper" \upper
182       \new Staff = "lower" \lower
183    >>
184    \layout { }
185    \midi { \tempo 4=60 }
186 }
187 @end lilypond
188
189 @subsection Piano and melody with lyrics
190
191 Here is a typical song format: one staff with the melody and lyrics, with
192 piano accompaniment underneath.
193
194 @lilypond[quote,verbatim,ragged-right]
195 \version "2.7.32"
196 melody = \relative c'' {
197    \clef treble
198    \key c \major
199    \time 4/4
200
201    a b c d
202 }
203
204 text = \lyricmode {
205    Aaa Bee Cee Dee
206 }
207
208 upper = \relative c'' {
209    \clef treble
210    \key c \major
211    \time 4/4
212
213    a b c d
214 }
215
216 lower = \relative c {
217    \clef bass
218    \key c \major
219    \time 4/4
220
221    a2 c
222 }
223
224 \score {
225    <<
226       \new Voice = "mel" {
227           \autoBeamOff
228           \melody
229       }
230       \new Lyrics \lyricsto mel \text
231
232       \new PianoStaff <<
233          \new Staff = "upper" \upper
234          \new Staff = "lower" \lower
235       >>
236    >>
237    \layout {
238       \context { \RemoveEmptyStaffContext }
239    }
240    \midi { \tempo 4=60 }
241 }
242 @end lilypond
243
244
245 @subsection Piano centered lyrics
246
247 Instead of having a full staff for the melody and lyrics, you can place
248 the lyrics between the piano staff (and omit the separate melody staff).
249
250 @lilypond[quote,verbatim,ragged-right]
251 \version "2.7.32"
252 upper = \relative c'' {
253    \clef treble
254    \key c \major
255    \time 4/4
256
257    a b c d
258 }
259
260 lower = \relative c {
261    \clef bass
262    \key c \major
263    \time 4/4
264
265    a2 c
266 }
267
268 text = \lyricmode {
269    Aaa Bee Cee Dee
270 }
271
272 \score {
273   \new GrandStaff <<
274     \new Staff = upper { \new Voice = "singer" \upper }
275     \new Lyrics \lyricsto "singer" \text
276     \new Staff = lower {
277       \clef bass
278       \lower
279     }
280   >>
281   \layout {
282     \context { \GrandStaff \accepts "Lyrics" }
283     \context { \Lyrics \consists "Bar_engraver" }
284   }
285   \midi { \tempo 4=60 }
286 }
287 @end lilypond
288
289
290 @subsection Piano centered dynamics
291
292 Many piano scores have the dynamics centered between the two
293 staffs.  This requires a bit of tweaking to implement, but
294 since the template is right here, you don't have to do the
295 tweaking yourself.
296
297 @lilypond[quote,verbatim,ragged-right]
298 \version "2.7.32"
299 upper = \relative c'' {
300   \clef treble
301   \key c \major
302   \time 4/4
303
304   a b c d
305 }
306
307 lower = \relative c {
308   \clef bass
309   \key c \major
310   \time 4/4
311
312   a2 c
313 }
314
315 dynamics = {
316   s2\fff\> s4
317   s\!\pp
318 }
319
320 pedal = {
321   s2\sustainDown s2\sustainUp
322 }
323
324 \score {
325   \new PianoStaff <<
326     \new Staff = "upper" \upper
327     \new Dynamics = "dynamics" \dynamics
328     \new Staff = "lower" <<
329       \clef bass
330       \lower
331     >>
332     \new Dynamics = "pedal" \pedal
333   >>
334   \layout {
335     \context {
336       \type "Engraver_group"
337       \name Dynamics
338       \alias Voice % So that \cresc works, for example.
339       \consists "Output_property_engraver"
340
341       \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
342       pedalSustainStrings = #'("Ped." "*Ped." "*")
343       pedalUnaCordaStrings = #'("una corda" "" "tre corde")
344
345       \consists "Piano_pedal_engraver"
346       \consists "Script_engraver"
347       \consists "Dynamic_engraver"
348       \consists "Text_engraver"
349
350       \override TextScript #'font-size = #2
351       \override TextScript #'font-shape = #'italic
352       \override DynamicText #'extra-offset = #'(0 . 2.5)
353       \override Hairpin #'extra-offset = #'(0 . 2.5)
354
355       \consists "Skip_event_swallow_translator"
356
357       \consists "Axis_group_engraver"
358     }
359     \context {
360       \PianoStaff
361       \accepts Dynamics
362       \override VerticalAlignment #'forced-distance = #7
363     }
364   }
365 }
366 \score {
367   \new PianoStaff <<
368     \new Staff = "upper" << \upper \dynamics >>
369     \new Staff = "lower" << \lower \dynamics >>
370     \n ew Dynamics = "pedal" \pedal
371   >>
372   \midi {
373     \context {
374       \type "Performer_group"
375       \name Dynamics
376       \consists "Piano_pedal_performer"
377     }
378     \context {
379       \PianoStaff
380       \accepts Dynamics
381     }
382   }
383 }
384 @end lilypond
385
386
387 @node String quartet
388 @section String quartet
389 @subsection String quartet
390
391 This template demonstrates a string quartet.  It also uses a @code{\global}
392 section for time and key signatures.
393
394 @lilypond[quote,verbatim,ragged-right]
395 \version "2.7.32"
396
397 global= {
398   \time 4/4
399   \key c \major
400 }
401
402 violinOne = \new Voice { \relative c''{
403   \set Staff.instrument = "Violin 1 "
404
405   c2 d e1
406
407 \bar "|." }}
408 violinTwo = \new Voice { \relative c''{
409   \set Staff.instrument = "Violin 2 "
410
411   g2 f e1
412
413 \bar "|." }}
414 viola = \new Voice { \relative c' {
415   \set Staff.instrument = "Viola "
416   \clef alto
417
418   e2 d c1
419
420 \bar "|." }}
421 cello = \new Voice { \relative c' {
422   \set Staff.instrument = "Cello     "
423   \clef bass
424
425   c2 b a1
426
427 \bar "|."}}
428
429 \score {
430    \new StaffGroup <<
431       \new Staff << \global \violinOne >>
432       \new Staff << \global \violinTwo >>
433       \new Staff << \global \viola >>
434       \new Staff << \global \cello >>
435    >>
436    \layout { }
437    \midi { \tempo 4=60}
438 }
439 @end lilypond
440
441 @subsection String quartet parts
442
443 The previous example produces a nice string quartet, but what if you
444 needed to print parts?  This template demonstrates how to use the
445 @code{\tag} feature to easily split a piece into individual parts.
446
447 You need to split this template into separate files; the filenames
448 are contained in comments at the beginning of each file.  @code{piece.ly}
449 contains all the music definitions.  The other files -- @code{score.ly},
450 @code{vn1.ly}, @code{vn2.ly}, @code{vla.ly}, and
451 @code{vlc.ly} -- produce the appropiate part.
452
453 @verbatim
454 %%%%% piece.ly
455 \version "2.7.32"
456
457 global= {
458   \time 4/4
459   \key c \major
460 }
461
462 Violinone = \new Voice { \relative c''{
463   \set Staff.instrument = "Violin 1 "
464
465   c2 d e1
466
467 \bar "|." }}   %*********************************
468 Violintwo = \new Voice { \relative c''{
469   \set Staff.instrument = "Violin 2 "
470
471   g2 f e1
472
473 \bar "|." }}   %*********************************
474 Viola = \new Voice { \relative c' {
475   \set Staff.instrument = "Viola "
476   \clef alto
477
478   e2 d c1
479
480 \bar "|." }}   %*********************************
481 Cello = \new Voice { \relative c' {
482   \set Staff.instrument = "Cello     "
483   \clef bass
484
485   c2 b a1
486
487 \bar "|."}}   %**********************************
488
489 music = {
490   <<
491     \tag #'(score vn1) \new Staff { << \global \Violinone >> }
492     \tag #'(score vn2) \new Staff { << \global \Violintwo>> }
493     \tag #'(score vla) \new Staff { << \global \Viola>> }
494     \tag #'(score vlc) \new Staff { << \global \Cello>> }
495   >>
496 }
497
498
499
500 %%%%% score.ly
501 \version "2.7.32"
502 \include "piece.ly"
503 #(set-global-staff-size 14)
504 \score {
505   \new StaffGroup \keepWithTag #'score \music
506   \layout { }
507   \midi { \tempo 4 = 60 }
508 }
509
510
511 %%%%% vn1.ly
512 \version "2.7.32"
513 \include "piece.ly"
514 \score { 
515   \keepWithTag #'vn1 \music
516   \layout { }
517 }
518
519
520 %%%%% vn2.ly
521 \version "2.7.32"
522 \include "piece.ly"
523 \score { 
524   \keepWithTag #'vn2 \music
525   \layout { }
526 }
527
528
529 %%%%% vla.ly
530 \version "2.7.32"
531 \include "piece.ly"
532 \score { 
533   \keepWithTag #'vla \music
534   \layout { }
535 }
536
537
538 %%%%% vlc.ly
539 \version "2.7.32"
540 \include "piece.ly"
541 \score { 
542   \keepWithTag #'vlc \music
543   \layout { }
544 }
545 @end verbatim
546
547
548 @node Vocal ensembles
549 @section Vocal ensembles
550
551 @subsection SATB vocal score
552
553 Here is a standard four-part SATB vocal score.  With larger ensembles,
554 it's often useful to include a section which is included in all
555 parts.  For example, the time signature and key signatures are almost
556 always the same for all parts.
557
558 @lilypond[quote,verbatim,ragged-right]
559 \version "2.7.32"
560 global = {
561    \key c \major
562    \time 4/4
563 }
564
565 sopMusic = \relative c'' {
566    c4 c c8[( b)] c4
567 }
568 sopWords = \lyricmode {
569    hi hi hi hi
570 }
571
572 altoMusic = \relative c' {
573    e4 f d e
574 }
575 altoWords =\lyricmode {
576    ha ha ha ha
577 }
578
579 tenorMusic = \relative c' {
580    g4 a f g
581 }
582 tenorWords = \lyricmode {
583    hu hu hu hu
584 }
585
586 bassMusic = \relative c {
587    c4 c g c
588 }
589 bassWords = \lyricmode {
590    ho ho ho ho
591 }
592
593 \score {
594    \new ChoirStaff <<
595       \new Lyrics = sopranos { s1 }
596       \new Staff = women <<
597          \new Voice =
598            "sopranos" { \voiceOne << \global \sopMusic >> }
599          \new Voice =
600            "altos" { \voiceTwo << \global \altoMusic >> }
601       >>
602       \new Lyrics = "altos" { s1 }
603       \new Lyrics = "tenors" { s1 }
604       \new Staff = men <<
605          \clef bass
606          \new Voice =
607            "tenors" { \voiceOne <<\global \tenorMusic >> }
608          \new Voice =
609            "basses" { \voiceTwo <<\global \bassMusic >> }
610       >>
611       \new Lyrics = basses { s1 }
612
613       \context Lyrics = sopranos \lyricsto sopranos \sopWords
614       \context Lyrics = altos \lyricsto altos \altoWords
615       \context Lyrics = tenors \lyricsto tenors \tenorWords
616       \context Lyrics = basses \lyricsto basses \bassWords
617    >>
618
619    \layout {
620       \context {
621          % a little smaller so lyrics
622          % can be closer to the staff
623          \Staff
624          \override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
625       }
626    }
627 }
628 @end lilypond
629
630
631 @subsection SATB vocal score and automatic piano reduction
632
633 This template adds an automatic piano reduction to the SATB vocal
634 score.  This demonstrates one of the strengths of LilyPond -- you
635 can use a music definition more than once.  If you make any changes
636 to the vocal notes (say, tenorMusic), then the changes will also
637 apply to the piano reduction.
638
639 @lilypond[quote,verbatim,ragged-right]
640 \version "2.7.32"
641 global = {
642    \key c \major
643    \time 4/4
644 }
645
646 sopMusic = \relative c'' {
647    c4 c c8[( b)] c4
648 }
649 sopWords = \lyricmode {
650    hi hi hi hi
651 }
652
653 altoMusic = \relative c' {
654    e4 f d e
655 }
656 altoWords =\lyricmode {
657    ha ha ha ha
658 }
659
660 tenorMusic = \relative c' {
661    g4 a f g
662 }
663 tenorWords = \lyricmode {
664    hu hu hu hu
665 }
666
667 bassMusic = \relative c {
668    c4 c g c
669 }
670 bassWords = \lyricmode {
671    ho ho ho ho
672 }
673
674 \score {
675   <<
676     \new ChoirStaff <<
677       \new Lyrics = sopranos { s1 }
678       \new Staff = women <<
679         \new Voice =
680           "sopranos" { \voiceOne << \global \sopMusic >> }
681         \new Voice =
682           "altos" { \voiceTwo << \global \altoMusic >> }
683       >>
684       \new Lyrics = "altos" { s1 }
685       \new Lyrics = "tenors" { s1 }
686       \new Staff = men <<
687         \clef bass
688         \new Voice =
689           "tenors" { \voiceOne <<\global \tenorMusic >> }
690         \new Voice =
691           "basses" { \voiceTwo <<\global \bassMusic >> }
692       >>
693       \new Lyrics = basses { s1 }
694
695       \context Lyrics = sopranos \lyricsto sopranos \sopWords
696       \context Lyrics = altos \lyricsto altos \altoWords
697       \context Lyrics = tenors \lyricsto tenors \tenorWords
698       \context Lyrics = basses \lyricsto basses \bassWords
699     >>
700   \new PianoStaff <<
701     \new Staff <<
702       \set Staff.printPartCombineTexts = ##f
703       \partcombine
704       << \global \sopMusic >>
705       << \global \altoMusic >>
706     >>
707     \new Staff <<
708       \clef bass
709       \set Staff.printPartCombineTexts = ##f
710       \partcombine
711       << \global \tenorMusic >>
712       << \global \bassMusic >>
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 @section Ancient notation templates
730
731 @subsection 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.32"
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     \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
961 @node Jazz combo
962 @section Jazz combo
963
964 This is a much more complicated template, for a jazz ensemble.  Note that all
965 instruments are notated in @code{\key c \major}.  This refers to the key in
966 concert pitch; LilyPond will automatically transpose the key if the music
967 is within a @code{\transpose} section.
968
969 @c TODO must clean up this jazz combo example
970 @c   - transpositions stated in names (ie "trumpet in Bb" or whatever)
971 @c   - one global section, instead of "global" (time) and "key"
972 @c   - does it need those wierd macros?  sl, nsl, etc.
973 @c   - maybe ask Amelie Zapf to clean it up, or whether I should just
974 @c     make whatever changes I feel like.
975
976 @c FIXME: produces a warning ; key change merge.
977 @c The `line-width' argument is for the \header.
978
979 @lilypond[quote,verbatim,ragged-right,line-width]
980 \version "2.7.32"
981 \header {
982   title = "Song"
983   subtitle = "(tune)"
984   composer = "Me"
985   meter = "moderato"
986   piece = "Swing"
987   tagline = "LilyPond example file by Amelie Zapf,
988              Berlin 07/07/2003"
989   texidoc = "Jazz tune for combo
990              (horns, guitar, piano, bass, drums)."
991 }
992
993 #(set-global-staff-size 16)
994 \include "english.ly"
995
996 %%%%%%%%%%%% Some macros %%%%%%%%%%%%%%%%%%%
997
998 sl = {
999   \override NoteHead #'style = #'slash
1000   \override Stem #'transparent = ##t
1001 }
1002 nsl = {
1003   \revert NoteHead #'style
1004   \revert Stem #'transparent
1005 }
1006 cr = \override NoteHead #'style = #'cross
1007 ncr = \revert NoteHead #'style
1008
1009 %% insert chord name style stuff here.
1010
1011 jzchords = { }
1012
1013
1014 %%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%%
1015
1016 global = {
1017   \time 4/4
1018 }
1019
1020 Key = { \key c \major }
1021
1022 % ############ Horns ############
1023
1024 % ------ Trumpet ------
1025 trpt = \transpose c d \relative c'' {
1026   \Key
1027   c1 c c
1028 }
1029 trpharmony = \transpose c' d {
1030   \jzchords
1031 }
1032 trumpet = {
1033   \global
1034   \set Staff.instrument = #"Trumpet"
1035   \clef treble
1036   \new Staff <<
1037     \trpt
1038   >>
1039 }
1040
1041 % ------ Alto Saxophone ------
1042 alto = \transpose c a \relative c' {
1043   \Key
1044   c1 c c
1045 }
1046 altoharmony = \transpose c' a {
1047   \jzchords
1048 }
1049 altosax = {
1050   \global
1051   \set Staff.instrument = #"Alto Sax"
1052   \clef treble
1053   \new Staff <<
1054     \alto
1055   >>
1056 }
1057
1058 % ------ Baritone Saxophone ------
1059 bari = \transpose c a' \relative c {
1060   \Key
1061   c1 c \sl d4^"Solo" d d d \nsl
1062 }
1063 bariharmony = \transpose c' a \chordmode {
1064   \jzchords s1 s d2:maj e:m7
1065 }
1066 barisax = {
1067   \global
1068   \set Staff.instrument = #"Bari Sax"
1069   \clef treble
1070   \new Staff <<
1071     \bari
1072   >>
1073 }
1074
1075 % ------ Trombone ------
1076 tbone = \relative c {
1077   \Key
1078   c1 c c
1079 }
1080 tboneharmony = \chordmode {
1081   \jzchords
1082 }
1083 trombone = {
1084   \global
1085   \set Staff.instrument = #"Trombone"
1086   \clef bass
1087   \new Staff <<
1088     \tbone
1089   >>
1090 }
1091
1092 % ############ Rhythm Section #############
1093
1094 % ------ Guitar ------
1095 gtr = \relative c'' {
1096   \Key
1097   c1 \sl b4 b b b \nsl c1
1098 }
1099 gtrharmony = \chordmode {
1100   \jzchords
1101   s1 c2:min7+ d2:maj9
1102 }
1103 guitar = {
1104   \global
1105   \set Staff.instrument = #"Guitar"
1106   \clef treble
1107   \new Staff <<
1108     \gtr
1109   >>
1110 }
1111
1112 %% ------ Piano ------
1113 rhUpper = \relative c'' {
1114   \voiceOne
1115   \Key
1116   c1 c c
1117 }
1118 rhLower = \relative c' {
1119   \voiceTwo
1120   \Key
1121   e1 e e
1122 }
1123
1124 lhUpper = \relative c' {
1125   \voiceOne
1126   \Key
1127   g1 g g
1128 }
1129 lhLower = \relative c {
1130   \voiceTwo
1131   \Key
1132   c1 c c
1133 }
1134
1135 PianoRH = {
1136   \clef treble
1137   \global
1138   \set Staff.midiInstrument = "acoustic grand"
1139   \new Staff <<
1140     \new Voice = "one" \rhUpper
1141     \new Voice = "two" \rhLower
1142   >>
1143 }
1144 PianoLH = {
1145   \clef bass
1146   \global
1147   \set Staff.midiInstrument = "acoustic grand"
1148   \new Staff <<
1149     \new Voice = "one" \lhUpper
1150     \new Voice = "two" \lhLower
1151   >>
1152 }
1153
1154 piano = {
1155   \new PianoStaff <<
1156     \set PianoStaff.instrument = #"Piano"
1157     \new Staff = "upper" \PianoRH
1158     \new Staff = "lower" \PianoLH
1159   >>
1160 }
1161
1162 % ------ Bass Guitar ------
1163 Bass = \relative c {
1164   \Key
1165   c1 c c
1166 }
1167 bass = {
1168   \global
1169   \set Staff.instrument = #"Bass"
1170   \clef bass
1171   \new Staff <<
1172     \Bass
1173   >>
1174 }
1175
1176 % ------ Drums ------
1177 up = \drummode {
1178   hh4 <hh sn>4 hh <hh sn> hh <hh sn>4
1179   hh4 <hh sn>4
1180   hh4 <hh sn>4
1181   hh4 <hh sn>4
1182 }
1183
1184 down = \drummode {
1185   bd4 s bd s bd s bd s bd s bd s
1186 }
1187
1188 drumContents = {
1189   \global
1190   <<
1191     \set DrumStaff.instrument = #"Drums"
1192     \new DrumVoice { \voiceOne \up }
1193     \new DrumVoice { \voiceTwo \down }
1194   >>
1195 }
1196
1197 %%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%%
1198
1199 \score {
1200   <<
1201     \new StaffGroup = "horns" <<
1202       \new Staff = "trumpet" \trumpet
1203       \new Staff = "altosax" \altosax
1204       \new ChordNames = "barichords" \bariharmony
1205       \new Staff = "barisax" \barisax
1206       \new Staff = "trombone" \trombone
1207     >>
1208
1209     \new StaffGroup = "rhythm" <<
1210       \new ChordNames = "chords" \gtrharmony
1211       \new Staff = "guitar" \guitar
1212       \new PianoStaff = piano" \piano
1213       \new Staff = "bass" \bass
1214       \new DrumStaff { \drumContents }
1215     >>
1216   >>
1217
1218   \layout {
1219     \context { \RemoveEmptyStaffContext }
1220     \context {
1221       \Score
1222       \override BarNumber #'padding = #3
1223       \override RehearsalMark #'padding = #2
1224       skipBars = ##t
1225     }
1226   }
1227
1228   \midi { \tempo 4 = 75 }
1229 }
1230 @end lilypond
1231
1232 @node Other templates
1233 @section Other templates
1234 @subsection All headers
1235
1236 This template displays all available headers.  Some of them are only
1237 used in the Mutopia project; they don't affect the printed output at
1238 all.  They are used if you want the piece to be listed with different
1239 information in the Mutopia database than you wish to have printed on the
1240 music.  For example, Mutopia lists the composer of the famous D major
1241 violin concerto as TchaikovskyPI, whereas perhaps you wish to print
1242 "Petr Tchaikowski" on your music.
1243
1244 @ The `line-width' is for \header.
1245 @lilypond[quote,verbatim,ragged-right,line-width]
1246 \version "2.7.32"
1247 \header {
1248   dedication = "dedication"
1249   title = "Title"
1250   subtitle = "Subtitle"
1251   subsubtitle = "Subsubtitle"
1252   composer = "Composer (xxxx-yyyy)"
1253   opus = "Opus 0"
1254   piece = "Piece I"
1255   meter = "meter"
1256   instrument = "Instrument"
1257   arranger = "Arranger"
1258   poet = "Poet"
1259   texttranslator = "Translator"
1260   copyright = "public domain"
1261
1262   % These are headers used by the Mutopia Project
1263   % http://www.mutopiaproject.org/
1264   mutopiatitle = ""
1265   mutopiacomposer = ""
1266   mutopiapoet = ""
1267   mutopiainstrument = ""
1268   date = "composer's dates"
1269   source = "urtext "
1270   maintainer = "your name here"
1271   maintainerEmail = "your email here"
1272   maintainerWeb = "your home page"
1273   lastupdated = "2004/Aug/26"
1274 }
1275
1276 \score {
1277   { c'4 }
1278   \header {
1279     piece = "piece1"
1280     opus = "opus1"
1281   }
1282 }
1283
1284 \score {
1285   { c'4 }
1286   \header {
1287     piece = "piece2"
1288     opus = "opus2"
1289   }
1290 }
1291 @end lilypond
1292
1293 @subsection Gregorian template
1294
1295 This example demonstrates how to do modern transcriptions of Gregorian
1296 music.  Gregorian music has no measure, no stems; it uses only half and
1297 quarter notes, and two types of barlines, a short one indicating a rest,
1298 and a second one indicating a breath mark.
1299
1300 @lilypond[quote,verbatim,ragged-right]
1301 barOne = { \once \override Staff.BarLine #'bar-size = #2
1302   \bar "|" }
1303 barTwo = { \once \override Staff.BarLine #'extra-offset = #'(0 . 2)
1304   \once \override Staff.BarLine #'bar-size = #2
1305   \bar "|" }
1306 chant = \relative c' {
1307   \set Score.timing = ##f
1308   \override Staff.Stem #'transparent = ##t
1309
1310   f4 a2 \barTwo
1311   g4 a2 f2 \barOne
1312   g4( f) f( g) a2
1313 }
1314 \score {
1315   \chant
1316   \layout{ }
1317   \midi { \tempo 4=60 }
1318 }
1319 @end lilypond
1320
1321
1322 @node Lilypond-book templates
1323 @section Lilypond-book templates
1324
1325 These templates are for use with @code{lilypond-book}.  If you're not familiar
1326 with this program, please refer to @ref{LilyPond-book}.
1327
1328 @subsection LaTeX
1329
1330 You can include LilyPond fragments in a LaTeX document.
1331
1332 @example
1333 \documentclass[]@{article@}
1334
1335 \begin@{document@}
1336
1337 Normal LaTeX text.
1338
1339 \begin@{lilypond@}
1340 \relative c'' @{
1341 a4 b c d
1342 @}
1343 \end@{lilypond@}
1344
1345 More LaTeX text.
1346
1347 \begin@{lilypond@}
1348 \relative c'' @{
1349 d4 c b a
1350 @}
1351 \end@{lilypond@}
1352 \end@{document@}
1353 @end example
1354
1355 @subsection Texinfo
1356
1357 You can include LilyPond fragments in Texinfo; in fact, this entire manual
1358 is written in Texinfo.
1359
1360 @example
1361 \input texinfo
1362 @@node Top
1363
1364 Texinfo text
1365
1366 @@lilypond[verbatim,fragment,ragged-right]
1367 a4 b c d
1368 @@end lilypond
1369
1370 More Texinfo text
1371
1372 @@lilypond[verbatim,fragment,ragged-right]
1373 d4 c b a
1374 @@end lilypond
1375
1376 @@bye
1377 @end example