]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/new/string-quartet-template-with-separate-parts.ly
Snippets: Replace \set Staff.instrumentName
[lilypond.git] / Documentation / snippets / new / string-quartet-template-with-separate-parts.ly
1 \version "2.19.56"
2
3 \header {
4   lsrtags = "preparing-parts, template, unfretted-strings"
5
6   texidoc = "
7 The @qq{String quartet template} snippet produces a nice string
8 quartet, but what if you needed to print parts? This new template
9 demonstrates how to use the @code{\\tag} feature to easily split a
10 piece into individual parts.
11
12 You need to split this template into separate files; the filenames are
13 contained in comments at the beginning of each file. @code{piece.ly}
14 contains all the music definitions. The other files – @code{score.ly},
15 @code{vn1.ly}, @code{vn2.ly}, @code{vla.ly}, and @code{vlc.ly} –
16 produce the appropriate part.
17
18
19 Do not forget to remove specified comments when using separate files!
20
21 "
22   doctitle = "String quartet template with separate parts"
23 } % begin verbatim
24
25 %%%%% piece.ly
26 %%%%% (This is the global definitions file)
27
28 global= {
29   \time 4/4
30   \key c \major
31 }
32
33
34 Violinone = \new Voice {
35   \relative c'' {
36     c2 d e1
37     \bar "|."
38   }
39 }
40
41
42 Violintwo = \new Voice {
43   \relative c'' {
44     g2 f e1
45     \bar "|."
46   }
47 }
48
49
50 Viola = \new Voice {
51   \relative c' {
52     \clef alto
53     e2 d c1
54     \bar "|."
55   }
56 }
57
58
59 Cello = \new Voice {
60   \relative c' {
61     \clef bass
62     c2 b a1
63     \bar "|."
64   }
65 }
66
67
68 music = {
69   <<
70     \tag #'score \tag #'vn1
71     \new Staff \with { instrumentName = "Violin 1" }
72     << \global \Violinone >>
73
74     \tag #'score \tag #'vn2
75     \new Staff \with { instrumentName = "Violin 2" }
76     << \global \Violintwo>>
77
78     \tag #'score \tag #'vla
79     \new Staff \with { instrumentName = "Viola" }
80     << \global \Viola>>
81
82     \tag #'score \tag #'vlc
83     \new Staff \with { instrumentName = "Cello" }
84     << \global \Cello >>
85   >>
86 }
87
88 % These are the other files you need to save on your computer
89
90 % score.ly
91 % (This is the main file)
92
93 % uncomment the line below when using a separate file
94 %\include "piece.ly"
95
96 #(set-global-staff-size 14)
97
98 \score {
99   \new StaffGroup \keepWithTag #'score \music
100   \layout { }
101   \midi { }
102 }
103
104
105 %{ Uncomment this block when using separate files
106
107 % vn1.ly
108 % (This is the Violin 1 part file)
109
110 \include "piece.ly"
111 \score {
112   \keepWithTag #'vn1 \music
113   \layout { }
114 }
115
116
117 % vn2.ly
118 % (This is the Violin 2 part file)
119
120 \include "piece.ly"
121 \score {
122   \keepWithTag #'vn2 \music
123   \layout { }
124 }
125
126
127 % vla.ly
128 % (This is the Viola part file)
129
130 \include "piece.ly"
131 \score {
132   \keepWithTag #'vla \music
133   \layout { }
134 }
135
136
137 % vlc.ly
138 % (This is the Cello part file)
139
140 \include "piece.ly"
141 \score {
142   \keepWithTag #'vlc \music
143   \layout { }
144 }
145
146 %}