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