-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnumbered.ly
655 lines (607 loc) · 28 KB
/
numbered.ly
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
\version "2.22.0"
sanbanOn = {
\once \override Score.TimeSignature.stencil = #ly:text-interface::print
\once \override Score.TimeSignature.text = \markup{ \fontsize #3 \typewriter "サ" }
\once \override Score.TimeSignature.extra-offset = #'(0 . -1)
\time 4/4
}
allBarOff = {
\hide Score.BarLine
\hide Score.SpanBar
}
sanbanOff = {
\undo \hide Score.BarLine
\undo \hide Score.SpanBar
\time 4/4
}
#(define (log2 num)
(log num) / (log 2))
#(define (get-keysig-alt-count alt-alist)
"Return number of sharps/flats in key sig, (+) for sharps, (-) for flats."
(if (null? alt-alist)
0
(* (length alt-alist) 2 (cdr (car alt-alist)))))
#(define (get-major-tonic alt-count)
"Return number of the tonic note 0-6, as if the key sig were major."
;; (alt-count major-tonic)
;; (-7 0) (-5 1) (-3 2) (-1 3) (1 4) (3 5) (5 6) (7 0)
;; (-6 4) (-4 5) (-2 6) (0 0) (2 1) (4 2) (6 3)
(if (odd? alt-count)
(modulo (- (/ (+ alt-count 1) 2) 4) 7)
(modulo (/ alt-count 2) 7)))
#(define (get-key-alts context)
"Needed because LilyPond 2.19 and 2.20 has 'keyAlterations
and 2.18 has 'keySignature for the same context property.
No way to test for existence of context property..."
(define key-alts (ly:context-property context 'keyAlterations '()))
(if (equal? key-alts '())
(ly:context-property context 'keySignature '())
key-alts))
#(define (stencil-flip axis stl)
"Flip stencil @var{stl} in the direction of @var{axis}.
@var{axis} is 0 for X, 1 for Y."
(let* (
;; center stl on 0,0 to prepare for flipping,
;; and calculate how far it moved.
(centered-stl (ly:stencil-aligned-to stl axis CENTER))
(original-ext (ly:stencil-extent stl axis))
(centered-ext (ly:stencil-extent centered-stl axis))
(offset (- (car original-ext) (cdr centered-ext)))
;; scale centered-stl using -1 to flip it
(xy (if (= axis X) '(-1 . 1) '(1 . -1)))
(flipped-stl (ly:stencil-scale centered-stl (car xy) (cdr xy)))
;; restore flipped stl to original position
(replaced-stl (ly:stencil-translate-axis flipped-stl offset axis)))
;; for testing...
; (display original-ext) (display centered-ext)
; (display (ly:stencil-extent replaced-stl axis))(newline)
replaced-stl))
#(define (enumerate ls n)
(if (null? ls)
'()
(cons n (enumerate (cdr ls) (+ n 1)))))
#(define (process ls1 ls2)
(if (null? ls2)
ls1
(let* ((item (car ls2))
(residue (cdr ls2)))
(if
;(or
(music-is-of-type? item 'note-event)
; (music-is-of-type? item 'event-chord)
;)
(let* ((dur (ly:moment-main (ly:music-duration-length item)))
(logduration
(if (= dur 1/12) -3 (floor (log2 dur)))
)
(bc (max (- -2 logduration) 0))
(altleft (make-music
'ContextSpeccedMusic
'context-type
'Bottom
'element
(make-music
'PropertySet
'value
bc
'symbol
'stemLeftBeamCount)))
(altright (make-music
'ContextSpeccedMusic
'context-type
'Bottom
'element
(make-music
'PropertySet
'value
bc
'symbol
'stemRightBeamCount))))
(if (> bc 0)
(process (append ls1 (list altleft altright item)) residue)
(process (append ls1 (list item)) residue)
)
)
(process (append ls1 (list item)) residue)
)))
)
numberedMusic =
#(define-music-function (parser location mus full) (ly:music? boolean?)
"This music function modifies the music input for better numbered output."
(begin
(let ((major-tonic-pitch (ly:make-pitch 0 0 0))
(prev-pitch (ly:make-pitch 0 0 0)))
;(display "before modification")(newline)
;(display-scheme-music mus)
(music-map
(lambda (m)
(cond
;; TOP LEVEL
((music-is-of-type? m 'sequential-music)
(let* ((elems (ly:music-property m 'elements))
(newelems (process '() elems)))
(ly:music-set-property! m 'elements newelems)
))
;; KEY CHANGE
((music-is-of-type? m 'key-change-event)
(let*
((pitch-alist (ly:music-property m 'pitch-alist))
(key-alts (filter (lambda (a) (not (= 0 (cdr a)))) pitch-alist))
(keysig-alt-count (get-keysig-alt-count key-alts))
(major-tonic-number (get-major-tonic keysig-alt-count))
(tonic (ly:music-property m 'tonic))
(tonic-num (ly:pitch-notename tonic))
;; mode 1-7, 1=major 6=minor
(mode (+ 1 (modulo (- tonic-num major-tonic-number) 7))))
(set! major-tonic-pitch
(ly:make-pitch 0
major-tonic-number
(or (assoc-ref key-alts major-tonic-number) 0)))
;; store the actual key of the music for use in numbered key signatures
(ly:music-set-property! m 'numbered-key-sig (cons mode tonic))
;; convert the key signature in effect to c major
(ly:music-set-property! m 'pitch-alist '((0 . 0) (1 . 0) (2 . 0) (3 . 0) (4 . 0) (5 . 0) (6 . 0)))
(ly:music-set-property! m 'tonic (ly:make-pitch 0 0 0))
))
;; REST AND MULTI-MEASURE REST
((or (music-is-of-type? m 'rest-event)
(music-is-of-type? m 'multi-measure-rest)
)
(let ((dur (ly:moment-main (ly:music-duration-length m))))
(cond ((and (>= dur 1/2) (or (<= dur 1) full))
;; split whole and half rests into quarter notes
(let ((q (make-music 'RestEvent
'numbered-order 0
'numbered-chord-size 1
'duration (ly:make-duration 2 0 1)
'numbered-rest #t)))
;; double dotted half rest is special case
;; TODO: generalize this for triple dots, other durations, etc.?
(if (= dur 7/8)
(let ((q-dotted (ly:music-deep-copy q)))
(ly:music-set-property! q-dotted 'duration (ly:make-duration 2 1 1))
(set! m (make-sequential-music (append (make-list 2 q) (list q-dotted)))))
;; else
(set! m (make-sequential-music (make-list (* 4 dur) q))))))
;; shorter rests are just converted into notes without pitches
;; and with a numbered-rest property added
((< dur 1/2) (begin
(ly:music-set-property! m 'name 'NoteEvent)
(ly:music-set-property! m 'types
(append
(delete 'rest-event (ly:music-property m 'types))
'(note-event melodic-event)))
(ly:music-set-property! m 'numbered-rest #t)
(ly:music-set-property! m 'numbered-order 0)
(ly:music-set-property! m 'numbered-chord-size 1)
(ly:music-set-property! m 'pitch (ly:make-pitch 0 0 0))
))
)))
;; CHORD
((music-is-of-type? m 'event-chord)
(let*
(
(note-list (ly:music-property m 'elements))
(chord-size (length note-list))
(order-list (enumerate note-list 0))
)
(begin
(map
(lambda (note order)
(begin
(ly:music-set-property! note 'numbered-order order)
(ly:music-set-property! note 'numbered-chord-size chord-size)
(ly:music-set-property! note 'articulations
(map
(lambda (artic)
(begin
(ly:music-set-property! artic 'numbered-order order)
(ly:music-set-property! artic 'numbered-chord-size chord-size)
artic
)
)
(ly:music-property note 'articulations)
)
)
)
) note-list order-list)
)))
;; NOTE
((music-is-of-type? m 'note-event)
;; handle pitchless note events and transpose pitches to c major
;; which gives us correct accidentals and octaves "for free"
(ly:music-set-property! m 'numbered-order 0)
(ly:music-set-property! m 'numbered-chord-size 1)
(if (ly:pitch? (ly:music-property m 'pitch))
(begin
(ly:music-set-property! m 'pitch
(ly:pitch-transpose (ly:music-property m 'pitch)
(ly:pitch-negate (ly:pitch-diff major-tonic-pitch (ly:make-pitch 0 0 0)))))
(set! prev-pitch (ly:music-property m 'pitch)))
;; else
(ly:music-set-property! m 'pitch prev-pitch))
(let* ((octave (ly:pitch-octave (ly:music-property m 'pitch)))
(octave-dir (if (> octave 0) 1 -1))
(artics (ly:music-property m 'articulations '()))
(dur (ly:moment-main (ly:music-duration-length m))))
;; add octave dot markups as articulations
;; from numbered-ly python script: "-\tweak #'X-offset #0.6 _."
(if (not (= 0 octave))
(ly:music-set-property! m 'articulations
(append artics
(list
(make-articulation 'staccato
'direction octave-dir
'duration dur
'numbered-chord-size 1
'numbered-order 0
'abs-octave (abs octave)
)))))
;; split whole and half notes into quarter notes, some dashed
(if (>= dur 1/2)
(let* ((dash-num (+ -1 (* 4 dur)))
(q-dur (ly:make-duration 2 0 1))
(q (make-music 'NoteEvent
'duration q-dur
'pitch (ly:music-property m 'pitch)
'numbered-dash-note #t)))
(ly:music-set-property! m 'duration q-dur)
(if (= dash-num 5/2)
;; special fix for double-dotted half note
;; TODO: generalize this for triple dots, other durations, etc.?
(let ((q-dotted (ly:music-deep-copy q)))
(ly:music-set-property! q-dotted 'duration (ly:make-duration 2 1 1))
(set! m (make-sequential-music
(append (list m q) (list q-dotted)))))
;; else
(set! m (make-sequential-music
(append (list m) (make-list dash-num q)))))
)))))
m)
mus)
;(display "after modification")(newline)
;(display-scheme-music mus)
)
mus
))
% Note: when checking custom event properties like numbered-rest or
% numbered-key-sig we have to use (if (equal? #t numbered-rest) ...
% and not (if numbered-rest ... the latter results in "false positives".
#(define Numbered_note_head_engraver
(make-engraver
(acknowledgers
((note-head-interface engraver grob source-engraver)
;; make sure \omit is not in effect (stencil is not #f)
(if (ly:grob-property-data grob 'stencil)
(let* ((staff-context (ly:translator-context engraver))
(event (event-cause grob))
(numbered-dash-note (ly:event-property event 'numbered-dash-note)))
;(display-scheme-music event)
(if (equal? #t numbered-dash-note)
(ly:grob-set-property! grob 'stencil
(ly:stencil-translate
(make-connected-path-stencil '((1 0)) 0.3 1 1 #f #f)
(cons 0 -0.5)))
;; else create number stencil based on the scale degree of the note
;; TODO: handle notes without pitches that aren't numbered-rests
(let*
((grob-pitch (ly:event-property event 'pitch))
(note-number
(if (ly:pitch? grob-pitch)
(ly:pitch-notename grob-pitch) #f))
(numbered-rest (ly:event-property event 'numbered-rest))
(numbered-order (ly:event-property event 'numbered-order))
(numbered-offset (- (* numbered-order 3) 1))
(numbered-chord-size (ly:event-property event 'numbered-chord-size))
(glyph-string
;; check numbered-rest first, because apparently
;; sometimes there is a note-number for rests.
(if (equal? #t numbered-rest)
"0"
(if (number? note-number)
(case (+ 1 note-number)
((1) "1")
((2) "2")
((3) "3")
((4) "4")
((5) "5")
((6) "6")
((7) "7")
(else "0"))
#f)))
(note-head (if (> numbered-chord-size 1) (markup #:fontsize 2 #:bold glyph-string) (markup #:fontsize 2 #:bold glyph-string)))
(stl
(if (string? glyph-string)
(grob-interpret-markup grob
note-head))))
(begin
(ly:grob-set-property! grob 'stencil stl)
(ly:grob-set-property! grob 'Y-offset numbered-offset))
))))))))
#(define Numbered_flag_engraver
(make-engraver
(acknowledgers
((flag-interface engraver grob source-engraver)
;; make sure \omit is not in effect (stencil is not #f)
(if (ly:grob-property-data grob 'stencil)
(let* ((glyph-name (ly:grob-property grob 'glyph-name))
(event (event-cause grob))
(padding 0.3)
;; TODO: width is hard-coded, would be better to match note-head width
;; TODO: stencil creation could be coded better
(flag-one (make-connected-path-stencil '((1.4 0)) 0.1 1 1 #f #f))
(flag-two (ly:stencil-stack flag-one Y DOWN flag-one padding 0))
(flag-three (ly:stencil-stack flag-two Y DOWN flag-one padding 0))
(flag-four (ly:stencil-stack flag-three Y DOWN flag-one padding 0))
(flag-five (ly:stencil-stack flag-four Y DOWN flag-one padding 0))
(new-stl (cond
((string= glyph-name "flags.d3") flag-one)
((string= glyph-name "flags.d4") flag-two)
((string= glyph-name "flags.d5") flag-three)
((string= glyph-name "flags.d6") flag-four)
((string= glyph-name "flags.d7") flag-five)
(else empty-stencil))))
; (display-scheme-music event)
; (display glyph-name)
(ly:grob-set-property! grob 'stencil new-stl)
(ly:grob-set-property! grob 'Y-offset -1.3)
;; TODO: are these needed?
;; (ly:grob-set-property! grob 'X-extent
;; (ly:stencil-extent (ly:grob-property grob 'stencil) X))
;; (ly:grob-set-property! grob 'Y-extent
;; (ly:stencil-extent (ly:grob-property grob 'stencil) Y))
))))))
#(define padding 0.3)
#(define (calc-octave-offset direction duration numbered-chord-size numbered-order abs-octave)
(if (and (= direction -1) (= numbered-order 0))
(let* ((logduration (log2 duration))
(descents (min 0 (+ 2 logduration)))
(step 0.4))
(+ -1.8 (* descents step)))
(let* ((fontsize 3)
(step 0.3))
(if (= direction 1)
(+ -2.1 (* fontsize (+ 1 numbered-order)) (* 2 padding abs-octave))
(+ -1.3 (* fontsize numbered-order))
)
)
)
)
#(define Numbered_articulation_engraver
(make-engraver
(acknowledgers
((script-interface engraver grob source-engraver)
;; make sure \omit is not in effect (stencil is not #f)
(if (ly:grob-property-data grob 'stencil)
(let* ((staff-context (ly:translator-context engraver))
(event (event-cause grob))
(articulation-type (ly:event-property event 'articulation-type))
(direction (ly:event-property event 'direction))
(duration (ly:event-property event 'duration))
(numbered-chord-size (ly:event-property event 'numbered-chord-size))
(numbered-order (ly:event-property event 'numbered-order)))
(cond
(
(equal? 'staccato articulation-type)
(let*
(
(padding 0.3)
(abs-octave (ly:event-property event 'abs-octave))
(dot (ly:stencil-translate
(make-circle-stencil 0.15 0.001 #t)
(cons 0.7 0)))
(dot-two (ly:stencil-stack dot Y DOWN dot padding 0))
(dot-three (ly:stencil-stack dot-two Y DOWN dot padding 0))
(dot-four (ly:stencil-stack dot-three Y DOWN dot padding 0))
(stl (case abs-octave
((1) dot)
((2) dot-two)
((3) dot-three)
((4) dot-four)
(else dot-four)
))
)
(begin
; (display-scheme-music event)
(ly:grob-set-property! grob 'stencil stl)
(let ((result (calc-octave-offset direction duration numbered-chord-size numbered-order abs-octave)))
(ly:grob-set-property! grob 'Y-offset result)
;(display direction)(newline)
;(display abs-octave)(newline)
;(display numbered-order)(newline)
;(display result)(newline)
)
)
)
)
(
(equal? "flageolet" articulation-type)
(begin
(ly:grob-set-property! grob 'X-extent '(-0.1 . 0.1))
(ly:grob-set-property! grob 'Y-extent '(-0.1 . 0.1))
)
)
(
(equal? "fermata" articulation-type)
(begin
(ly:grob-set-property! grob 'Y-offset 2)
)
)
)
))))))
#(define Numbered_rest_engraver
(make-engraver
(acknowledgers
((rest-interface engraver grob source-engraver)
;; make sure \omit is not in effect (stencil is not #f)
(if (ly:grob-property-data grob 'stencil)
(let* ((staff-context (ly:translator-context engraver))
(event (event-cause grob)))
;; else create number stencil based on the scale degree of the note
;; TODO: handle notes without pitches that aren't numbered-rests
;(display event)
;(display (ly:event-property event 'type))(newline)
(if (equal? (ly:event-property event 'numbered-rest) #t)
(let*
((grob-pitch (ly:event-property event 'pitch))
(note-number
(if (ly:pitch? grob-pitch)
(ly:pitch-notename grob-pitch) #f))
(numbered-rest (ly:event-property event 'numbered-rest))
(numbered-order (ly:event-property event 'numbered-order))
(numbered-offset (- (* numbered-order 2.3) 1))
(numbered-chord-size (ly:event-property event 'numbered-chord-size))
(glyph-string
;; check numbered-rest first, because apparently
;; sometimes there is a note-number for rests.
(if (equal? #t numbered-rest)
"0"
(if (number? note-number)
(case (+ 1 note-number)
((1) "1")
((2) "2")
((3) "3")
((4) "4")
((5) "5")
((6) "6")
((7) "7")
(else "0"))
#f)))
(note-head (if (> numbered-chord-size 1) (markup #:fontsize 2 #:bold glyph-string) (markup #:fontsize 2 #:bold glyph-string)))
(stl
(if (string? glyph-string)
(grob-interpret-markup grob
note-head))))
(begin
(ly:grob-set-property! grob 'stencil stl)
(ly:grob-set-property! grob 'Y-offset numbered-offset))
))))))))
#(define (numbered-beam-adjust grob)
"Adjusts the width etc. of beams."
;; We calculate the amount to scale based on width of beam
;; TODO: improve this, maybe by using stems
(let* ((x-ext (interval-length (ly:stencil-extent (ly:grob-property grob 'stencil) X)))
(x-scale (+ 1 (/ 1.4 x-ext))))
;; (display x-ext)(newline)
(ly:grob-set-property! grob 'stencil
(ly:stencil-translate
(stencil-flip Y
(ly:stencil-scale
(ly:grob-property grob 'stencil)
;x-scale 1))
1 1))
(cons 0.7 0))
)))
#(define Numbered_key_engraver
(let ((current-key-sig (cons 1 (ly:make-pitch 0 0 0))))
(make-engraver
(acknowledgers
((key-signature-interface engraver grob source-engraver)
;; make sure \omit is not in effect (stencil is not #f)
(if (ly:grob-property-data grob 'stencil)
(let* ((event (event-cause grob))
(numbered-key-sig
(if event
(ly:event-property event 'numbered-key-sig)
current-key-sig))
(tonic-num (car numbered-key-sig))
(tonic-pitch (cdr numbered-key-sig))
(key-sig-number-string (ly:number->string tonic-num))
(key-sig-note
(case (ly:pitch-notename tonic-pitch)
((0) "C")
((1) "D")
((2) "E")
((3) "F")
((4) "G")
((5) "A")
((6) "B")
(else "X")))
(key-sig-alt
(case (ly:pitch-alteration tonic-pitch)
((1/2) #{ \markup \sharp #})
((-1/2) #{ \markup \flat #})
(else ""))))
(set! current-key-sig numbered-key-sig)
(ly:grob-set-property! grob 'stencil
(grob-interpret-markup grob
;; TODO: scale the flat or sharp size, based on current font size
(markup key-sig-number-string "=" key-sig-alt key-sig-note)
)))))))))
% Custom "NumberedStaff" Context
\layout {
\context {
% \Staff lets us start with all standard staff settings
\Staff
% \name gives the custom staff context its name
\name NumberedStaff
% \alias Staff tells LilyPond that commands that work on a standard
% Staff context should also work with this custom context
\alias Staff
% customizations
\consists \Numbered_note_head_engraver
\consists \Numbered_flag_engraver
\consists \Numbered_rest_engraver
% \consists \Numbered_key_engraver
\consists \Numbered_articulation_engraver
\override Beam.after-line-breaking = #numbered-beam-adjust
\override KeySignature.break-visibility = ##(#f #f #f)
\override Accidental.font-size = #-3
\override Accidental.X-offset = #-0.7
\override Accidental.Y-offset = #1
% \override Script.X-offset = #0
% \override Script.Y-offset = #0
\override Clef.stencil = ##f
\override StaffSymbol.line-count = #0
\override BarLine.bar-extent = #'(-2 . 2)
\override BarLine.hair-thickness = #1.5
\override TimeSignature.style = #'numbered
% \override Stem.transparent = ##t
\override Stem.length = #0
\override Stem.length-fraction = #0
\override NoteHead.Y-offset = #0
\override Beam.transparent = ##f
\override Stem.direction = #DOWN
\override Beam.direction = #DOWN
\override Beam.beam-thickness = #0.1
\override Beam.positions = #'(-1.3 . -1.3)
\override Beam.length-fraction = #0.3
\override Tie.staff-position = #2.5
\override TupletBracket.bracket-visibility = ##t
\override StemTremolo.slope = 1
\override StemTremolo.beam-thickness = 0.15
\override StemTremolo.beam-width = 1.0
\override StemTremolo.X-offset = 2.0
\override StemTremolo.Y-offset = -1.5
\override StemTremolo.length-fraction = 0.5
\tupletUp
\slurUp
% \hide Stem
\omit Stem
\override Dots.staff-position = #2
}
% define the "parent" contexts that will accept the custom context
\context { \Score \accepts NumberedStaff }
\context { \ChoirStaff \accepts NumberedStaff }
\context { \GrandStaff \accepts NumberedStaff }
\context { \PianoStaff \accepts NumberedStaff }
\context { \StaffGroup \accepts NumberedStaff }
}
% And for MIDI
% to avoid warnings it has to be defined for each type of output desired
% but we actually can't use midi with the numbered music function, so this
% is rather pointless... leaving it in for now.
\midi {
\context {
\Staff
\name NumberedStaff
\alias Staff
}
% since the customizations are for visual output only,
% there is no need to include them for midi
\context { \Score \accepts NumberedStaff }
\context { \ChoirStaff \accepts NumberedStaff }
\context { \GrandStaff \accepts NumberedStaff }
\context { \PianoStaff \accepts NumberedStaff }
\context { \StaffGroup \accepts NumberedStaff }
}