summaryrefslogtreecommitdiff
path: root/ly/ssaattbb.ly
blob: 9efd6c1bbe565b9da3a071eb607316be3dfd2b2f (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
\version "2.19.25"


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                %%
%%          Accompanied Divided Choir             %%
%%                                                %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%{
  This file may be \include'd in a score to provide the
  context structure for a score arrangement consisting
  of the following staves, although normally only a subset
  of these staves would be used in any one score.

  Solo Staff (outside Choir grouping)
  Descant Staff (within Choir grouping)
  Women Staff (single voice on one staff)
  First and Second Soprano (optionally on two Staves or one Staff)
  Soprano and Alto (optionally on two Staves or one Staff)
  First and Second Alto (optionally on two Staves or one Staff)
  First and Second Tenor (optionally on two Staves or one Staff)
  Tenor and Bass (optionally on two Staves or one Staff)
  First and Second Bass (optionally on two Staves or one Staff)
  Men Staff (single voice on one staff)
  Piano Staff

  It is intended primarily to hide the complexity of the context
  structure from newcomers to LilyPond, but is also useful as a
  shorthand for seasoned users.  It is intended to facilitate the
  setting of pieces in which different groupings of voices appear
  at different times.  All that is necessary is to populate the
  appropriate variables with music for the relevant sections and
  with rests elsewhere, with sections separated by line breaks.

  Usage:

  ssaattbb.ly should be included at the *end* of the input file. Before
  it are placed the required music and lyrics by redefining specific
  variables, like this:

  \paper { ... }
  \header { ... }
  Key = { ... }
  Time = { ... }
  SopranoOneMusic = \relative { ... }
  SopranoOneLyrics = \lyricmode { ... }
  SopranoTwoMusic = \relative { ... }
  SopranoTwoLyrics = \lyricmode { ... }
  AltoOneMusic = \relative { ... }
  AltoOneLyrics = \lyricmode { ... }
  AltoTwoMusic = \relative { ... }
  AltoTwoLyrics = \lyricmode { ... }
  TenorOneMusic = \relative { ... }
  TenorOneLyrics = \lyricmode { ... }
  TenorTwoMusic = \relative { ... }
  TenorTwoLyrics = \lyricmode { ... }
  BassOneMusic = \relative { ... }
  BassOneLyrics = \lyricmode { ... }
  BassTwoMusic = \relative { ... }
  BassTwoLyrics = \lyricmode { ... }
  PianoRHMusic = \relative { ... }
  PianoDynamics = { ... }
  PianoLHMusic = \relative { ... }
  TwoVoicesPerStaff = ##f (applies to all staves)
  \include "ssaattbb.ly"

  In addition, if there are sections in which two or more parts
  are in unison, the following variables may also be defined:

  WomenMusic = \relative { ... }
  WomenLyrics = \lyricmode { ... }
  SopranoMusic = \relative { ... }
  SopranoLyrics = \lyricmode { ... }
  AltoMusic = \relative { ... }
  AltoLyrics = \lyricmode { ... }
  TenorMusic = \relative { ... }
  TenorLyrics = \lyricmode { ... }
  BassMusic = \relative { ... }
  BassLyrics = \lyricmode { ... }
  MenMusic = \relative { ... }
  MenLyrics = \lyricmode { ... }

  All of the definitions are optional. Staves with no music will be
  omitted from the output.

  If TwoVoicesPerStaff is #f, music of the various voices may be
  placed individually on one or two staves according to the
  following variables, all of which default to #f:

  WomenTwoVoicesPerStaff
  SopranoTwoVoicesPerStaff
  AltoTwoVoicesPerStaff
  TenorTwoVoicesPerStaff
  BassTwoVoicesPerStaff
  MenTwoVoicesPerStaff

  Other variables, such as the instrumentName, shortInstrumentName
  and MidiInstrument can also be changed by defining variables like
  AltoInstrumentName, BassMidiInstrument, etc.  The prefixes for staves
  containing two divided voices are WomenDivided and MenDivided, etc
  hence the corresponding variables would be WomenDividedInstrumentName,
  etc.

  The key is defined in the variable Key, and the structure of time
  and repeats in the variable Time, using spacer rests.

  A \layout block may be defined in the variable Layout.  There is
  no default \header block and no default \paper block.

  Music may be tagged with #'print or #'play to be included only in
  the printed score or in the MIDI file respectively.

%}

\include "vocal-tkit.ly"
\include "piano-tkit.ly"

#(define ssaattbb-voice-prefixes
   ;; These define the permitted prefixes to various names.
   ;; They are combined with a fixed set of postfixes to form
   ;; names such as AltoMusic, BassInstrumentName, etc.
   ;; These names may be redefined.
   '("Alto"
     "AltoOne"
     "AltoTwo"
     "AltoDivided"
     "Bass"
     "BassOne"
     "BassTwo"
     "BassDivided"
     "Descant"
     "Men"
     "MenDivided"
     "Piano"
     "PianoLH"
     "PianoRH"
     "Solo"
     "Soprano"
     "SopranoOne"
     "SopranoTwo"
     "SopranoDivided"
     "Tenor"
     "TenorOne"
     "TenorTwo"
     "TenorDivided"
     "Women"
     "WomenDivided"))

