Les Horaces : suggestion nuances 2-1
[nenuvar.git] / common / staff.ily
blobd33e3100898d4f22db3d4f9870162f4916a6c179
1 #(use-modules (ice-9 format))
2 #(define-public gen-unique-context
3   ;; Generate a uniqueSchemeContextXX symbol, that may be (hopefully) unique.
4   (let ((var-idx -1))
5     (lambda ()
6       (set! var-idx (1+ var-idx))
7       (string->symbol
8        (format #f "uniqueSchemeContext~a"
9                (list->string (map (lambda (chr)
10                                     (integer->char (+ (char->integer #\a)
11                                                       (- (char->integer chr)
12                                                          (char->integer #\0)))))
13                                   (string->list (number->string var-idx)))))))))
15 haraKiri = \with {
16   \override VerticalAxisGroup.remove-empty = ##t
17   \override VerticalAxisGroup.remove-first = ##f
20 haraKiriFirst = \with {
21   \override VerticalAxisGroup.remove-empty = ##t
22   \override VerticalAxisGroup.remove-first = ##t
25 tinyStaff = \with {
26   \override StaffSymbol #'staff-space = #(magstep -2)
27   fontSize = #-2
30 smallStaff = \with {
31   \override StaffSymbol #'staff-space = #(magstep -1)
32   fontSize = #-1
35 staffSize =
36 #(define-music-function (parser location size) (number?)
37    #{ \override Staff.StaffSymbol #'staff-space = $(magstep size)
38       \set Staff.fontSize = $size #})
40 withLyrics =
41 #(define-music-function (parser location music lyrics) (ly:music? ly:music?)
42    (let ((name (symbol->string (gen-unique-context))))
43      #{  << \context Voice = $name \with { autoBeaming = ##f } $music
44             \new Lyrics \lyricsto #name { #lyrics }
45             >> #}))
47 withLyricsB =
48 #(define-music-function (parser location music lyrics1 lyrics2) (ly:music? ly:music? ly:music?)
49    (let ((name (symbol->string (gen-unique-context))))
50      #{  << \context Voice = $name \with { autoBeaming = ##f } $music
51             \new Lyrics \lyricsto #name { #lyrics1 }
52             \new Lyrics \lyricsto #name { #lyrics2 }
53             >> #}))
55 withRecit =
56 #(define-music-function (parser location music lyrics) (ly:music? ly:music?)
57    (let ((name (symbol->string (gen-unique-context))))
58      #{  << \context Voice = $name \with { autoBeaming = ##f } <<
59             \set Staff . explicitClefVisibility = #end-of-line-invisible
60             \override Staff . Clef #'full-size-change = ##t
61             %%\override Staff . Clef #'break-visibility = #end-of-line-invisible
62             \override Score.BreakAlignment #'break-align-orders =
63             ##(; end-of-line:
64                (instrument-name left-edge ambitus breathing-sign
65                 clef key-cancellation key-signature
66                 time-signature custos staff-bar)
67                ; unbroken
68                (instrument-name left-edge ambitus breathing-sign
69                 staff-bar clef key-cancellation key-signature
70                 staff time-signature custos)
71                ; begin of line
72                (instrument-name left-edge ambitus breathing-sign
73                 clef key-cancellation key-signature staff-bar
74                 time-signature custos))
75             $music >>
76             \new Lyrics \lyricsto #name { #lyrics }
77           >> #}))
79 newHaraKiriStaff =
80 #(define-music-function (parser location music) (ly:music?)
81    (make-music
82     'ContextSpeccedMusic
83     'create-new #t
84     'property-operations '((push VerticalAxisGroup #t remove-empty)
85                            (push VerticalAxisGroup #f remove-first))
86     'context-type 'Staff
87     'element music))
89 newTinyHaraKiriStaff =
90 #(define-music-function (parser location music) (ly:music?)
91    (make-music
92     'ContextSpeccedMusic
93     'create-new #t
94     'property-operations `((push VerticalAxisGroup #t remove-empty)
95                            (push VerticalAxisGroup #f remove-first)
96                            (remove "Page_turn_engraver")
97                            (push StaffSymbol ,(magstep -2) staff-space)
98                            (assign fontSize -2))
99     'context-type 'Staff
100     'element music))
102 newSmallHaraKiriStaff =
103 #(define-music-function (parser location music) (ly:music?)
104    (make-music
105     'ContextSpeccedMusic
106     'create-new #t
107     'property-operations `((push VerticalAxisGroup #t remove-empty)
108                            (push VerticalAxisGroup #f remove-first)
109                            (remove "Page_turn_engraver")
110                            (push StaffSymbol ,(magstep -1) staff-space)
111                            (assign fontSize -1))
112     'context-type 'Staff
113     'element music))
115 newHaraKiriStaffB =
116 #(define-music-function (parser location music) (ly:music?)
117    (make-music
118     'ContextSpeccedMusic
119     'create-new #t
120     'property-operations '((push VerticalAxisGroup #t remove-empty)
121                            (push VerticalAxisGroup #t remove-first))
122     'context-type 'Staff
123     'element music))
125 newTinyHaraKiriStaffB =
126 #(define-music-function (parser location music) (ly:music?)
127    (make-music
128     'ContextSpeccedMusic
129     'create-new #t
130     'property-operations `((push VerticalAxisGroup #t remove-empty)
131                            (push VerticalAxisGroup #t remove-first)
132                            (remove "Page_turn_engraver")
133                            (push StaffSymbol ,(magstep -2) staff-space)
134                            (assign fontSize -2))
135     'context-type 'Staff
136     'element music))
138 newSmallHaraKiriStaffB =
139 #(define-music-function (parser location music) (ly:music?)
140    (make-music
141     'ContextSpeccedMusic
142     'create-new #t
143     'property-operations `((push VerticalAxisGroup #t remove-empty)
144                            (push VerticalAxisGroup #t remove-first)
145                            (remove "Page_turn_engraver")
146                            (push StaffSymbol ,(magstep -1) staff-space)
147                            (assign fontSize -1))
148     'context-type 'Staff
149     'element music))
151 newSmallStaff = 
152 #(define-music-function (parser location music) (ly:music?)
153    #{ \new Staff \with {
154         fontSize = #-1
155         \override StaffSymbol #'staff-space = #(magstep -1)
156       } << $music >> #})
158 newTinyStaff = 
159 #(define-music-function (parser location music) (ly:music?)
160    #{ \new Staff \with {
161         fontSize = #-2
162         \override StaffSymbol #'staff-space = #(magstep -2)
163         \remove "Page_turn_engraver"
164       } << $music >> #})
166 dessusHauteContreTailleQuinteBasse =
167 #(define-music-function (parser location) ()
168   #{ \new StaffGroup <<
169     \new Staff << \global \clef "dessus" \includeNotes "dessus" >>
170     \new Staff << \global \clef "haute-contre" \includeNotes "haute-contre" >>
171     \new Staff << \global \clef "taille" \includeNotes "taille" >>
172     \new Staff << \global \clef "quinte" \includeNotes "quinte" >>
173     \new Staff << \global \clef "basse" \includeNotes "basse" >>
174   >> #})
176 dessusHauteContreTailleBasse =
177 #(define-music-function (parser location) ()
178   #{ \new StaffGroup <<
179     \new Staff << \global \clef "dessus" \includeNotes "dessus" >>
180     \new Staff << \global \clef "haute-contre" \includeNotes "haute-contre" >>
181     \new Staff << \global \clef "taille" \includeNotes "taille" >>
182     \new Staff << \global \clef "basse" \includeNotes "basse" >>
183   >> #})