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 {
47 shortInstrumentName = \markup \smallCaps {
52 #{ #(substring instrName 0 1) #}
53 #{ #(substring name 0 1) #} ))
64 #{ \dynamicNeutral #} ))
72 (make-music 'SequentialMusic 'void #t)))
75 make-two-voice-staff =
76 #(define-music-function (name clef v1name v2name)
77 (voice-prefix? string? voice-prefix? voice-prefix?)
79 "Make a vocal staff with two voices
80 name: the prefix to the staff name
82 v1name: the prefix to the name of voice one
83 v2name: the prefix to the name of voice two "
85 (define v1music (make-id v1name "Music"))
86 (define v2music (make-id v2name "Music"))
87 (define instrName (make-id name "InstrumentName"))
88 (define v1InstrName (make-id v1name "InstrumentName"))
89 (define v2InstrName (make-id v2name "InstrumentName"))
90 (define shortInstrName (make-id name "ShortInstrumentName"))
91 (define v1ShortInstrName (make-id v1name "ShortInstrumentName"))
92 (define v2ShortInstrName (make-id v2name "ShortInstrumentName"))
93 (define v1midiName (make-id v1name "MidiInstrument"))
94 (define v2midiName (make-id v2name "MidiInstrument"))
95 (if (or v1music v2music)
98 \new Staff = #(string-append name "Staff")
100 \remove "Staff_performer"
103 #{ \markup \smallCaps #instrName #}
104 #{ \markup \right-column \smallCaps {
115 shortInstrumentName =
117 #{ \markup \smallCaps #shortInstrName #}
118 #{ \markup \right-column \smallCaps {
123 (substring v1InstrName 0 1)
124 (substring v1name 0 1)))
130 (substring v2InstrName 0 1)
131 (substring v2name 0 1)))
135 #(if Key #{ \Key #} )
140 \new Voice = #(string-append v1name "Voice")
142 \consists "Staff_performer"
150 #(if KeepAlive #{ \KeepAlive #} )
151 #(if Time #{ \Time #} )
152 #(if v2music #{ \voiceOne #} #{ \oneVoice #} )
159 \new Voice = #(string-append v2name "Voice")
161 \consists "Staff_performer"
169 #(if KeepAlive #{ \KeepAlive #} )
170 #(if Time #{ \Time #} )
171 #(if v1music #{ \voiceTwo #} #{ \oneVoice #} )
178 (make-music 'SequentialMusic 'void #t)))