#(define ssaattbb-lyrics-postfixes
   ;; These define the permitted postfixes to the names of lyrics.
   ;; They are combined with the prefixes to form names like
   ;; AltoLyrics, etc.
   ;; These names may be redefined or extended.
  '("Lyrics"
    "LyricsOne"
    "LyricsTwo"
    "LyricsThree"
    "LyricsFour"))

#(define ssaattbb-lyrics-variable-names
   ;; These define the names which may be used to specify stanzas
   ;; which go between the two two-voice staves when TwoVoicesPerStaff
   ;; is set to #t.  They may be redefined or extended.
  '("VerseOne"
    "VerseTwo"
    "VerseThree"
    "VerseFour"
    "VerseFive"
    "VerseSix"
    "VerseSeven"
    "VerseEight"
    "VerseNine"))

%% make the above definitions available
#(set-music-definitions!
  ssaattbb-voice-prefixes
  ssaattbb-lyrics-postfixes
  ssaattbb-lyrics-variable-names)

#(define ssaattbb-variable-names
; Define names which are in addition to the base variable names
; of Time, Layout, Key, PianoDynamics and TwoVoicesPerStaff
   '("AltoTwoVoicesPerStaff"
     "BassTwoVoicesPerStaff"
     "MenTwoVoicesPerStaff"
     "SopranoTwoVoicesPerStaff"
     "TenorTwoVoicesPerStaff"
     "WomenTwoVoicesPerStaff"))

%% and make them available
#(define-missing-variables! ssaattbb-variable-names)

