LSR: Update.
[lilypond.git] / ly / gregorian.ly
blobf2b6e55bfccac9add9c20af937e3ae60445933cf
1 %{
2 Shortcuts common for all styles of gregorian chant notation.
3 $Id$
4 %}
6 \version "2.10.0"
9 % Declare memorable shortcuts for special unicode characters
10 % that are used in chant notation.
13 % unicode 0132 (latin capital ligature IJ)
14 IJ = \lyricmode { IJ }
15 IIJ = \lyricmode { IIJ }
17 % unicode 0133 (latin small ligature ij)
18 ij = \lyricmode { ij }
19 iij = \lyricmode { iij }
22 % Given some music that represents lyrics, add a prefix to the first
23 % lyric event.
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".
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))))))
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))
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))
59 % Declare head prefix shortcuts.
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
89 % Declare divisiones shortcuts.
91 virgula = {
92 \once \override BreathingSign #'text = #(make-musicglyph-markup "scripts.rcomma")
93 \once \override BreathingSign #'font-size = #-2
95 % Workaround: add padding. Correct fix would be spacing engine handle this.
96 \once \override BreathingSign #'extra-X-extent = #'(-1.0 . 0)
98 \breathe
100 caesura = {
101 \once \override BreathingSign #'text = #(make-musicglyph-markup "scripts.rvarcomma")
102 \once \override BreathingSign #'font-size = #-2
104 % Workaround: add padding. Correct fix would be spacing engine handle this.
105 \once \override BreathingSign #'extra-X-extent = #'(-1.0 . 0)
107 \breathe
109 divisioMinima = {
110 \once \override BreathingSign #'stencil = #ly:breathing-sign::divisio-minima
112 % Workaround: add padding. Correct fix would be spacing engine handle this.
113 \once \override BreathingSign #'extra-X-extent = #'(-1.0 . 0)
115 \breathe
117 divisioMaior = {
118 \once \override BreathingSign #'stencil = #ly:breathing-sign::divisio-maior
119 \once \override BreathingSign #'Y-offset = #0
121 % Workaround: add padding. Correct fix would be spacing engine handle this.
122 \once \override BreathingSign #'extra-X-extent = #'(-1.0 . 0)
124 \breathe
126 divisioMaxima = {
127 \once \override BreathingSign #'stencil = #ly:breathing-sign::divisio-maxima
128 \once \override BreathingSign #'Y-offset = #0
130 % Workaround: add padding. Correct fix would be spacing engine handle this.
131 \once \override BreathingSign #'extra-X-extent = #'(-1.0 . 0)
133 \breathe
135 finalis = {
136 \once \override BreathingSign #'stencil = #ly:breathing-sign::finalis
137 \once \override BreathingSign #'Y-offset = #0
139 % Workaround: add padding. Correct fix would be spacing engine handle this.
140 \once \override BreathingSign #'extra-X-extent = #'(-1.0 . 0)
142 \breathe
146 % Declare articulation shortcuts.
148 accentus = #(make-articulation "accentus")
149 ictus = #(make-articulation "ictus")
150 semicirculus = #(make-articulation "semicirculus")
151 circulus = #(make-articulation "circulus")
152 episemInitium = \startTextSpan
153 episemFinis = \stopTextSpan
156 % \augmentum increases the dot-count value of all note heads to which
157 % it is applied by one.
159 augmentum =
160 #(define-music-function (parser location expr) (ly:music?)
161 (shift-duration-log expr 0 1))
164 % Declare shortcut music functions for Liber Hymnarius neumes
165 % table (experimental).
168 #(define (make-ligature music)
169 (make-music 'SequentialMusic
170 'elements (append
171 (cons
172 (make-music 'EventChord
173 'elements (list
174 (make-span-event 'LigatureEvent START)))
175 (ly:music-property music 'elements))
176 (list
177 (make-music 'EventChord
178 'elements (list
179 (make-span-event 'LigatureEvent STOP)))))))
181 ligature = #(define-music-function
182 (location music) (ly:music?)
183 (make-ligature music))
185 %#(define (make-script x)
186 % (make-music 'ArticulationEvent
187 % 'articulation-type x))
189 %#(define (add-script m x)
190 % (if
191 % (equal? (ly:music-property m 'name) 'EventChord)
192 % (set! (ly:music-property m 'elements)
193 % (cons (make-script x)
194 % (ly:music-property m 'elements))))
195 % m)
197 %#(define (add-staccato m)
198 % (add-script m "staccato"))
200 % % \applyMusic #(lambda (x) (music-map add-staccato x)) { c c }
202 % % \climacus { x y z ... }:
203 % % \[ \virga x \inclinatum y \inclinatum z ... \]
205 %#(defmacro def-climacus-function (start stop)
206 % `(define-music-function (location music) (ly:music?)
207 % (make-music 'SequentialMusic
208 % 'elements (list 'LigatureStartEvent
209 % (ly:music-deep-copy ,start)
210 % music
211 % (ly:music-deep-copy ,stop)
212 % 'LigatureStopEvent))))
213 %climacus = #(def-climacus-function startSequentialMusic stopSequentialMusic)
216 % Declare default layout; here for Vaticana style. In case there will
217 % be additional styles, we may want to create style-specific .ly files
218 % for inclusion (e.g. vaticana-init.ly), move the style-dependent stuff
219 % over there, leave the style-independent Gregorian stuff here, and let
220 % the style-specific file (vaticana-init.ly) include this file. The
221 % user then will have to include vaticana-init.ly instead of
222 % gregorian.ly.
224 \layout {
225 indent = 0.0
227 %%% TODO: should raggedright be the default?
228 %ragged-right = ##t
229 ragged-last = ##t
231 %%% FIXME: line-thickness should be set here to a slightly
232 %%% thicker value as the default; but we can not set it here,
233 %%% since neither \staff-space nor #staff-space is yet defined
234 %%% when lily comes across the following line.
235 %line-thickness = \staff-space / 7.0
237 \context {
238 \VaticanaStaff
239 \override StaffSymbol #'color = #red
240 \override LedgerLineSpanner #'color = #red
242 \context {
243 \Score
244 \remove "Bar_number_engraver"
247 %%% FIXME: Musicologically seen, timing should be set to #f.
248 %%% Unfortunately, setting it to #f will result in no
249 %%% line-breakable items being created, such that the whole
250 %%% music will end up in a single line. Therefore, we
251 %%% currently set it to #t, until the ligature code is fixed
252 %%% to automatically insert breakable items.
254 timing = ##t
257 %%% FIXME: Setting barAlways to #t would fix the above
258 %%% "timing = ##t" problem, but, surprisingly, it increases
259 %%% the space between ligatures. Hence, we set it to #f.
261 barAlways = ##f
263 \override SpacingSpanner #'packed-spacing = ##t
266 %%% TODO: Play around with the following SpacingSpanner
267 %%% settings to yield better spacing between ligatures.
269 %%% FIXME: setting #'spacing-increment to a small value
270 %%% causes tons of "programming error: adding reverse spring,
271 %%% setting to unit" messages.
273 %\override SpacingSpanner #'base-shortest-duration = #(ly:make-moment 1 4)
274 %\override SpacingSpanner #'shortest-duration-space = #0
275 %\override SpacingSpanner #'average-spacing-wishes = ##f
276 %\override SpacingSpanner #'spacing-increment = #0.0
277 %\override SpacingSpanner #'uniform-stretching = ##t
282 % neumeDemoLayout defines a layout block suitable for notating pure
283 % Vaticana style neumes without any other notation symbols such as
284 % staff lines or clefs. This layout is useful for engraving neumes
285 % tables, such as that one in the lilypond manual section on
286 % Gregorian ligatures, or for educational works.
288 neumeDemoLayout = \layout {
289 interscoreline = 1
290 \context {
291 \Score
292 \remove "Bar_number_engraver"
294 \context {
295 \Staff
296 \remove "Clef_engraver"
297 \remove "Key_engraver"
298 \override StaffSymbol #'transparent = ##t
299 \remove "Time_signature_engraver"
300 \remove "Bar_engraver"
301 \override VerticalAxisGroup #'minimum-Y-extent = ##f
303 \context {
304 \Voice
305 \remove Ligature_bracket_engraver
306 \consists Vaticana_ligature_engraver
307 \override NoteHead #'style = #'vaticana.punctum
308 \override Stem #'transparent = ##t
312 %%% Local Variables:
313 %%% coding: utf-8
314 %%% End: