]> git.donarmstrong.com Git - lilypond.git/blob - ly/gregorian-init.ly
* ly/gregorian-init.ly: Rewrote \versus and \responsum in order to
[lilypond.git] / ly / gregorian-init.ly
1 \version "2.7.39"
2
3 %%%%%%%%
4 %%%%%%%% shortcuts common for all styles of gregorian chant notation
5 %%%%%%%%
6
7 %
8 % Declare memorable shortcuts for special unicode characters
9 % that are used in chant notation.
10
11
12 % unicode 0132 (latin capital ligature IJ)
13 IJ = \lyricmode { IJ }
14 IIJ = \lyricmode { IIJ }
15
16 % unicode 0133 (latin small ligature ij)
17 ij = \lyricmode { ij }
18 iij = \lyricmode { iij }
19
20 % Given some music that represents lyrics, add a prefix to the first
21 % lyric event.
22 #(define (add-prefix-to-lyrics prefix music)
23    (make-music
24     'SequentialMusic
25     'elements (append
26                (cons
27                 (let* ((elems (car (ly:music-property music 'elements)))
28                        (props (ly:music-mutable-properties elems))
29                        (events (filter (lambda (x)
30                                          (equal? (car x) 'elements))
31                                        props))
32                        (first-evt (cadar events))
33                        (first-syllable (ly:prob-property first-evt 'text))
34                        (first-duration (ly:prob-property first-evt 'duration)))
35                   (make-music
36                    'LyricEvent
37                    'duration first-duration
38                    'text (string-append prefix first-syllable)))
39                 (cdr (ly:music-property music 'elements))))))
40
41 % Add unicode 2123 (versicle) as prefix to lyrics.
42 versus =
43 #(define-music-function (parser location music) (ly:music?)
44    (add-prefix-to-lyrics "℣" music))
45
46 % Add unicode 211F (response) as prefix to lyrics.
47 responsum =
48 #(define-music-function (parser location music) (ly:music?)
49    (add-prefix-to-lyrics "℟" music))
50
51 %
52 % Declare head prefix shortcuts.
53 %
54 virga =
55   \once \override NoteHead  #'virga = ##t
56 stropha =
57   \once \override NoteHead  #'stropha = ##t
58 inclinatum =
59   \once \override NoteHead  #'inclinatum = ##t
60 auctum =
61   \once \override NoteHead  #'auctum = ##t
62 descendens =
63   \once \override NoteHead  #'descendens = ##t
64 ascendens =
65   \once \override NoteHead  #'ascendens = ##t
66 pes =
67   \once \override NoteHead  #'pes-or-flexa = ##t
68 flexa =
69   \once \override NoteHead  #'pes-or-flexa = ##t
70 oriscus =
71   \once \override NoteHead  #'oriscus = ##t
72 quilisma =
73   \once \override NoteHead  #'quilisma = ##t
74 deminutum =
75   \once \override NoteHead  #'deminutum = ##t
76 linea =
77   \once \override NoteHead  #'linea = ##t
78 cavum =
79   \once \override NoteHead  #'cavum = ##t
80
81 %
82 % Declare divisiones shortcuts.
83 %
84 virgula = {
85   \once \override BreathingSign  #'text = #(make-musicglyph-markup "scripts.rcomma")
86   \once \override BreathingSign  #'font-size = #-2
87
88   % Workaround: add padding.  Correct fix would be spacing engine handle this.
89   \once \override BreathingSign  #'extra-X-extent = #'(-1.0 . 0)
90
91   \breathe
92 }
93 caesura = {
94   \once \override BreathingSign  #'text = #(make-musicglyph-markup "scripts.rvarcomma")
95   \once \override BreathingSign  #'font-size = #-2
96
97   % Workaround: add padding.  Correct fix would be spacing engine handle this.
98   \once \override BreathingSign  #'extra-X-extent = #'(-1.0 . 0)
99
100   \breathe
101 }
102 divisioMinima = {
103   \once \override BreathingSign  #'stencil = #ly:breathing-sign::divisio-minima
104
105   % Workaround: add padding.  Correct fix would be spacing engine handle this.
106   \once \override BreathingSign  #'extra-X-extent = #'(-1.0 . 0)
107
108   \breathe
109 }
110 divisioMaior = {
111   \once \override BreathingSign  #'stencil = #ly:breathing-sign::divisio-maior
112   \once \override BreathingSign  #'Y-offset = #0
113
114   % Workaround: add padding.  Correct fix would be spacing engine handle this.
115   \once \override BreathingSign  #'extra-X-extent = #'(-1.0 . 0)
116
117   \breathe
118 }
119 divisioMaxima = {
120   \once \override BreathingSign  #'stencil = #ly:breathing-sign::divisio-maxima
121   \once \override BreathingSign  #'Y-offset = #0
122
123   % Workaround: add padding.  Correct fix would be spacing engine handle this.
124   \once \override BreathingSign  #'extra-X-extent = #'(-1.0 . 0)
125
126   \breathe
127 }
128 finalis = {
129   \once \override BreathingSign  #'stencil = #ly:breathing-sign::finalis
130   \once \override BreathingSign  #'Y-offset = #0
131
132   % Workaround: add padding.  Correct fix would be spacing engine handle this.
133   \once \override BreathingSign  #'extra-X-extent = #'(-1.0 . 0)
134
135   \breathe
136 }
137
138 %
139 % Declare articulation shortcuts.
140 %
141 accentus = #(make-articulation "accentus")
142 ictus = #(make-articulation "ictus")
143 semicirculus = #(make-articulation "semicirculus")
144 circulus = #(make-articulation "circulus")
145 episemInitium = #(make-span-event 'TextSpanEvent START)
146 episemFinis = #(make-span-event 'TextSpanEvent STOP)
147 augmentum = {
148   %%% TODO: A ligature head postfix that indicates that an
149   %%% augmentum dot should be appended to the right end of
150   %%% the surrounding ligature.  [Not yet implemented.]
151 }
152
153
154 %
155 % Declare shortcut music functions for Liber Hymnarius neumes
156 % table (experimental).
157 %
158
159 #(define (make-ligature music)
160    (make-music 'SequentialMusic
161                'elements (append
162                           (cons
163                            (make-music 'EventChord
164                                        'elements (list
165                                                   (make-span-event 'LigatureEvent START)))
166                            (ly:music-property music 'elements))
167                           (list
168                            (make-music 'EventChord
169                                        'elements (list
170                                                   (make-span-event 'LigatureEvent STOP)))))))
171
172 ligature = #(define-music-function
173               (location music) (ly:music?)
174               (make-ligature music))
175
176 %#(define (make-script x)
177 %   (make-music 'ArticulationEvent
178 %               'articulation-type x))
179 %    
180 %#(define (add-script m x)
181 %   (if
182 %     (equal? (ly:music-property m 'name) 'EventChord)
183 %     (set! (ly:music-property m 'elements)
184 %           (cons (make-script x)
185 %                 (ly:music-property m 'elements))))
186 %   m)
187 %
188 %#(define (add-staccato m)
189 %   (add-script m "staccato"))
190 %
191 % % \applyMusic #(lambda (x) (music-map add-staccato x)) { c c }
192 %
193 % % \climacus { x y z ... }:
194 % % \[ \virga x \inclinatum y \inclinatum z ... \]
195 %
196 %#(defmacro def-climacus-function (start stop)
197 %  `(define-music-function (location music) (ly:music?)
198 %     (make-music 'SequentialMusic
199 %        'elements (list 'LigatureStartEvent
200 %                       (ly:music-deep-copy ,start)
201 %                        music
202 %                        (ly:music-deep-copy ,stop)
203 %                       'LigatureStopEvent))))
204 %climacus = #(def-climacus-function startSequentialMusic stopSequentialMusic)
205
206 %
207 % Declare default layout; here for Vaticana style.  In case there will
208 % be additional styles, we may want to create style-specific .ly files
209 % for inclusion (e.g. vaticana-init.ly), move the style-dependent stuff
210 % over there, leave the style-independent Gregorian stuff here, and let
211 % the style-specific file (vaticana-init.ly) include this file.  The
212 % user then will have to include vaticana-init.ly instead of
213 % gregorian-init.ly.
214 %
215 \layout {
216     indent = 0.0
217     packed = ##t
218
219     %%% TODO: should raggedright be the default?
220     %ragged-right = ##t
221     ragged-last = ##t
222
223     %%% FIXME: line-thickness should be set here to a slightly
224     %%% thicker value as the default; but we can not set it here,
225     %%% since neither \staff-space nor #staff-space is yet defined
226     %%% when lily comes across the following line.
227     %line-thickness = \staff-space / 7.0
228
229     \context {
230         \VaticanaStaff
231          \override StaffSymbol #'color = #red
232          \override LedgerLineSpanner #'color = #red
233     }
234     \context {
235         \Score
236         \remove "Bar_number_engraver"
237
238         %%%
239         %%% FIXME: Musicologically seen, timing should be set to #f.
240         %%% Unfortunately, setting it to #f will result in no
241         %%% line-breakable items being created, such that the whole
242         %%% music will end up in a single line.  Therefore, we
243         %%% currently set it to #t, until the ligature code is fixed
244         %%% to automatically insert breakable items.
245         %%%
246         timing = ##t
247
248         %%%
249         %%% FIXME: Setting barAlways to #t would fix the above
250         %%% "timing = ##t" problem, but, surprisingly, it increases
251         %%% the space between ligatures.  Hence, we set it to #f.
252         %%%
253         barAlways = ##f
254
255         \override SpacingSpanner #'packed-spacing = ##t
256
257         %%%
258         %%% TODO: Play around with the following SpacingSpanner
259         %%% settings to yield better spacing between ligatures.
260         %%%
261         %%% FIXME: setting #'spacing-increment to a small value
262         %%% causes tons of "programming error: adding reverse spring,
263         %%% setting to unit" messages.
264         %%%
265         %\override SpacingSpanner #'shortest-duration-space = #0
266         %\override SpacingSpanner #'average-spacing-wishes = ##f
267         %\override SpacingSpanner #'spacing-increment = #0.0
268         %\override SpacingSpanner #'uniform-stretching = ##t
269     }
270 }
271
272 %
273 % neumeDemoLayout defines a layout block suitable for notating pure
274 % Vaticana style neumes without any other notation symbols such as
275 % staff lines or clefs.  This layout is useful for engraving neumes
276 % tables, such as that one in the lilypond manual section on
277 % Gregorian ligatures, or for educational works.
278 %
279 neumeDemoLayout = \layout {
280     interscoreline = 1
281     \context {
282         \Score
283         \remove "Bar_number_engraver"
284     }
285     \context {
286         \Staff
287         \remove "Clef_engraver"
288         \remove "Key_engraver"
289         \override StaffSymbol #'transparent = ##t
290         \remove "Time_signature_engraver"
291         \remove "Bar_engraver"
292         minimumVerticalExtent = ##f
293     }
294     \context {
295         \Voice
296         \remove Ligature_bracket_engraver
297         \consists Vaticana_ligature_engraver
298         \override NoteHead #'style = #'vaticana.punctum
299         \override Stem #'transparent = ##t
300     }
301 }
302
303 %%% Local Variables:
304 %%% coding: utf-8
305 %%% End: