]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/examples.itely
The grand \paper -> \layout, \bookpaper -> \paper renaming.
[lilypond.git] / Documentation / user / examples.itely
1 @c Note: -*-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 * Suggestions for writing LilyPond files::
12 * Single staff::
13 * Piano templates::
14 * Small ensembles::
15 * Vocal ensembles::
16 * Ancient notation templates::
17 * Jazz combo::
18 * Other templates::
19 @end menu
20
21 @c TODO explain \score{} ?  Maybe add a note to the tutorial?
22
23 @node Suggestions for writing LilyPond files
24 @section Suggestions for writing LilyPond files
25
26 Now you're ready to begin writing bigger LilyPond files -- not just the
27 little examples in the tutorial, but whole pieces.  But how should you
28 go about doing it?
29
30 The best answer is ``however you want to do it''.  As long as LilyPond
31 can understand your files and produces the output that you want, it
32 doesn't matter what your files look like.  That said, sometimes we
33 make mistakes when writing files.  If LilyPond can't understand your
34 files, or produces output that you don't like, how do you fix the
35 problem?
36
37 Here are a few suggestions that can help you in avoiding or fixing
38 problems:
39
40 @itemize @bullet
41 @item Include @code{\version} numbers in every file.  Note that all
42 templates contain a @code{\version "2.3.16"} string.  We
43 highly recommend that you always include the @code{\version}, no matter
44 how small your file is.  Speaking from personal experience, it's
45 quite frustrating to try to remember which version of LilyPond you were
46 using a few years ago.  @code{convert-ly} requires you to declare
47 which version of LilyPond you used.
48
49 @item Include checks:  See @ref{Bar check} and @ref{Octave check}.  If you
50 include checks every so often, then if you make a mistake, you can pinpoint
51 it quicker.  How often is ``every so often''?  It depends on the complexity
52 of the music.  For very simple music, perhaps just once or twice.  For
53 very complex music, every bar.
54
55 @item One bar per line.  If there is anything complicated, either in the music
56 itself or in the output you desire, it's often good to write only one bar
57 per line.  Saving screen space by cramming eight bars per line just isn't
58 worth it if you have to `debug' your files.
59
60 @item Comment your files, with either bar numbers (every so often) or
61 references to musical themes (``second theme in violins'', ``fourth
62 variation'').  You may not need it when you're writing the piece for
63 the first time, but if you want to go back and change something two
64 or three years later, you won't know how your file is structured if you
65 don't comment the file.
66
67 @end itemize
68
69 @node Single staff
70 @section Single staff
71 @subsection Notes only
72
73 The first example gives you a staff with notes, suitable for a solo
74 instrument or a melodic fragment.  Cut and paste this into a file,
75 add notes, and you're finished!
76
77 @lilypond[verbatim,raggedright]
78
79 \version "2.3.16"
80 melody = \relative c' {
81    \clef treble
82    \key c \major
83    \time 4/4
84
85    a4 b c d
86 }
87
88 \score{
89    \new Staff \melody
90    \layout { }
91    \midi { \tempo 4=60 }
92 }
93
94 @end lilypond
95
96 @subsection Notes and lyrics
97
98 The next example demonstrates a simple melody with lyrics.  Cut and
99 paste, add notes, then words for the lyrics.  This example turns off
100 automatic beaming, which is common for vocal parts.  If you want to use
101 automatic beaming, you'll have to change or comment out the relevant
102 line.
103
104 @lilypond[verbatim,raggedright]
105
106 \version "2.3.16"
107 melody = \relative c' {
108    \clef treble
109    \key c \major
110    \time 4/4
111
112    a4 b c d
113 }
114
115 text = \lyricmode {
116    Aaa Bee Cee Dee
117 }
118
119 \score{
120    <<
121       \context Voice = one {
122          \autoBeamOff
123          \melody
124       }
125       \lyricsto "one" \new Lyrics \text
126    >>
127    \layout { }
128    \midi { \tempo 4=60 }
129 }
130
131 @end lilypond
132
133 @subsection Notes and chords
134
135 Want to prepare a lead sheet with a melody and chords?  Look no further!
136
137 @lilypond[verbatim,raggedright]
138
139 \version "2.3.16"
140 melody =  \relative c' {
141    \clef treble
142    \key c \major
143    \time 4/4
144
145    f4 e8[ c] d4 g |
146    a2 ~ a2 |
147 }
148
149 harmonies = \chordmode {
150    c4:m f:min7 g:maj c:aug d2:dim b:sus
151 }
152
153 \score {
154    <<
155       \context ChordNames {
156          \set chordChanges = ##t
157          \harmonies
158       }
159    \context Staff = one \melody
160    >>
161
162    \layout{ }
163    \midi  { \tempo 4=60}
164 }
165
166 @end lilypond
167
168 @subsection Notes, lyrics, and chords.
169
170 This template allows you to prepare a song with melody, words, and chords.
171
172 @lilypond[verbatim,raggedright]
173
174 \version "2.3.16"
175 melody =  \relative c' {
176    \clef treble
177    \key c \major
178    \time 4/4
179
180    a b c d
181 }
182
183 text = \lyricmode {
184    Aaa Bee Cee Dee
185 }
186
187 harmonies = \chordmode {
188    a2 c2
189 }
190
191 \score {
192    <<
193       \context ChordNames {
194          \set chordChanges = ##t
195          \harmonies
196       }
197    \context Voice = one {
198       \autoBeamOff
199       \melody
200    }
201    \lyricsto "one" \new Lyrics \text
202    >>
203    \layout { }
204    \midi  { \tempo 4=60}
205 }
206
207 @end lilypond
208
209 @node Piano templates
210 @section Piano templates
211 @subsection Solo piano
212
213 Here is a simple piano staff.
214
215 @lilypond[verbatim,raggedright]
216
217 \version "2.3.16"
218 upper = \relative c'' {
219    \clef treble
220    \key c \major
221    \time 4/4
222
223    a b c d
224 }
225
226 lower = \relative c {
227    \clef bass
228    \key c \major
229    \time 4/4
230
231    a2 c
232 }
233
234 \score {
235    \context PianoStaff <<
236       \set PianoStaff.instrument = "Piano  "
237       \context Staff = upper \upper
238       \context Staff = lower \lower
239    >>  
240    \layout { }  
241    \midi { \tempo 4=60 }  
242 }
243
244 @end lilypond
245
246 @subsection Piano and melody with lyrics
247
248 Here is a typical song format: one staff with the melody and lyrics, with
249 piano accompaniment underneath.
250
251 @lilypond[verbatim,raggedright]
252
253 \version "2.3.16"
254 melody =  \relative c'' {
255    \clef treble
256    \key c \major
257    \time 4/4
258
259    a b c d
260 }
261
262 text = \lyricmode {
263    Aaa Bee Cee Dee
264 }
265
266 upper = \relative c'' {
267    \clef treble
268    \key c \major
269    \time 4/4
270
271    a b c d
272 }
273
274 lower = \relative c {
275    \clef bass
276    \key c \major
277    \time 4/4
278
279    a2 c
280 }
281
282 \score {
283    <<
284       \context Voice = mel {
285           \autoBeamOff
286           \melody
287       }
288       \lyricsto mel \new Lyrics \text
289
290       \context PianoStaff <<
291          \context Staff = upper \upper
292          \context Staff = lower \lower
293       >>
294    >>
295    \layout {
296       \context { \RemoveEmptyStaffContext }
297    }  
298    \midi { \tempo 4=60}
299 }
300
301 @end lilypond
302
303
304 @subsection Piano centered dynamics
305
306 Many piano scores have the dynamics centered between the two
307 staffs.  This requires a bit of tweaking to implement, but
308 since the template is right here, you don't have to do the
309 tweaking yourself.
310
311 @lilypond[verbatim,raggedright]
312
313 \version "2.3.16"
314 upper = \relative c'' {
315   \clef treble
316   \key c \major
317   \time 4/4
318
319   a b c d
320 }
321
322 lower = \relative c {
323   \clef bass
324   \key c \major
325   \time 4/4
326
327   a2 c
328 }
329
330 dynamics =  {
331   s2\fff\> s4
332   s\!\pp
333 }
334
335 pedal =  {
336   s2\sustainDown s2\sustainUp
337 }
338
339 \score {
340   \context PianoStaff <<
341     \context Staff=upper \upper
342     \context Dynamics=dynamics \dynamics
343     \context Staff=lower <<
344       \clef bass
345       \lower
346     >>
347     \context Dynamics=pedal \pedal
348   >>
349   \layout {
350     \context {
351       \type "Engraver_group_engraver"
352       \name Dynamics
353       \alias Voice % So that \cresc works, for example.
354       \consists "Output_property_engraver"
355       
356       minimumVerticalExtent = #'(-1 . 1)
357       pedalSustainStrings = #'("Ped." "*Ped." "*")
358       pedalUnaCordaStrings = #'("una corda" "" "tre corde")
359       
360       \consists "Piano_pedal_engraver"
361       \consists "Script_engraver"
362       \consists "Dynamic_engraver"
363       \consists "Text_engraver"
364
365       \override TextScript #'font-size = #2
366       \override TextScript #'font-shape = #'italic
367       \override DynamicText #'extra-offset = #'(0 . 2.5)
368       \override Hairpin #'extra-offset = #'(0 . 2.5)
369
370       \consists "Skip_event_swallow_translator"
371
372       \consists "Axis_group_engraver"
373     }
374     \context {
375       \PianoStaff
376       \accepts Dynamics
377       \override VerticalAlignment #'forced-distance = #7
378     }
379   }
380   \midi {
381     \context {
382       \type "Performer_group_performer"
383       \name Dynamics
384       \consists "Piano_pedal_performer"
385       \consists "Span_dynamic_performer"
386       \consists "Dynamic_performer"
387     }
388     \context {
389       \PianoStaff
390       \accepts Dynamics
391     }
392   }
393 }
394 @end lilypond
395
396
397 @node Small ensembles
398 @section Small ensembles
399 @subsection String quartet
400
401 This template demonstrates a string quartet.  It also uses a @code{\global}
402 section for time and key signatures.
403
404 @lilypond[verbatim,raggedright]
405
406 \version "2.3.16"
407 global = {
408    \time 4/4
409    \key c \major
410 }
411 violinOne = \relative c''{
412    \set Staff.instrument = "Violin 1  "
413    c2 d
414    e1
415 }
416 violinTwo = \relative c''{
417    \set Staff.instrument = "Violin 2  "
418    g2 g
419    g1
420 }
421 viola = \relative c'{
422    \set Staff.instrument = "Viola  "
423    \clef alto
424    e2 d
425    c1
426 }
427 cello = \relative c'{
428    \set Staff.instrument = "Cello  "
429    \clef bass
430    c2 g
431    c,1
432 }
433 \score {
434    \new StaffGroup <<
435       \new Staff << \global \violinOne >>
436       \new Staff << \global \violinTwo >>
437       \new Staff << \global \viola >>
438       \new Staff << \global \cello >>
439    >>
440    \layout { }
441    \midi { \tempo 4=60}
442 }
443
444 @end lilypond
445
446
447 @node Vocal ensembles
448 @section Vocal ensembles
449
450 @subsection SATB vocal score
451
452 Here is a standard four-part SATB vocal score.  With larger ensembles,
453 it's often useful to include a section which is included in all
454 parts.  For example, the time signature and key signatures are almost
455 always the same for all parts.
456
457 @lilypond[verbatim,raggedright]
458
459 \version "2.3.16"
460 global = {
461    \key c \major
462    \time 4/4
463 }
464
465 sopMusic = \relative c'' {
466    c4 c c8[( b)] c4
467 }
468 sopWords = \lyricmode {
469    hi hi hi hi
470 }
471
472 altoMusic = \relative c' {
473    e4 f d e 
474 }
475 altoWords =\lyricmode {
476    ha ha ha ha
477 }
478
479 tenorMusic = \relative c' {
480    g4 a f g
481 }
482 tenorWords = \lyricmode {
483    hu hu hu hu
484 }
485
486 bassMusic = \relative c {
487    c4 c g c
488 }
489 bassWords = \lyricmode {
490    ho ho ho ho
491 }
492
493 \score { 
494    \context ChoirStaff <<
495       \context Lyrics = sopranos { s1 }
496       \context Staff = women <<
497          \context Voice = sopranos { \voiceOne << \global \sopMusic >> }
498          \context Voice = altos { \voiceTwo << \global \altoMusic >> }
499       >>
500       \context Lyrics = altos { s1 }
501       \context Lyrics = tenors { s1 }
502       \context Staff = men <<
503          \clef bass
504          \context Voice = tenors { \voiceOne <<\global \tenorMusic >> }
505          \context Voice = basses { \voiceTwo <<\global \bassMusic >> }
506       >>
507       \context Lyrics = basses { s1 }
508       \context Lyrics = sopranos \lyricsto sopranos \sopWords
509       \context Lyrics = altos \lyricsto altos \altoWords
510       \context Lyrics = tenors \lyricsto tenors \tenorWords
511       \context Lyrics = basses \lyricsto basses \bassWords
512    >>
513
514    \layout {
515       \context {
516          % a little smaller so lyrics can be closer to the staff. 
517          \Staff minimumVerticalExtent = #'(-3 . 3) 
518       }
519    }
520 }
521
522 @end lilypond
523
524
525 @c  bad node name to avoid node name confict
526 @node Ancient notation templates
527 @section Ancient notation templates
528
529 @subsection Transcription of mensural music
530
531 When transcribing mensural music, an incipit at the beginning of the
532 piece is useful to indicate the original key and tempo.  While today
533 musicians are used to bar lines in order to faster recognize rhythmic
534 patterns, bar lines where not yet invented during the period of
535 mensural music; in fact, the meter often changed after every few
536 notes.  As a compromise, bar lines are often printed between the
537 staves rather than on the staves.
538
539 @lilypond[verbatim,raggedright]
540
541 \version "2.3.16"
542
543 global = {
544     % incipit
545     \once \override Score.SystemStartBracket #'transparent = ##t
546     \key f \major
547     \time 2/2
548     \once \override Staff.TimeSignature #'style = #'neomensural
549     \override Voice.NoteHead #'style = #'neomensural
550     \override Voice.Rest #'style = #'neomensural
551     \set Staff.printKeyCancellation = ##f
552     \cadenzaOn % turn off bar lines
553     \skip 1*10
554     \once \override Staff.BarLine #'transparent = ##f
555     \bar "||"
556     \skip 1*1 % need this extra \skip such that clef change comes
557               % after bar line
558     \bar ""
559
560     % main
561     \cadenzaOff % turn bar lines on again
562     \once \override Staff.Clef #'full-size-change = ##t
563     \set Staff.forceClef = ##t
564     \key g \major
565     \time 4/4
566     \override Voice.NoteHead #'style = #'default
567     \override Voice.Rest #'style = #'default
568
569     % FIXME: setting printKeyCancellation back to #t must not
570     % occur in the first bar after the incipit.  Dto. for forceClef.
571     % Therefore, we need an extra \skip.
572     \skip 1*1
573     \set Staff.printKeyCancellation = ##t
574     \set Staff.forceClef = ##f
575
576     \skip 1*5
577
578     % last bar contains a brevis (i.e. spans 2 bars);
579     % therefore do not draw this particular bar
580     \cadenzaOn
581     \skip 1*2
582     \cadenzaOff
583
584     % let finis bar go through all staves
585     \override Staff.BarLine #'transparent = ##f
586
587     % finis bar
588     \bar "|."
589 }
590
591 discantusNotes = {
592     \transpose c' c'' {
593         \set Staff.instrument = "Discantus  "
594
595         % incipit
596         \clef "neomensural-c1"
597         c'1. s2   % two bars
598         \skip 1*8 % eight bars
599         \skip 1*1 % one bar
600
601         % main
602         \clef "treble"
603         d'2. d'4 |
604         b e' d'2 |
605         c'4 e'4.( d'8 c' b |
606         a4) b a2 |
607         b4.( c'8 d'4) c'4 |
608         \once \override NoteHead #'transparent = ##t c'1 |
609         b\breve |
610     }
611 }
612
613 discantusLyrics = \lyricmode {
614     % incipit
615     IV-
616
617     % main
618     Ju -- bi -- |
619     la -- te De -- |
620     o, om --
621     nis ter -- |
622     ra, __ om- |
623     "..." |
624     -us. |
625 }
626
627 altusNotes = {
628     \transpose c' c'' {
629         \set Staff.instrument = "Altus  "
630
631         % incipit
632         \clef "neomensural-c3"
633         r1        % one bar
634         f1. s2    % two bars
635         \skip 1*7 % seven bars
636         \skip 1*1 % one bar
637
638         % main
639         \clef "treble"
640         r2 g2. e4 fis g | % two bars
641         a2 g4 e |
642         fis g4.( fis16 e fis4) |
643         g1 |
644         \once \override NoteHead #'transparent = ##t g1 |
645         g\breve |
646     }
647 }
648
649 altusLyrics = \lyricmode {
650     % incipit
651     IV-
652
653     % main
654     Ju -- bi -- la -- te | % two bars
655     De -- o, om -- |
656     nis ter -- ra, |
657     "..." |
658     -us. |
659 }
660
661 tenorNotes = {
662     \transpose c' c' {
663         \set Staff.instrument = "Tenor  "
664
665         % incipit
666         \clef "neomensural-c4"
667         r\longa   % four bars
668         r\breve   % two bars
669         r1        % one bar
670         c'1. s2   % two bars
671         \skip 1*1 % one bar
672         \skip 1*1 % one bar
673
674         % main
675         \clef "treble_8"
676         R1 |
677         R1 |
678         R1 |
679         r2 d'2. d'4 b e' | % two bars
680         \once \override NoteHead #'transparent = ##t e'1 |
681         d'\breve |
682     }
683 }
684
685 tenorLyrics = \lyricmode {
686     % incipit
687     IV-
688
689     % main
690     Ju -- bi -- la -- te | % two bars
691     "..." |
692     -us. |
693 }
694
695 bassusNotes = {
696     \transpose c' c' {
697         \set Staff.instrument = "Bassus  "
698
699         % incipit
700         \clef "bass"
701         r\maxima  % eight bars
702         f1. s2    % two bars
703         \skip 1*1 % one bar
704
705         % main
706         \clef "bass"
707         R1 |
708         R1 |
709         R1 |
710         R1 |
711         g2. e4 |
712         \once \override NoteHead #'transparent = ##t e1 |
713         g\breve |
714     }
715 }
716
717 bassusLyrics = \lyricmode {
718     % incipit
719     IV-
720
721     % main
722     Ju -- bi- |
723     "..." |
724     -us. |
725 }
726
727 \score {
728     \context StaffGroup = choirStaff <<
729         \context Voice = discantusNotes << \global \discantusNotes >>
730         \context Lyrics = discantusLyrics \lyricsto discantusNotes { \discantusLyrics }
731         \context Voice = altusNotes << \global \altusNotes >>
732         \context Lyrics = altusLyrics \lyricsto altusNotes { \altusLyrics }
733         \context Voice = tenorNotes << \global \tenorNotes >>
734         \context Lyrics = tenorLyrics \lyricsto tenorNotes { \tenorLyrics }
735         \context Voice = bassusNotes << \global \bassusNotes >>
736         \context Lyrics = bassusLyrics \lyricsto bassusNotes { \bassusLyrics }
737     >>
738     \layout {
739         \context {
740             \Score
741             \override BarLine #'transparent = ##t
742             \remove "System_start_delimiter_engraver"
743         }
744         \context {
745             \Voice
746             \override Slur #'transparent = ##t
747         }
748     }
749 }
750
751 @end lilypond
752
753
754
755 @node Jazz combo
756 @section Jazz combo
757
758 This is a much more complicated template, for a jazz ensemble.  Note that all
759 instruments are notated @code{\key c \major}.  This refers to the key in
760 concert pitch; LilyPond will automatically transpose the key if the music
761 is within a @code{\transpose} section.
762
763 @c TODO must clean up this jazz combo example
764 @c   - transpositions stated in names (ie "trumpet in Bb" or whatever)
765 @c   - one global section, instead of "global" (time) and "key"
766 @c   - does it need those wierd macros?  sl, nsl, etc.
767 @c   - maybe ask Amelie Zapf to clean it up, or whether I should just
768 @c     make whatever changes I feel like.
769
770 @c FIXME: produces a warning ; key change merge.
771
772 @lilypond[verbatim,raggedright]
773
774 \version "2.3.16"
775 \header {
776         title = "Song"
777         subtitle = "(tune)"
778         composer = "Me"
779         meter = "moderato"
780         piece = "Swing"
781         tagline = "LilyPond example file by Amelie Zapf, Berlin 07/07/2003"
782         texidoc = "Jazz tune for combo (horns, guitar, piano, bass, drums)."
783 }
784
785 #(set-global-staff-size 16)
786 \include "english.ly"
787
788 %%%%%%%%%%%% Some macros %%%%%%%%%%%%%%%%%%%
789
790 sl = {
791     \override NoteHead  #'style = #'slash
792     \override Stem  #'transparent = ##t
793 }
794 nsl = {
795     \revert NoteHead #'style
796     \revert Stem #'transparent
797 }
798 cr = \override NoteHead  #'style = #'cross
799 ncr = \revert NoteHead #'style
800
801 %% insert chord name style stuff here.
802
803 jzchords = { } 
804
805
806 %%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%%
807
808 global =  {
809     \time 4/4
810 }
811
812 Key =  { \key c \major }
813
814 % ############ Horns ############
815 % ------ Trumpet ------
816 trpt =  \transpose c d \relative c'' {
817     \Key
818     c1 c c
819 }
820
821 trpharmony = \transpose c' d { \jzchords }
822 trumpet = {
823     \global 
824     \set Staff.instrument = #"Trumpet"
825     \clef treble
826     \context Staff <<
827         \trpt
828     >>
829 }
830
831 % ------ Alto Saxophone ------
832 alto = \transpose c a \relative c' {
833         \Key
834         c1 c c
835 }
836
837 altoharmony = \transpose c' a { \jzchords }
838 altosax = {
839         \global
840         \set Staff.instrument = #"Alto Sax"
841         \clef treble
842         \context Staff <<
843                 \alto
844         >>
845 }
846
847 % ------ Baritone Saxophone ------
848 bari = \transpose c a' \relative c {
849         \Key
850         c1 c \sl d4^"Solo" d d d \nsl
851 }
852
853 bariharmony = \transpose c' a \chordmode { \jzchords s1 s d2:maj e:m7 }
854 barisax = {
855         \global
856         \set Staff.instrument = #"Bari Sax"
857         \clef treble
858         \context Staff <<
859                 \bari
860         >>
861 }
862 % ------ Trombone ------
863 tbone =  \relative c {
864         \Key
865         c1 c c
866 }
867
868 tboneharmony = \chordmode { \jzchords }
869 trombone = {
870         \global
871         \set Staff.instrument = #"Trombone"
872         \clef bass
873         \context Staff <<
874                 \tbone
875         >>
876 }
877 % ############ Rhythm Section #############
878 % ------ Guitar ------
879 gtr =  \relative c'' {
880         \Key
881         c1 \sl b4 b b b \nsl c1
882 }
883
884 gtrharmony = \chordmode { \jzchords
885         s1 c2:min7+ d2:maj9
886 }
887
888 guitar = {
889         \global
890         \set Staff.instrument = #"Guitar"
891         \clef treble
892         \context Staff <<
893                 \gtr
894         >>
895 }
896
897 %% ------ Piano ------
898 rhUpper =  \relative c'' {
899         \voiceOne
900         \Key
901         c1 c c
902 }
903
904 rhLower =  \relative c' {
905         \voiceTwo
906         \Key
907         e1 e e
908 }
909
910 lhUpper =  \relative c' {
911         \voiceOne
912         \Key
913         g1 g g
914 }
915
916 lhLower =  \relative c {
917         \voiceTwo
918         \Key
919         c1 c c
920 }
921
922 PianoRH = {
923         \clef treble
924         \global
925         \set Staff.midiInstrument = "acoustic grand"
926         \context Staff <<
927                 \context Voice = one \rhUpper
928                 \context Voice = two \rhLower
929         >>
930 }
931
932 PianoLH = {
933         \clef bass
934         \global
935         \set Staff.midiInstrument = "acoustic grand"
936         \context Staff <<
937                 \context Voice = one \lhUpper
938                 \context Voice = two \lhLower
939         >>
940 }
941
942 piano = {
943         \context PianoStaff <<
944                 \set PianoStaff.instrument = #"Piano"
945                 \context Staff = upper \PianoRH
946                 \context Staff = lower \PianoLH
947         >>
948 }
949
950 % ------ Bass Guitar ------
951 bass =  \relative c {
952         \Key
953         c1 c c
954 }
955
956 bass = {
957     \global
958     \set Staff.instrument = #"Bass"
959     \clef bass
960     \context Staff <<
961         \bass
962     >>
963 }
964
965                                 % ------ Drums ------
966
967 up = \drummode {
968     hh4 <hh sn>4 hh <hh sn> hh <hh sn>4
969     hh4 <hh sn>4
970     hh4 <hh sn>4
971     hh4 <hh sn>4
972 }
973
974 down = \drummode {
975     bd4 s bd s bd s bd s bd s bd s
976 }
977
978 drumContents = {
979         \global
980         <<
981                 \set DrumStaff.instrument = #"Drums"
982                 \new DrumVoice { \voiceOne \up }
983                 \new DrumVoice { \voiceTwo \down }
984         >>
985 }
986
987 %%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%%
988
989 \score {
990 <<
991         \context StaffGroup = horns <<
992                 \context Staff = trumpet \trumpet
993
994                 \context Staff = altosax \altosax
995
996                 \context ChordNames = barichords \bariharmony
997
998                 \context Staff = barisax \barisax
999
1000                 \context Staff = trombone \trombone
1001         >>
1002
1003         \context StaffGroup = rhythm <<
1004                 \context ChordNames = chords \gtrharmony
1005                 \context Staff = guitar \guitar
1006                 \context PianoStaff = piano \piano
1007                 
1008                 \context Staff = bass \bass
1009                 
1010                 \new DrumStaff { \drumContents }
1011         >>
1012 >>
1013         \layout {
1014                 \context { \RemoveEmptyStaffContext }
1015                 \context {
1016                         \Score
1017                         \override BarNumber #'padding = #3
1018                         \override RehearsalMark #'padding = #2
1019                         skipBars = ##t
1020                 }
1021         }
1022         \midi { \tempo 4 = 75 }
1023 }
1024
1025 @end lilypond
1026
1027 @node Other templates
1028 @section Other templates
1029 @subsection All headers
1030
1031 This template displays all available headers.  Some of them are only
1032 used in the Mutopia project; they don't affect the printed output at
1033 all.  They are used  if you want the piece to be listed with different
1034 information in the Mutopia database than you wish to have printed on the
1035 music.  For example, Mutopia lists the composer of the famous D major
1036 violin concerto as TchaikovskyPI, whereas perhaps you wish to print
1037 "Petr Tchaikowski" on your music.
1038
1039 @lilypond[verbatim,raggedright]
1040
1041 \version "2.3.16"
1042 \header {
1043    dedication = "dedication"
1044    title = "Title"
1045    subtitle = "Subtitle"
1046    subsubtitle = "Subsubtitle"
1047    composer = "Composer (xxxx-yyyy)"
1048    opus = "Opus 0"
1049    piece = "Piece I"
1050    instrument = "Instrument"
1051    arranger = "Arranger"
1052    poet = "Poet"
1053    texttranslator = "Translator"
1054    copyright = "public domain"
1055
1056 % These are headers used by the Mutopia Project  http://www.mutopiaproject.org/
1057    mutopiatitle = ""
1058    mutopiacomposer = ""
1059    mutopiapoet = ""
1060    mutopiainstrument = ""
1061    date = "composer's dates"
1062    source = "urtext "
1063    maintainer = "your name here"
1064    maintainerEmail = "your email here"
1065    maintainerWeb = "your home page"
1066    lastupdated = "2004/Aug/26"
1067 }
1068
1069 \score {
1070    \header {
1071       piece = "piece1"
1072       opus = "opus1"
1073    }
1074    { c'4 }
1075 }
1076
1077 \score {
1078    \header {
1079       piece = "piece2"
1080       opus = "opus2"
1081    }
1082    { c'4 }
1083 }
1084
1085 @end lilypond
1086
1087 @subsection Gregorian template
1088
1089 This example demonstrates how to do modern transcriptions of Gregorian
1090 music.  Gregorian music has no measure, no stems; it uses only half and
1091 quarter notes, and two types of barlines, a short one indicating a rest,
1092 and a second one indicating a breath mark.
1093
1094 @lilypond[verbatim,raggedright]
1095
1096 barOne = { \once \override Staff.BarLine  #'bar-size = #2
1097    \bar "|" }
1098 barTwo = { \once \override Staff.BarLine  #'extra-offset = #'(0 . 2)
1099    \once \override Staff.BarLine  #'bar-size = #2
1100    \bar "|" }
1101 chant = \relative c' {
1102    \set Score.timing = ##f
1103    \override Staff.Stem  #'transparent = ##t
1104
1105    f4 a2 \barTwo
1106    g4 a2 f2 \barOne
1107    g4( f) f( g) a2
1108 }
1109 \score {
1110    \chant
1111    \layout{ }
1112    \midi { \tempo 4=60 }
1113 }
1114
1115 @end lilypond
1116
1117 @subsection Bagpipe music
1118
1119 Here is an example of bagpipe music.  It demonstrates a big strength of
1120 LilyPond, compared to graphical score editors: in LilyPond, you can
1121 very easily reuse small segments of music without writing them out
1122 completely.  This template defines a large number of small segments
1123 (@code{taor, grip, thrd,} etc), which can be reused easily.
1124
1125 TODO - replace Bagpipe template with Andrew McNabb's work?
1126
1127 @lilypond[verbatim,raggedright]
1128
1129 taor = { \grace { g32[ d' g e'] } }
1130 grip = { \grace { g32[ b g ]    } }
1131 thrd = { \grace { g32[ d' c']   } }
1132 birl = { \grace { g32[ a g]     } }
1133 gstd = { \grace { g'32[ d' g]   } }
1134 fgg =  { \grace { f32[ g'32]    } }
1135 dblb = { \grace { g'32[ b d']   } }
1136 dblc = { \grace { g'32[ c' d']  } }
1137 dble = { \grace { g'32[ e' f']  } }
1138 dblf = { \grace { g'32[ f' g']  } }
1139 dblg = { \grace { g'32[ f']     } }
1140 dbla = { \grace { a'32[ g']     } }
1141 lgg =  { \grace { g32  } }
1142 lag =  { \grace { a32  } }
1143 cg   = { \grace { c'32 } }
1144 eg   = { \grace { e'32 } }
1145 gg   = { \grace { g'32 } }
1146 dg   = { \grace { d'32 } }
1147 hag  = { \grace { a'32 } }
1148 gefg = { \grace { g'32[ e' f']  } }
1149 efg  = { \grace { e'32[ f']     } }
1150 gdcg = { \grace { g'32[ d' c']  } }
1151 gcdg = { \grace { g'32[ c' d']  } }
1152         
1153 \transpose a a' {
1154     #(add-grace-property 'Voice 'Stem 'length 6)
1155     \time 6/8 \partial 4
1156     \tieUp
1157     \slurUp
1158     
1159     f'4 |
1160     \gg f'4 e'8 \thrd d'4. |
1161     \eg a4.(a4) d'8 |
1162     \gg d'4 f'8 \dble e'4. ( | \noBreak
1163     e'8) d'4 \gg d'4 e'8 |
1164
1165     \break
1166     \time 9/8
1167     \dblf f'2.( f'4) d'8 |
1168     \time 6/8
1169     \dblg g'4 a'8 \gg a'4. |
1170     \thrd d'4.( d'4) \eg a8 |
1171     \time 9/8
1172     \dble e'4 \lag e'8 \gg  e'16[ d'8. e'8] \gg f'4 g'8 |
1173
1174     \break
1175     \time 6/8
1176     \gg f'4 e'8 \thrd d'4. |
1177     \eg a4.( a4) d'8 |
1178     \dblg g'4 a'8 \gg a'4. |
1179     \thrd d'4.( d'4) f'8 |
1180
1181     \break
1182     \dblg g'4 e'8( e'8) \dblf  f'8.[ e'16] |
1183     \thrd d'4.( d'4) \cg d'8 |
1184     \gg c'4 e'8 \thrd d'4.( |
1185     d'4.) \gdcg d'4.
1186     
1187 }
1188
1189 @end lilypond
1190
1191