Doc: Add changes entries, and update NR for fix to 849.
[lilypond/mpolesky.git] / ly / gregorian.ly
blob8fbc6fdee850924ec9bf67fc70989aaa9454ae20
1 %{
2 Shortcuts common for all styles of gregorian chant notation.
3 $Id$
4 %}
6 \version "2.12.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)
141 \once \override BreathingSign #'extra-spacing-height = #'(-0.5 . 0.5)
143 \breathe
147 % Declare articulation shortcuts.
149 accentus = #(make-articulation "accentus")
150 ictus = #(make-articulation "ictus")
151 semicirculus = #(make-articulation "semicirculus")
152 circulus = #(make-articulation "circulus")
155 % \augmentum increases the dot-count value of all note heads to which
156 % it is applied by one.
158 augmentum =
159 #(define-music-function (parser location expr) (ly:music?)
160 (shift-duration-log expr 0 1))
163 % Declare shortcut music functions for Liber Hymnarius neumes
164 % table (experimental).
167 #(define (make-ligature music)
168 (make-music 'SequentialMusic
169 'elements (append
170 (cons
171 (make-music 'EventChord
172 'elements (list
173 (make-span-event 'LigatureEvent START)))
174 (ly:music-property music 'elements))
175 (list
176 (make-music 'EventChord
177 'elements (list
178 (make-span-event 'LigatureEvent STOP)))))))
180 ligature = #(define-music-function
181 (location music) (ly:music?)
182 (make-ligature music))
184 %#(define (make-script x)
185 % (make-music 'ArticulationEvent
186 % 'articulation-type x))
188 %#(define (add-script m x)
189 % (if
190 % (equal? (ly:music-property m 'name) 'EventChord)
191 % (set! (ly:music-property m 'elements)
192 % (cons (make-script x)
193 % (ly:music-property m 'elements))))
194 % m)
196 %#(define (add-staccato m)
197 % (add-script m "staccato"))
199 % % \applyMusic #(lambda (x) (music-map add-staccato x)) { c c }
201 % % \climacus { x y z ... }:
202 % % \[ \virga x \inclinatum y \inclinatum z ... \]
204 %#(defmacro def-climacus-function (start stop)
205 % `(define-music-function (location music) (ly:music?)
206 % (make-music 'SequentialMusic
207 % 'elements (list 'LigatureStartEvent
208 % (ly:music-deep-copy ,start)
209 % music
210 % (ly:music-deep-copy ,stop)
211 % 'LigatureStopEvent))))
212 %climacus = #(def-climacus-function startSequentialMusic stopSequentialMusic)
215 % Declare default layout; here for Vaticana style. In case there will
216 % be additional styles, we may want to create style-specific .ly files
217 % for inclusion (e.g. vaticana-init.ly), move the style-dependent stuff
218 % over there, leave the style-independent Gregorian stuff here, and let
219 % the style-specific file (vaticana-init.ly) include this file. The
220 % user then will have to include vaticana-init.ly instead of
221 % gregorian.ly.
223 \layout {
224 indent = 0.0
226 %%% TODO: should ragged-right be the default?
227 %ragged-right = ##t
228 ragged-last = ##t
230 line-thickness = #(/ (ly:output-def-lookup $defaultpaper 'staff-space) 7.0)
232 \context {
233 \VaticanaStaff
234 \override StaffSymbol #'color = #red
235 \override LedgerLineSpanner #'color = #red
237 \context {
238 \Score
239 \remove "Bar_number_engraver"
242 %%% FIXME: Musicologically seen, timing should be set to #f.
243 %%% Unfortunately, setting it to #f will result in no
244 %%% line-breakable items being created, such that the whole
245 %%% music will end up in a single line. Therefore, we
246 %%% currently set it to #t, until the ligature code is fixed
247 %%% to automatically insert breakable items.
249 timing = ##t
252 %%% FIXME: Setting barAlways to #t would fix the above
253 %%% "timing = ##t" problem, but, surprisingly, it increases
254 %%% the space between ligatures. Hence, we set it to #f.
256 barAlways = ##f
258 \override SpacingSpanner #'packed-spacing = ##t
261 %%% TODO: Play around with the following SpacingSpanner
262 %%% settings to yield better spacing between ligatures.
264 %%% FIXME: setting #'spacing-increment to a small value
265 %%% causes tons of "programming error: adding reverse spring,
266 %%% setting to unit" messages.
268 %\override SpacingSpanner #'base-shortest-duration = #(ly:make-moment 1 4)
269 %\override SpacingSpanner #'shortest-duration-space = #0
270 %\override SpacingSpanner #'average-spacing-wishes = ##f
271 %\override SpacingSpanner #'spacing-increment = #0.0
272 %\override SpacingSpanner #'uniform-stretching = ##t
277 % neumeDemoLayout defines a layout block suitable for notating pure
278 % Vaticana style neumes without any other notation symbols such as
279 % staff lines or clefs. This layout is useful for engraving neumes
280 % tables, such as that one in the lilypond manual section on
281 % Gregorian ligatures, or for educational works.
283 neumeDemoLayout = \layout {
284 interscoreline = 1
285 \context {
286 \Score
287 \remove "Bar_number_engraver"
289 \context {
290 \Staff
291 \remove "Clef_engraver"
292 \remove "Key_engraver"
293 \override StaffSymbol #'transparent = ##t
294 \remove "Time_signature_engraver"
295 \remove "Bar_engraver"
296 \override VerticalAxisGroup #'minimum-Y-extent = ##f
298 \context {
299 \Voice
300 \remove Ligature_bracket_engraver
301 \consists Vaticana_ligature_engraver
302 \override NoteHead #'style = #'vaticana.punctum
303 \override Stem #'transparent = ##t
307 %%% Local Variables:
308 %%% coding: utf-8
309 %%% End: