]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/new/incipit.ly
New instrument name positioning in scheme.
[lilypond.git] / Documentation / snippets / new / incipit.ly
1 \version "2.13.4"
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-property-set
28                                 'instrumentName instrument-name)
29                                'MensuralStaff)
30                               $incipit-music)))
31                 (score (ly:make-score music))
32                 (mm (ly:output-def-lookup layout 'mm))
33                 (indent (ly:output-def-lookup layout 'indent))
34                 (width (ly:output-def-lookup layout 'incipit-width))
35                 (incipit-width (if (number? width)
36                                    (* width mm)
37                                    (* indent 0.5))))
38
39            (ly:output-def-set-variable! layout 'indent (- indent
40                                                           incipit-width))
41            (ly:output-def-set-variable! layout 'line-width indent)
42            (ly:output-def-set-variable! layout 'ragged-right #f)
43            (ly:output-def-set-variable! layout 'ragged-last #f)
44            (ly:output-def-set-variable! layout 'system-count 1)
45            (ly:score-add-output-def! score layout)
46            (ly:grob-set-property! grob 'long-text
47                                   (markup #:score score))
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     \once \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-6 . 3)
159     \clef "treble_8"
160     R1 |
161     R1 |
162     R1 |
163     % two measures
164     r2 d'2. d'4 b e' |
165     \once \override NoteHead #'transparent = ##t
166     e'1 |
167     d'\breve |
168   }
169 }
170
171 tenorLyrics = \lyricmode {
172   % two measures
173   Ju -- bi -- la -- te |
174   "..." |
175   -us.
176 }
177
178 bassusIncipit = <<
179   \new MensuralVoice = "bassusIncipit" <<
180     \repeat unfold 9 { s1 \noBreak }
181     {
182       \clef "bass"
183       \key f \major
184       \time 2/2
185       %% incipit
186       r\maxima
187       f1.
188     }
189   >>
190   \new Lyrics \lyricsto bassusIncipit { IV- }
191 >>
192
193 bassusNotes = {
194   \transpose c' c' {
195     \clef "bass"
196     R1 |
197     R1 |
198     R1 |
199     R1 |
200     g2. e4 |
201     \once \override NoteHead #'transparent = ##t
202     e1 |
203     g\breve |
204   }
205 }
206
207 bassusLyrics = \lyricmode {
208   Ju -- bi- |
209   "..." |
210   -us.
211 }
212
213 \score {
214   <<
215     \new StaffGroup = choirStaff <<
216       \new Voice = "discantusNotes" <<
217         \global
218         \set Staff.instrumentName = #"Discantus"
219         \incipit \discantusIncipit
220         \discantusNotes
221       >>
222       \new Lyrics = "discantusLyrics" \lyricsto discantusNotes { \discantusLyrics }
223       \new Voice = "altusNotes" <<
224         \global
225         \set Staff.instrumentName = #"Altus"
226         \incipit \altusIncipit
227         \altusNotes
228       >>
229       \new Lyrics = "altusLyrics" \lyricsto altusNotes { \altusLyrics }
230       \new Voice = "tenorNotes" <<
231         \global
232         \set Staff.instrumentName = #"Tenor"
233         \incipit \tenorIncipit
234         \tenorNotes
235       >>
236       \new Lyrics = "tenorLyrics" \lyricsto tenorNotes { \tenorLyrics }
237       \new Voice = "bassusNotes" <<
238         \global
239         \set Staff.instrumentName = #"Bassus"
240         \incipit \bassusIncipit
241         \bassusNotes
242       >>
243       \new Lyrics = "bassusLyrics" \lyricsto bassusNotes { \bassusLyrics }
244     >>
245   >>
246   \layout {
247     \context {
248       \Score
249       %% no bar lines in staves or lyrics
250       \override BarLine #'transparent = ##t
251     }
252     %% the next two instructions keep the lyrics between the bar lines
253     \context {
254       \Lyrics
255       \consists "Bar_engraver"
256       \consists "Separating_line_group_engraver"
257     }
258     \context {
259       \Voice
260       %% no slurs
261       \override Slur #'transparent = ##t
262       %% Comment in the below "\remove" command to allow line
263       %% breaking also at those bar lines where a note overlaps
264       %% into the next measure.  The command is commented out in this
265       %% short example score, but especially for large scores, you
266       %% will typically yield better line breaking and thus improve
267       %% overall spacing if you comment in the following command.
268       %%\remove "Forbid_line_break_engraver"
269     }
270     indent = 6\cm
271     incipit-width = 4\cm
272   }
273 }