#(if TwoVoicesPerStaff
 ; Set all staves to contain two voices
     (begin
      (set! AltoTwoVoicesPerStaff #t)
      (set! BassTwoVoicesPerStaff #t)
      (set! MenTwoVoicesPerStaff #t)
      (set! SopranoTwoVoicesPerStaff #t)
      (set! TenorTwoVoicesPerStaff #t)
      (set! WomenTwoVoicesPerStaff #t)))

#(define (set-default-instr-names! voice)
; If the several instrument names and short instrument
; names have not been defined by the user, set them to
; the defaults "Soprano 1" and "S 1" etc with the same names
; in a column for the divided staves"
   (define (make-sym str1 str2)
     (string->symbol (string-append str1 str2)))

   (if (not (make-id voice "OneInstrumentName"))
       (ly:parser-define!
         (make-sym voice "OneInstrumentName")
          (string-append voice " 1")))
   (if (not (make-id voice "TwoInstrumentName"))
       (ly:parser-define!
         (make-sym voice "TwoInstrumentName")
          (string-append voice " 2")))
   (if (not (make-id voice "DividedInstrumentName"))
       (ly:parser-define!
         (make-sym voice "DividedInstrumentName")
         #{ \markup \right-column \smallCaps {
           #(if (make-id voice "OneMusic")
                  (make-id voice "OneInstrumentName") "")
           #(if (make-id voice "TwoMusic")
                (make-id voice "TwoInstrumentName") "") } #} ))
   (if (not (make-id voice "OneShortInstrumentName"))
       (ly:parser-define!
         (make-sym voice "OneShortInstrumentName")
         (string-append (substring voice 0 1) " 1")))
   (if (not (make-id voice "TwoShortInstrumentName"))
       (ly:parser-define!
         (make-sym voice "TwoShortInstrumentName")
         (string-append (substring voice 0 1) " 2")))
   (if (not (make-id voice "DividedShortInstrumentName"))
       (ly:parser-define!
         (make-sym voice "DividedShortInstrumentName")
         #{ \markup \right-column \smallCaps {
           #(if (make-id voice "OneMusic")
                (make-id voice "OneShortInstrumentName") "")
           #(if (make-id voice "TwoMusic")
                (make-id voice "TwoShortInstrumentName") "") } #} )))

#(set-default-instr-names! "Soprano")
#(set-default-instr-names! "Alto")
#(set-default-instr-names! "Tenor")
#(set-default-instr-names! "Bass")

SSAATTBB =
<<
  \make-one-voice-vocal-staff "Solo" "treble"
  \new ChoirStaff
  <<
    \make-one-voice-vocal-staff "Descant" "treble"
    \make-one-voice-vocal-staff "Women" "treble"
    #(if SopranoTwoVoicesPerStaff
         #{ \make-two-voice-vocal-staff "SopranoDivided" "treble" "SopranoOne" "SopranoTwo" #}
         #{ << \make-one-voice-vocal-staff "SopranoOne" "treble"
               \make-one-voice-vocal-staff "SopranoTwo" "treble" >> #} )
    #(if WomenTwoVoicesPerStaff
         #{ \make-two-voice-vocal-staff "WomenDivided" "treble" "Soprano" "Alto" #}
         #{ << \make-one-voice-vocal-staff "Soprano" "treble"
               \make-one-voice-vocal-staff "Alto" "treble" >> #} )
    #(if AltoTwoVoicesPerStaff
         #{ \make-two-voice-vocal-staff "AltoDivided" "treble" "AltoOne" "AltoTwo" #}
         #{ << \make-one-voice-vocal-staff "AltoOne" "treble"
               \make-one-voice-vocal-staff "AltoTwo" "treble" >> #} )
    #(if TenorTwoVoicesPerStaff
         #{ \make-two-voice-vocal-staff "TenorDivided" "treble_8" "TenorOne" "TenorTwo" #}
         #{ << \make-one-voice-vocal-staff "TenorOne" "treble_8"
               \make-one-voice-vocal-staff "TenorTwo" "treble_8" >> #} )
    #(if MenTwoVoicesPerStaff
         #{ \make-two-voice-vocal-staff "MenDivided" "bass" "Tenor" "Bass" #}
         #{ << \make-one-voice-vocal-staff "Tenor" "treble_8"
               \make-one-voice-vocal-staff "Bass" "bass" >> #} )
    #(if BassTwoVoicesPerStaff
         #{ \make-two-voice-vocal-staff "BassDivided" "bass" "BassOne" "BassTwo" #}
         #{ << \make-one-voice-vocal-staff "BassOne" "bass"
               \make-one-voice-vocal-staff "BassTwo" "bass" >> #} )
    \make-one-voice-vocal-staff "Men" "bass"
  >>
>>

Piano = \make-pianostaff

\tagGroup #'(print play)

\layout {
  \context {
    \Staff
    \override VerticalAxisGroup.remove-empty = ##t
    \override VerticalAxisGroup.remove-first = ##t
  }
}

\score {
  \keepWithTag #'print
  #(if have-music
       #{ << \SSAATTBB \Piano >> #}
       #{ { } #} )
  \layout { $(if Layout Layout) }
}


\score {
  \keepWithTag #'play
  #(if have-music
       #{ << \SSAATTBB \Piano >> #}
       #{ { } #} )
  \midi {
    \context {
      \Score
      midiChannelMapping = #'instrument
    }
  }
}