3 \include "voice-tkit.ly"
6 %% Staff-oriented functions
8 % These assume the following lists have been defined:
9 % voice-prefixes eg "Soprano"
10 % voice-postfixes eg "Music"
11 % lyrics-postfixes eg "Lyrics"
12 % lyrics-names eg "VerseOne"
13 % variable-names eg "Time"
15 % The first three lists are used to generate compound
16 % names such as "SopranoLyrics" and "SopranoInstrumentName"
17 % The last two lists of names are used as-is.
20 make-one-voice-staff =
21 #(define-music-function (show-instrName name clef dynamic-direction)
22 ((boolean? #t) voice-prefix? string? (up-or-down? ""))
24 "Make a staff with one voice (no lyrics)
25 show-instrName: show instrument and short instrument names?
26 name: the default prefix for instrument name and music
27 clef: the clef for this staff
28 dynamic-direction: dynamics are up, down or neither"
30 (define music (make-id name "Music"))
31 (define instrName (make-id name "InstrumentName"))
32 (define shortInstrName (make-id name "ShortInstrumentName"))
33 (define midiName (make-id name "MidiInstrument"))
34 (define dynUp (equal? dynamic-direction "Up"))
35 (define dynDown (equal? dynamic-direction "Down"))
38 \new Staff = #(string-append name "Staff")
40 instrumentName = \markup \smallCaps {
42 (if instrName instrName name)
45 shortInstrumentName = \markup \smallCaps {
48 (shortInstrName shortInstrName)
49 (instrName (substring instrName 0 1))
50 (else (substring name 0 1)))
53 midiInstrument = #(if midiName midiName "clarinet")
57 (else dynamicNeutral))
66 (make-music 'SequentialMusic 'void #t)))
69 make-two-voice-staff =
70 #(define-music-function (name clef v1name v2name)
71 (voice-prefix? string? voice-prefix? voice-prefix?)
73 "Make a vocal staff with two voices
74 name: the prefix to the staff name
76 v1name: the prefix to the name of voice one
77 v2name: the prefix to the name of voice two "
79 (define v1music (make-id v1name "Music"))
80 (define v2music (make-id v2name "Music"))
81 (define instrName (make-id name "InstrumentName"))
82 (define v1InstrName (make-id v1name "InstrumentName"))
83 (define v2InstrName (make-id v2name "InstrumentName"))
84 (define shortInstrName (make-id name "ShortInstrumentName"))
85 (define v1ShortInstrName (make-id v1name "ShortInstrumentName"))
86 (define v2ShortInstrName (make-id v2name "ShortInstrumentName"))
87 (define v1midiName (make-id v1name "MidiInstrument"))
88 (define v2midiName (make-id v2name "MidiInstrument"))
89 (if (or v1music v2music)
92 \new Staff = #(string-append name "Staff")
94 \remove "Staff_performer"
97 #{ \markup \smallCaps #instrName #}
98 #{ \markup \right-column \smallCaps {
100 (if v1InstrName v1InstrName v1name)
103 (if v2InstrName v2InstrName v2name)
106 shortInstrumentName =
108 #{ \markup \smallCaps #shortInstrName #}
109 #{ \markup \right-column \smallCaps {
112 (v1ShortInstrName v1ShortInstrName)
113 (v1InstrName (substring v1InstrName 0 1))
114 (else (substring v1name 0 1)))
118 (v2ShortInstrName v2ShortInstrName)
119 (v2InstrName (substring v2InstrName 0 1))
120 (else (substring v2name 0 1)))
130 \new Voice = #(string-append v1name "Voice")
132 \consists "Staff_performer"
135 #(if v1midiName v1midiName "clarinet")
138 #(if KeepAlive KeepAlive)
140 #(if v2music voiceOne oneVoice)
147 \new Voice = #(string-append v2name "Voice")
149 \consists "Staff_performer"
152 #(if v2midiName v2midiName "clarinet")
155 #(if KeepAlive KeepAlive)
157 #(if v1music voiceTwo oneVoice)
164 (make-music 'SequentialMusic 'void #t)))