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