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