]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/new/incipit.ly
6e92390b2acd24fffe5ec45252ebc20248babf5e
[lilypond.git] / Documentation / snippets / new / incipit.ly
1 \version "2.13.36"
2
3 \header {
4   lsrtags = "staff-notation, ancient-notation"
5   texidoc = "
6 Incipits can be added using the instrument name grob, but keeping
7 separate the instrument name definition and the incipit definition.
8 "
9   doctitle = "Incipit"
10 }
11
12 incipit =
13 #(define-music-function (parser location incipit-music) (ly:music?)
14   #{
15     \once \override Staff.InstrumentName #'self-alignment-X = #RIGHT
16     \once \override Staff.InstrumentName #'self-alignment-Y = #UP
17     \once \override Staff.InstrumentName #'Y-offset =
18       #(lambda (grob)
19          (+ 4 (system-start-text::calc-y-offset grob)))
20     \once \override Staff.InstrumentName #'padding = #0.3
21     \once \override Staff.InstrumentName #'stencil =
22       #(lambda (grob)
23          (let* ((instrument-name (ly:grob-property grob 'long-text))
24                 (layout (ly:output-def-clone (ly:grob-layout grob)))
25                 (music (make-sequential-music
26                         (list (context-spec-music
27                                (make-sequential-music
28                                 (list (make-property-set
29                                        'instrumentName instrument-name)
30                                       (make-grob-property-set
31                                        'VerticalAxisGroup
32                                        'Y-extent '(-4 . 4))))
33                                'MensuralStaff)
34                               $incipit-music)))
35                 (score (ly:make-score music))
36                 (mm (ly:output-def-lookup layout 'mm))
37                 (indent (ly:output-def-lookup layout 'indent))
38                 (width (ly:output-def-lookup layout 'incipit-width))
39                 (incipit-width (if (number? width)
40                                    (* width mm)
41                                    (* indent 0.5))))
42
43            (ly:output-def-set-variable! layout 'indent (- indent
44                                                           incipit-width))
45            (ly:output-def-set-variable! layout 'line-width indent)
46            (ly:output-def-set-variable! layout 'ragged-right #f)
47            (ly:output-def-set-variable! layout 'ragged-last #f)
48            (ly:output-def-set-variable! layout 'system-count 1)
49            (ly:score-add-output-def! score layout)
50            (ly:grob-set-property! grob 'long-text
51                                   (markup #:score score))
52            (system-start-text::print grob)))
53   #})
54
55 %%%%%%%%%%%%%%%%%%%%%%%%%
56
57 global = {
58   \set Score.skipBars = ##t
59   \key g \major
60   \time 4/4
61
62   % the actual music
63   \skip 1*8
64
65   % let finis bar go through all staves
66   \override Staff.BarLine #'transparent = ##f
67
68   % finis bar
69   \bar "|."
70 }
71
72 discantusIncipit = <<
73   \new MensuralVoice = "discantusIncipit" <<
74     \repeat unfold 9 { s1 \noBreak }
75     {
76       \clef "neomensural-c1"
77       \key f \major
78       \time 2/2
79       c''1.
80     }
81   >>
82   \new Lyrics \lyricsto discantusIncipit { IV- }
83 >>
84
85 discantusNotes = {
86   \transpose c' c'' {
87     \clef "treble"
88     d'2. d'4 |
89     b e' d'2 |
90     c'4 e'4.( d'8 c' b |
91     a4) b a2 |
92     b4.( c'8 d'4) c'4 |
93     \once \override NoteHead #'transparent = ##t
94     c'1 |
95     b\breve |
96   }
97 }
98
99 discantusLyrics = \lyricmode {
100   Ju -- bi -- |
101   la -- te De -- |
102   o, om --
103   nis ter -- |
104   ra, __ om- |
105   "..." |
106   -us. |
107 }
108
109 altusIncipit = <<
110   \new MensuralVoice = "altusIncipit" <<
111     \repeat unfold 9 { s1 \noBreak }
112     {
113       \clef "neomensural-c3"
114       \key f \major
115       \time 2/2
116       r1 f'1.
117     }
118   >>
119   \new Lyrics \lyricsto altusIncipit { IV- }
120 >>
121
122 altusNotes = {
123   \transpose c' c'' {
124     \clef "treble"
125     % two measures
126     r2 g2. e4 fis g |
127     a2 g4 e |
128     fis g4.( fis16 e fis4) |
129     g1 |
130     \once \override NoteHead #'transparent = ##t
131     g1 |
132     g\breve |
133   }
134 }
135
136 altusLyrics = \lyricmode {
137   % two measures
138   Ju -- bi -- la -- te |
139   De -- o, om -- |
140   nis ter -- ra, |
141   "..." |
142   -us. |
143 }
144
145 tenorIncipit = <<
146   \new MensuralVoice = "tenorIncipit" <<
147     \repeat unfold 9 { s1 \noBreak }
148     {
149       \clef "neomensural-c4"
150       \key f \major
151       \time 2/2
152       r\longa
153       r\breve
154       r1 c'1.
155     }
156   >>
157   \new Lyrics \lyricsto tenorIncipit { IV- }
158 >>
159
160 tenorNotes = {
161   \transpose c' c' {
162     \clef "treble_8"
163     R1 |
164     R1 |
165     R1 |
166     % two measures
167     r2 d'2. d'4 b e' |
168     \once \override NoteHead #'transparent = ##t
169     e'1 |
170     d'\breve |
171   }
172 }
173
174 tenorLyrics = \lyricmode {
175   % two measures
176   Ju -- bi -- la -- te |
177   "..." |
178   -us.
179 }
180
181 bassusIncipit = <<
182   \new MensuralVoice = "bassusIncipit" <<
183     \repeat unfold 9 { s1 \noBreak }
184     {
185       \clef "bass"
186       \key f \major
187       \time 2/2
188       %% incipit
189       r\maxima
190       f1.
191     }
192   >>
193   \new Lyrics \lyricsto bassusIncipit { IV- }
194 >>
195
196 bassusNotes = {
197   \transpose c' c' {
198     \clef "bass"
199     R1 |
200     R1 |
201     R1 |
202     R1 |
203     g2. e4 |
204     \once \override NoteHead #'transparent = ##t
205     e1 |
206     g\breve |
207   }
208 }
209
210 bassusLyrics = \lyricmode {
211   Ju -- bi- |
212   "..." |
213   -us.
214 }
215
216 \score {
217   <<
218     \new StaffGroup = choirStaff <<
219       \new Voice = "discantusNotes" <<
220         \global
221         \set Staff.instrumentName = #"Discantus"
222         \incipit \discantusIncipit
223         \discantusNotes
224       >>
225       \new Lyrics = "discantusLyrics" \lyricsto discantusNotes { \discantusLyrics }
226       \new Voice = "altusNotes" <<
227         \global
228         \set Staff.instrumentName = #"Altus"
229         \incipit \altusIncipit
230         \altusNotes
231       >>
232       \new Lyrics = "altusLyrics" \lyricsto altusNotes { \altusLyrics }
233       \new Voice = "tenorNotes" <<
234         \global
235         \set Staff.instrumentName = #"Tenor"
236         \incipit \tenorIncipit
237         \tenorNotes
238       >>
239       \new Lyrics = "tenorLyrics" \lyricsto tenorNotes { \tenorLyrics }
240       \new Voice = "bassusNotes" <<
241         \global
242         \set Staff.instrumentName = #"Bassus"
243         \incipit \bassusIncipit
244         \bassusNotes
245       >>
246       \new Lyrics = "bassusLyrics" \lyricsto bassusNotes { \bassusLyrics }
247     >>
248   >>
249   \layout {
250     \context {
251       \Score
252       %% no bar lines in staves or lyrics
253       \override BarLine #'transparent = ##t
254     }
255     %% the next two instructions keep the lyrics between the bar lines
256     \context {
257       \Lyrics
258       \consists "Bar_engraver"
259       \consists "Separating_line_group_engraver"
260     }
261     \context {
262       \Voice
263       %% no slurs
264       \override Slur #'transparent = ##t
265       %% Comment in the below "\remove" command to allow line
266       %% breaking also at those bar lines where a note overlaps
267       %% into the next measure.  The command is commented out in this
268       %% short example score, but especially for large scores, you
269       %% will typically yield better line breaking and thus improve
270       %% overall spacing if you comment in the following command.
271       %%\remove "Forbid_line_break_engraver"
272     }
273     indent = 6\cm
274     incipit-width = 4\cm
275   }
276 }