-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlilypond-globals-export.ily
130 lines (110 loc) · 3.98 KB
/
lilypond-globals-export.ily
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
%% This makes some functions and variables defined in LilyPond code
%% available to Scheme modules.
#(begin
;; Internal utility music functions used by the Scheme modules.
(let ((mdl (resolve-module '(lilygabc lily music-functions))))
(module-define! mdl 'lilygabc-global-settings lilygabcGlobalSettings)
(module-define! mdl 'make-invisible-note
(define-music-function () () #{ \once \hideNotes g'4 #}))
;; N.B.: all functions applying features to a note
;; must have that note as their last expression
;; (not e.g. a state-resetting command).
;; Otherwise a subsequent application of another function
;; on the result of the function call
;; results in an unattached ArticulationEvent.
(module-define! mdl 'tiny-note
(define-music-function (note) (ly:music?)
#{ \once \tiny #note #}))
(module-define! mdl 'teeny-note
(define-music-function (note) (ly:music?)
#{ \once \teeny #note #}))
(module-define! mdl 'apply-articulation
(define-music-function (articulation note) (ly:music? ly:music?)
#{ #note #articulation #}))
(module-define! mdl 'apply-articulation-down
(define-music-function (articulation note) (ly:music? ly:music?)
#{ #note _#articulation #}))
(module-define! mdl 'apply-articulation-up
(define-music-function (articulation note) (ly:music? ly:music?)
#{ #note ^#articulation #}))
(module-define! mdl 'open-episema
(define-music-function (note) (ly:music?)
#{ #note \episemInitium #}))
(module-define! mdl 'close-episema
(define-music-function (note) (ly:music?)
#{ #note \episemFinis #}))
(module-define! mdl 'apply-virga
(define-music-function (side note) (boolean-or-symbol? ly:music?)
(define (stems-hidden? context)
(let* ((grob-def (ly:context-grob-definition context 'Stem))
(length (ly:assoc-get 'length grob-def)))
;; see \lilygabcModernGregorianStemlessLayout
(and (number? length) (= 0 length))))
(define stems-were-hidden #f)
(make-sequential-music
(list
(context-spec-music
(make-apply-context
(lambda (context)
(when (stems-hidden? context)
(set! stems-were-hidden #t)
(ly:context-pushpop-property context 'Stem 'length)
(ly:context-pushpop-property context 'Stem 'direction DOWN)
(when (eq? 'right side)
(ly:context-pushpop-property context 'NoteHead 'stem-attachment '(0.8 . 0.3))))))
'Voice)
note
(make-apply-context
(lambda (context)
(when stems-were-hidden
(ly:context-pushpop-property context 'Stem 'length 0)
(ly:context-pushpop-property context 'Stem 'direction)
(when (eq? 'right side)
(ly:context-pushpop-property context 'NoteHead 'stem-attachment)))))
))))
(module-define! mdl 'apply-musica-ficta
(define-music-function (note) (ly:music?)
#{ \once \set suggestAccidentals = ##t #note #}))
(module-define! mdl 'key-flat #{ \key f \major #})
(module-define! mdl 'key-natural #{ \key c \major #})
(for-each
(lambda (sym)
(module-define! mdl sym (eval sym (current-module))))
'(lilygabcAccentGrave
lilygabcSemicircleUpper)))
;; standard LilyPond names which aren't available by importing the (lily) module
(let ((mdl (resolve-module '(lilygabc lily lilypond-globals))))
(for-each
(lambda (sym)
(module-define! mdl sym (eval sym (current-module))))
'(bar
break
breathe
clef
hideNotes
once
prall
staccatissimo
teeny
tenuto))
;; gregorian.ly names
(when (defined? 'virga) ; gregorian.ly is \included
(for-each
(lambda (sym)
(module-define! mdl sym (eval sym (current-module))))
'(accentus
ascendens
auctum
augmentum
cavum
circulus
deminutum
descendens
ictus
inclinatum
linea
oriscus
quilisma
semicirculus
stropha
virga)))))