]> git.donarmstrong.com Git - lilypond.git/blob - ly/satb.ly
Makelsr.py run
[lilypond.git] / ly / satb.ly
1 \version "2.18.0"
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 %%                                                %%
5 %%     Accompanied Choir with Multiple Verses     %%
6 %%                                                %%
7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8
9 %{
10   This file may be \include'd in a score to provide the
11   context structure for a score arrangement consisting
12   of the following staves:
13
14   Descant Staff
15   Soprano and Alto (optionally on two Staves or one Staff)
16   Multiple verses (up to 9)
17   Tenor and Bass (optionally on two Staves or one Staff)
18   Piano Staff
19
20   It is intended primarily to hide the complexity of the context
21   structure from newcomers to LilyPond, but is also useful as a
22   shorthand for seasoned users.
23
24   Usage:
25
26   satb.ly should be included at the *end* of the input file. Before
27   it are placed the required music and lyrics by redefining specific
28   variables, like this:
29
30   \paper { ... }
31   \header { ... }
32   Key = { ... }
33   Time = { ... }
34   DescantMusic = \relative { ... }
35   DescantLyrics = \lyricmode { ... }
36   SopranoMusic = \relative { ... }
37   SopranoLyrics = \lyricmode { ... }
38   AltoMusic = \relative { ... }
39   AltoLyrics = \lyricmode { ... }
40   VerseOne = \lyricmode { ... }
41   VerseTwo = \lyricmode { ... }
42   ...
43   VerseNine = \lyricmode { ... }
44   TenorMusic = \relative { ... }
45   TenorLyrics = \lyricmode { ... }
46   BassMusic = \relative { ... }
47   BassLyrics = \lyricmode { ... }
48   PianoRHMusic = \relative { ... }
49   PianoDynamics = { ... }
50   PianoLHMusic = \relative { ... }
51   TwoVoicesPerStaff = ##f
52   \include "satb.ly"
53
54   All of the definitions are optional. Staves with no music will be
55   omitted from the output.
56
57   Other variables, such as the instrumentName, can also be changed by
58   defining variables like AltoInstrumentName.  The key is defined in
59   the variable Key, and the structure of time and repeats in the
60   variable Time, using spacer rests.  A \layout block may be defined in
61   the variable Layout.  There is no default \header block and no default
62   \paper block.
63
64   Music may be tagged with #'print or #'play to be included only in
65   the printed score or in the MIDI file respectively.
66
67 %}
68
69 #(defmacro defaulting (name . default)
70   (if (defined? name) name (if (pair? default) (car default) '#{#})))
71
72 #(define (sym . strings) (string->symbol (apply string-append strings)))
73
74 #(defmacro short-name (part)
75   "Use PartShortInstrumentName, or the first letter of
76 PartInstrumentName or its default."
77   (if (defined? (sym part "Music"))
78     (let ((sname (sym part "ShortInstrumentName")))
79       (if (defined? sname)
80         sname
81         `(substring (defaulting ,(sym part "InstrumentName") ,part)
82                     0 1)))
83     ""))
84
85 #(defmacro lyrics-if-defined (name voice . optionals)
86   (let ((above (if (pair? optionals) (car optionals) #f)))
87     (if (defined? name)
88       `(make-music 'ContextSpeccedMusic
89          'create-new #t
90          'context-type 'Lyrics
91          'property-operations ',(if above `((assign alignAboveContext ,above)) '())
92          'element (make-music 'LyricCombineMusic
93                    'associated-context ,voice
94                    'element ,name))
95       #{#})))
96
97 #(defmacro one-voice-staff (name clef)
98   `#{ <<
99      \new Staff = #(identity ,name) \with {
100        instrumentName = \markup \smallCaps
101          #(defaulting ,(sym name "InstrumentName") ,name)
102        shortInstrumentName = \markup \smallCaps #(short-name ,name)
103        midiInstrument = "clarinet"
104      } {
105        #(defaulting Key)
106        \clef #(identity ,clef)
107        \new Voice = #(identity ,name) <<
108          #(defaulting Time)
109          \dynamicUp
110          #(defaulting ,(sym name "Music"))
111        >>
112      }
113      #(lyrics-if-defined ,(sym name "Lyrics") ,name)
114      #(lyrics-if-defined ,(sym name "LyricsOne") ,name)
115      #(lyrics-if-defined ,(sym name "LyricsTwo") ,name)
116      #(lyrics-if-defined ,(sym name "LyricsThree") ,name)
117    >> #})
118
119 #(defmacro two-voice-staff (name clef v1name v2name)
120   `#{ <<
121     \new Staff = #(identity ,name) \with {
122       instrumentName = \markup \right-column \smallCaps {
123         #(defaulting ,(sym v1name "InstrumentName") ,v1name)
124         #(defaulting ,(sym v2name "InstrumentName") ,v2name)
125       }
126       shortInstrumentName = \markup \right-column \smallCaps {
127         #(short-name ,v1name)
128         #(short-name ,v2name)
129       }
130       midiInstrument = "clarinet"
131     } <<
132       #(defaulting Key)
133       \clef #(identity ,clef)
134       \new Voice = #(identity ,v1name) <<
135         #(defaulting Time)
136         \voiceOne
137         \dynamicUp
138         #(defaulting ,(sym v1name "Music"))
139       >>
140       \new Voice = #(identity ,v2name) <<
141         #(defaulting Time)
142         \voiceTwo
143         #(defaulting ,(sym v2name "Music"))
144       >>
145     >>
146     #(lyrics-if-defined ,(sym v1name "Lyrics") ,v1name ,name)
147     #(lyrics-if-defined ,(sym v1name "LyricsOne") ,v1name ,name)
148     #(lyrics-if-defined ,(sym v1name "LyricsTwo") ,v1name ,name)
149     #(lyrics-if-defined ,(sym v1name "LyricsThree") ,v1name ,name)
150     #(lyrics-if-defined ,(sym v2name "Lyrics") ,v2name)
151     #(lyrics-if-defined ,(sym v2name "LyricsOne") ,v2name)
152     #(lyrics-if-defined ,(sym v2name "LyricsTwo") ,v2name)
153     #(lyrics-if-defined ,(sym v2name "LyricsThree") ,v2name)
154   >> #})
155
156 SATB = <<
157   \new ChoirStaff
158   \with {
159     \override VerticalAxisGroup.remove-empty = ##t
160     \override VerticalAxisGroup.remove-first = ##t
161   }
162   <<
163     #(one-voice-staff "Descant" "treble")
164
165     #(if (defaulting TwoVoicesPerStaff #f)
166       (two-voice-staff "Women" "treble" "Soprano" "Alto")
167       (make-simultaneous-music (list (one-voice-staff "Soprano" "treble")
168                                      (one-voice-staff "Alto" "treble"))))
169
170     #(lyrics-if-defined VerseOne "Soprano")
171     #(lyrics-if-defined VerseTwo "Soprano")
172     #(lyrics-if-defined VerseThree "Soprano")
173     #(lyrics-if-defined VerseFour "Soprano")
174     #(lyrics-if-defined VerseFive "Soprano")
175     #(lyrics-if-defined VerseSix "Soprano")
176     #(lyrics-if-defined VerseSeven "Soprano")
177     #(lyrics-if-defined VerseEight "Soprano")
178     #(lyrics-if-defined VerseNine "Soprano")
179
180     #(if (defaulting TwoVoicesPerStaff #f)
181       (two-voice-staff "Men" "bass" "Tenor" "Bass")
182       (make-simultaneous-music (list (one-voice-staff "Tenor" "treble_8")
183                                      (one-voice-staff "Bass" "bass"))))
184   >>  % End ChoirStaff
185
186   \new PianoStaff
187   \with {
188     instrumentName = \markup \smallCaps
189                        #(defaulting PianoInstrumentName "Piano" )
190     shortInstrumentName = \markup \smallCaps #(short-name "Piano" )
191     \override VerticalAxisGroup.remove-empty = ##t
192     \override VerticalAxisGroup.remove-first = ##t
193   }
194   <<
195     \new Staff {
196       \clef "treble"
197       #(defaulting Key)
198       \new Voice <<
199         #(defaulting Time)
200         #(defaulting PianoRHMusic)
201       >>
202     }
203     \new Dynamics {
204       #(defaulting PianoDynamics)
205     }
206     \new Staff {
207       \clef "bass"
208       #(defaulting Key)
209       \new Voice <<
210         #(defaulting Time)
211         #(defaulting PianoLHMusic)
212       >>
213     }
214   >>
215 >>
216
217 \score {
218   \keepWithTag #'print \SATB
219   \layout { #(defaulting Layout) }
220 }
221
222 \score {
223   \keepWithTag #'play \SATB
224   \midi { }
225 }
226