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