LEFT | RIGHT |
1 ;;;; default-beam-settings.scm -- Default auto-beam and subdivide-beam settings | 1 ;;;; default-beam-settings.scm -- Default auto-beam and subdivide-beam settings |
2 ;;;; | 2 ;;;; |
3 ;;;; source file of the GNU LilyPond music typesetter | 3 ;;;; source file of the GNU LilyPond music typesetter |
4 ;;;; | 4 ;;;; |
5 ;;;; (c) 2009 Carl Sorensen <c_sorensen@byu.edu> | 5 ;;;; (c) 2009 Carl Sorensen <c_sorensen@byu.edu> |
6 | 6 |
7 ;;; specify default beaming rules | 7 ;;; specify default beaming rules |
8 | 8 |
9 ;;; format: | 9 ;;; format: |
10 ;;; | 10 ;;; |
(...skipping 10 matching lines...) Expand all Loading... |
21 ;;; for eighth-note triplets. | 21 ;;; for eighth-note triplets. |
22 ;;; grouping = a list of groups, in units of time signature denominator | 22 ;;; grouping = a list of groups, in units of time signature denominator |
23 ;;; (for default rules) or beam-type (for explicit rules) | 23 ;;; (for default rules) or beam-type (for explicit rules) |
24 ;;; | 24 ;;; |
25 | 25 |
26 (define-public default-beam-settings | 26 (define-public default-beam-settings |
27 `( | 27 `( |
28 ;; in 2 2 time: | 28 ;; in 2 2 time: |
29 ;; default: end beams on 1 2 note boundaries | 29 ;; default: end beams on 1 2 note boundaries |
30 ;; end beams with 32nd notes each 1 4 beat | 30 ;; end beams with 32nd notes each 1 4 beat |
31 (((2 . 2) end) . | 31 (((2 . 2) end) . |
32 ((* . (1 1)) | 32 ((* . (1 1)) |
33 ((1 . 32) . (8 8 8 8)))) | 33 ((1 . 32) . (8 8 8 8)))) |
34 | 34 |
35 ;; in 2 4, 2 8 and 2 16 time: | 35 ;; in 2 4, 2 8 and 2 16 time: |
36 ;; default: end beams on beats | 36 ;; default: end beams on beats |
37 (((2 . 4) end) . ((* . (1 1)))) | 37 (((2 . 4) end) . ((* . (1 1)))) |
38 (((2 . 8) end) . ((* . (1 1)))) | 38 (((2 . 8) end) . ((* . (1 1)))) |
39 (((2 . 16) end) . ((* . (1 1)))) | 39 (((2 . 16) end) . ((* . (1 1)))) |
40 | 40 |
41 ;; in 3 2 time: | 41 ;; in 3 2 time: |
42 ;; default: end beams on beats | 42 ;; default: end beams on beats |
43 ;; end beams with 32nd notes each 1 4 beat | 43 ;; end beams with 32nd notes each 1 4 beat |
44 (((3 . 2) end) . | 44 (((3 . 2) end) . |
45 ((* . (1 1 1)) | 45 ((* . (1 1 1)) |
46 ((1 . 32) . (8 8 8 8 8 8)))) | 46 ((1 . 32) . (8 8 8 8 8 8)))) |
47 | 47 |
48 ;; in 3 4 time: | 48 ;; in 3 4 time: |
49 ;; default: end beams on beats | 49 ;; default: end beams on beats |
50 (((3 . 4) end) . ((* . (1 1 1)))) | 50 ;; group 1/8 note beams on measure |
| 51 (((3 . 4) end) .((* . (3)) |
| 52 ((1 16) . (4 4 4)) |
| 53 ((1 32) . (8 8 8)) |
| 54 ((1 64) . (16 16 16)) |
| 55 ((1 128) . (32 32 32)))) |
51 | 56 |
52 ;; in 3 8 and 3 16 time time: | 57 ;; in 3 8 and 3 16 time time: |
53 ;; default: group on 3 | 58 ;; default: group on 3 |
54 (((3 . 8) end) . ((* . (3)))) | 59 (((3 . 8) end) . ((* . (3)))) |
55 (((3 . 16) end) . ((* . (3)))) | 60 (((3 . 16) end) . ((* . (3)))) |
56 | 61 |
57 ;; in 4 2 time: | 62 ;; in 4 2 time: |
58 ;; default: end beams on beats | 63 ;; default: end beams on beats |
59 ;; end beams with 16th notes each 1 4 beat | 64 ;; end beams with 16th notes each 1 4 beat |
60 ;; end beams with 32nd notes each 1 8 beat | 65 ;; end beams with 32nd notes each 1 8 beat |
61 (((4 . 2) end) . | 66 (((4 . 2) end) . |
62 ((* . (1 1 1 1)) | 67 ((* . (1 1 1 1)) |
63 ((1 . 16) . (4 4 4 4 4 4 4 4)) | 68 ((1 . 16) . (4 4 4 4 4 4 4 4)) |
64 ((1 . 32) . (4 4 4 4 | 69 ((1 . 32) . (4 4 4 4 |
65 4 4 4 4 | 70 4 4 4 4 |
66 4 4 4 4 | 71 4 4 4 4 |
67 4 4 4 4)))) | 72 4 4 4 4)))) |
68 | 73 |
69 ;; in 4 4 (common) time: | 74 ;; in 4 4 (common) time: |
70 ;; default: end beams on beats | 75 ;; default: end beams on beats |
71 ;; use beatLength for all except 32nd notes: | 76 ;; use beatLength for all except 32nd notes: |
72 ;; end beams with 32nd notes each 1 8 beat | 77 ;; end beams with 32nd notes each 1 8 beat |
73 (((4 . 4) end) . | 78 (((4 . 4) end) . |
74 ((* . (1 1 1 1)) | 79 ((* . (2 2)) |
75 ((1 . 32) . (4 4 4 4 | 80 ((1 . 32) . (4 4 4 4 |
76 4 4 4 4)))) | 81 4 4 4 4)))) |
77 | 82 |
78 ;; in 4 8 time: | 83 ;; in 4 8 time: |
79 ;; default: group on 1 8 notes | 84 ;; default: group on 1 4 notes |
80 (((4 . 8) end) . ((* . (1 1 1 1)))) | 85 (((4 . 8) end) . ((* . (2 2)))) |
81 | 86 |
82 ;; in 4 16 time: | 87 ;; in 4 16 time: |
83 ;; default: group on beats | 88 ;; default: group on beats |
84 (((4 . 16) end) . ((* . (1 1 1 1)))) | 89 (((4 . 16) end) . ((* . (1 1 1 1)))) |
85 | 90 |
86 ;; in 6 4 time: | 91 ;; in 6 4 time: |
87 ;; default group at 3 4 | 92 ;; default group at 3 4 |
88 ;; end beams with 16th or 32nd notes each 1 4 beat | 93 ;; end beams with 16th or 32nd notes each 1 4 beat |
89 (((6 . 4) end) . | 94 (((6 . 4) end) . |
90 ((* . (3 3)) | 95 ((* . (3 3)) |
91 ((1 . 16) . (4 4 4 4 4 4)) | 96 ((1 . 16) . (4 4 4 4 4 4)) |
92 ((1 . 32) . (8 8 8 8 8 8)))) | 97 ((1 . 32) . (8 8 8 8 8 8)))) |
93 | 98 |
94 ;; in 6 8 time: | 99 ;; in 6 8 time: |
95 ;; default: group at 3 8 | 100 ;; default: group at 3 8 |
96 ;; end beams with 32nd notes each 1 8 beat | 101 ;; end beams with 32nd notes each 1 8 beat |
97 (((6 . 8) end) . | 102 (((6 . 8) end) . |
98 ((* . (3 3)) | 103 ((* . (3 3)) |
99 ((6 . 8) . (4 4 4 4 4 4)))) | 104 ((6 . 8) . (4 4 4 4 4 4)))) |
100 | 105 |
101 ;; in 6 16 time: | 106 ;; in 6 16 time: |
102 ;; default: group at 3 16 | 107 ;; default: group at 3 16 |
103 (((6 . 16) end) . ((* . (3 3)))) | 108 (((6 . 16) end) . ((* . (3 3)))) |
104 | 109 |
105 ;; in 9 4 time: | 110 ;; in 9 4 time: |
106 ;; default: group at 3 4 | 111 ;; default: group at 3 4 |
107 ;; end beams with 16th or 32nd notes each 1 4 beat | 112 ;; end beams with 16th or 32nd notes each 1 4 beat |
(...skipping 10 matching lines...) Expand all Loading... |
118 ((* . (3 3 3)) | 123 ((* . (3 3 3)) |
119 ((1 . 32) . (4 4 4 4 4 4 4 4 4)))) | 124 ((1 . 32) . (4 4 4 4 4 4 4 4 4)))) |
120 | 125 |
121 ;; in 9 16 time | 126 ;; in 9 16 time |
122 ;; default: group at 3 8 | 127 ;; default: group at 3 8 |
123 (((9 . 16) end) . ((* . (3 3 3)))) | 128 (((9 . 16) end) . ((* . (3 3 3)))) |
124 | 129 |
125 ;; in 12 4 time: | 130 ;; in 12 4 time: |
126 ;; default: group at 3 4 | 131 ;; default: group at 3 4 |
127 ;; end beams with 16th or 32nd notes each 1 4 beat | 132 ;; end beams with 16th or 32nd notes each 1 4 beat |
128 (((12 . 4) end) . | 133 (((12 . 4) end) . |
129 ((* . (3 3 3 3)) | 134 ((* . (3 3 3 3)) |
130 ((1 . 16) . (4 4 4 4 4 4 4 4 4 4 4 4 4)) | 135 ((1 . 16) . (4 4 4 4 4 4 4 4 4 4 4 4 4)) |
131 ((12 . 4) . (8 8 8 8 8 8 8 8 8 8 8 8 8)))) | 136 ((12 . 4) . (8 8 8 8 8 8 8 8 8 8 8 8 8)))) |
132 | 137 |
133 ;; in 12 8 time: | 138 ;; in 12 8 time: |
134 ;; default: group at 3 8 | 139 ;; default: group at 3 8 |
135 ;; end beams with 32nd notes each 1 8 beat | 140 ;; end beams with 32nd notes each 1 8 beat |
136 (((12 . 8) end) . | 141 (((12 . 8) end) . |
137 ((* . (3 3 3 3)) | 142 ((* . (3 3 3 3)) |
138 ((1 . 32) . (4 4 4 4 4 4 4 4 4 4 4 4 4)))) | 143 ((1 . 32) . (4 4 4 4 4 4 4 4 4 4 4 4 4)))) |
139 | 144 |
140 ;; in 12 16 time: | 145 ;; in 12 16 time: |
141 ;; default: group at 3 16 | 146 ;; default: group at 3 16 |
142 (((12 . 16) end) . ((* . (3 3 3 3)))) | 147 (((12 . 16) end) . ((* . (3 3 3 3)))) |
143 | 148 |
144 ;; in 5 8 time: | 149 ;; in 5 8 time: |
145 ;; default: group (3 2) | 150 ;; default: group (3 2) |
146 (((5 . 8) end) . ((* . (3 2)))) | 151 (((5 . 8) end) . ((* . (3 2)))) |
147 | 152 |
148 ;; in 8 8 time: | 153 ;; in 8 8 time: |
149 ;; default: group (3 3 2) | 154 ;; default: group (3 3 2) |
150 (((8 . 8) end) . ((* . (3 3 2)))) | 155 (((8 . 8) end) . ((* . (3 3 2)))) |
151 )) ; end of alist definition | 156 )) ; end of alist definition |
152 | 157 |
153 ;;;; Functions for overriding beam settings | 158 ;;; Functions for overriding beam settings |
154 ;;; | 159 ;;; |
155 | 160 |
156 (define (overridden-property-alist context property setting value) | 161 (define (overridden-property-alist context property setting value) |
157 "Return an alist containing the current @{context} value of | 162 "Return an alist containing the current @{context} value of |
158 @code{property} overriden by @code{(setting . value)}. " | 163 @code{property} overriden by @code{(setting . value)}. " |
159 (cons (cons setting value) (ly:context-property context property))) | 164 (cons (cons setting value) (ly:context-property context property))) |
160 | 165 |
161 (define (override-property-setting context property setting value) | 166 (define-public (override-property-setting context property setting value) |
162 "Like the C++ code that executes \\override, but without type | 167 "Like the C++ code that executes \\override, but without type |
163 checking. " | 168 checking. " |
164 (ly:context-set-property! | 169 (ly:context-set-property! |
165 context property | 170 context property |
166 (overridden-property-alist context property setting value))) | 171 (overridden-property-alist context property setting value))) |
167 | 172 |
168 (define (revert-property-setting context property setting) | 173 (define (revert-property-setting context property setting) |
169 "Like the C++ code that executes \revert, but without type | 174 "Like the C++ code that executes \revert, but without type |
170 checking. " | 175 checking. " |
171 | 176 |
172 (define (revert-member alist entry new) | 177 (define (revert-member alist entry new) |
173 "Return ALIST, with ENTRY removed. ALIST is not modified, instead | 178 "Return ALIST, with ENTRY removed. ALIST is not modified, instead |
174 a fresh copy of the list-head is made." | 179 a fresh copy of the list-head is made." |
175 (cond | 180 (cond |
176 ((null? alist) new) | 181 ((null? alist) new) |
177 ((equal? (car alist) entry) (revert-member (cdr alist) entry new)) | 182 ((equal? (car alist) entry) (revert-member (cdr alist) entry new)) |
178 (else (revert-member (cdr alist) entry (cons (car alist) new))))) | 183 (else (revert-member (cdr alist) entry (cons (car alist) new))))) |
179 | 184 |
180 (ly:context-set-property! | 185 (ly:context-set-property! |
181 context property | 186 context property |
182 (revert-member (ly:context-property context property) setting '()))) | 187 (revert-member (ly:context-property context property) setting '()))) |
183 | 188 |
184 (define-public (override-beam-setting | 189 (define-public (override-beam-setting |
185 time-signature rule-type rule . rest) | 190 time-signature rule-type rule . rest) |
186 "Override the beam settings for the context in @var{rest}, | 191 "Override the beam settings for the context in @var{rest}, |
187 for @var{time-signature} and @var{rule-type}, with the | 192 for @var{time-signature} and @var{rule-type}, with the |
188 new rule alist @var{rule}. " | 193 new rule alist @var{rule}. " |
189 (define (make-setting c) | 194 (define (make-setting c) |
190 (let ((new-settings· | 195 (let ((new-settings |
191 (overridden-property-alist | 196 (overridden-property-alist |
192 c· | 197 c |
193 'beamSettings | 198 'beamSettings |
194 (list time-signature rule-type) | 199 (list time-signature rule-type) |
195 rule))) | 200 rule))) |
196 (ly:context-set-property! c 'beamSettings new-settings))) | 201 (ly:context-set-property! c 'beamSettings new-settings))) |
197 | 202 |
198 (let ((music-to-export· | 203 (let ((music-to-export |
199 (context-spec-music | 204 (context-spec-music |
200 (make-apply-context make-setting) | 205 (make-apply-context make-setting) |
201 (if (and (pair? rest) (symbol? (car rest))) | 206 (if (and (pair? rest) (symbol? (car rest))) |
202 (car rest) | 207 (car rest) |
203 'Voice)))) | 208 'Voice)))) |
204 (ly:export music-to-export))) | 209 (ly:export music-to-export))) |
205 | 210 |
206 (define-public (score-override-beam-setting | 211 (define-public (score-override-beam-setting |
207 time-signature rule-type rule) | 212 time-signature rule-type rule) |
208 (override-beam-setting | 213 (override-beam-setting |
209 time-signature rule-type rule 'Score)) | 214 time-signature rule-type rule 'Score)) |
210 | 215 |
211 (define-public (revert-beam-setting | 216 (define-public (revert-beam-setting |
212 time-signature rule-type . rest) | 217 time-signature rule-type . rest) |
213 (ly:export | 218 (ly:export |
214 (context-spec-music | 219 (context-spec-music |
215 (make-apply-context | 220 (make-apply-context |
216 (lambda (c) | 221 (lambda (c) |
217 (revert-property-setting | 222 (revert-property-setting |
218 c 'beamSettings | 223 c |
219 (list time-signature rule-type)))) | 224 'beamSettings |
220 (if (and (pair? rest) (symbol? (car rest))) | 225 (list time-signature rule-type)))) |
221 (car rest) | 226 (if (and (pair? rest) (symbol? (car rest))) |
222 'Voice)))) | 227 (car rest) |
| 228 'Voice)))) |
LEFT | RIGHT |