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