Fix problem in clef definition for Tr
[orchestrallily.git] / orchestrallily.ly
blob75026e3fb2faab05dddeb8c77e9c93568b598f9e
1 \version "2.11.41"
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 % OrchestralLily
5 % ==============
6 % Desciption: Lilypond package to make writing large orchestral scores easier.
7 % Documentation: http://wiki.kainhofer.com/lilypond/orchestrallily
8 % Version: 0.02, 2008-03-06
9 % Author: Reinhold Kainhofer, reinhold@kainhofer.com
10 % Copyright: (C) 2008 by Reinhold Kainhofer
11 % License: GPL v3.0, http://www.gnu.org/licenses/gpl.html
13 % Version History:
14 % 0.01 (2008-03-02): Initial Version
15 % 0.02 (2008-03-06): Added basic MIDI support (*MidiInstrument and \setCreateMIDI)
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18 #(use-modules (ice-9 match))
21 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 %%%%% SCORE STRUCTURE AND AUTOMATIC GENERATION
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 % Helper functions
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 % Helper function to filter all non-null entries
35 #(define (not-null? x) (not (null? x)))
37 % Helper function to extract a given variable, built from [Piece][Instrument]Identifier
38 #(define (namedPieceInstrObject piece instr name)
39 (let* (
40 (fullname (string->symbol (string-append piece instr name)))
41 (instrname (string->symbol (string-append instr name)))
42 (piecename (string->symbol (string-append piece name)))
44 (cond
45 ((defined? fullname) (primitive-eval fullname))
46 ((defined? instrname) (primitive-eval instrname))
47 ((defined? piecename) (primitive-eval piecename))
48 (else '())
53 %% Print text as a justified paragraph, taken from the lilypond Notation Reference
54 #(define-markup-list-command (paragraph layout props args) (markup-list?)
55 (let ((indent (chain-assoc-get 'par-indent props 2)))
56 (interpret-markup-list layout props
57 (make-justified-lines-markup-list (cons (make-hspace-markup indent)
58 args)))))
60 conditionalBreak = #(define-music-function (parser location) ()
61 #{ \tag #'instrumental-score \pageBreak #}
64 #(define (oly:piece-title-markup title) (markup #:column (#:line (#:fontsize #'3 #:bold title))) )
66 #(define-markup-command (piece-title layout props title) (markup?)
67 (interpret-markup layout props (oly:piece-title-markup title))
70 #(define (oly:generate_object_name piece instr obj )
71 (if (and (string? piece) (string? instr) (string? obj))
72 (string-append piece instr obj)
76 #(define (oly:generate_staff_name piece instr) (oly:generate_object_name piece instr "St"))
78 #(define (set-context-property context property value)
79 (set! (ly:music-property context property) value)
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84 % Score structure and voice types
85 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87 #(define oly:orchestral_score_structure '())
89 #(define (oly:set_score_structure struct)
90 (if (list? struct)
91 (set! oly:orchestral_score_structure struct)
92 (ly:warning (_ "oly:set_score_structure needs an association list as argument!"))
96 orchestralScoreStructure = #(define-music-function (parser location structure) (list?)
97 (oly:set_score_structure structure)
98 (make-music 'Music 'void #t)
101 #(define oly:voice_types '())
103 #(define (oly:set_voice_types types)
104 (if (list? types)
105 (set! oly:voice_types types)
106 (ly:warning (_ "oly:set_voice_types needs an association list as argument!"))
110 orchestralVoiceTypes = #(define-music-function (parser location types) (list?)
111 (oly:set_voice_types types)
112 (make-music 'Music 'void #t)
116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
117 % Automatic staff and group generation
118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120 % Retrieve all music definitions for the given
121 #(define (oly:get_music_object piece instrument)
122 (namedPieceInstrObject piece instrument "Music")
124 #(define (oly:get_music_objects piece instruments)
125 (filter not-null? (map (lambda (i) (oly:get_music_object piece i)) instruments))
128 % Given a property name and the extensions, either generate the pair to set
129 % the property or an empty list, if no pre-defined variable could be found
130 #(define (oly:generate_property_pair prop piece instr type)
131 (let* ((val (namedPieceInstrObject piece instr type)))
132 (if (not-null? val) (list 'assign prop val) '() )
136 #(define (oly:staff_type type)
137 (cond
138 ((string? type) (string->symbol type))
139 ((symbol? type) type)
140 (else 'Staff)
144 #(define (oly:extractPitch music)
145 (let* (
146 (elems (if (ly:music? music) (ly:music-property music 'elements)))
147 (note (if (pair? elems) (car elems)))
148 (pitch (if (ly:music? note) (ly:music-property note 'pitch)))
150 (if (and (not-null? music) (not (ly:pitch? pitch)))
151 (ly:warning "Unable to interpret as a pitch!")
153 pitch
157 #(define (oly:extractTranspositionPitch piece name)
158 (let* (
159 (trpFromPitch (oly:extractPitch (namedPieceInstrObject piece name "TransposeFrom")))
160 (trpToPitch (oly:extractPitch (namedPieceInstrObject piece name "TransposeTo")))
162 (if (ly:pitch? trpFromPitch)
163 (if (ly:pitch? trpToPitch)
164 ; Both pitches
165 (ly:pitch-diff trpFromPitch trpToPitch)
166 (ly:pitch-diff trpFromPitch (ly:make-pitch 0 0 0))
168 (if (ly:pitch? trpToPitch)
169 (ly:pitch-diff (ly:make-pitch 0 0 0) trpToPitch)
176 #(define (oly:voice_handler_internal parser piece name type music)
177 (let* (
178 (tempo (namedPieceInstrObject piece name "Tempo"))
179 (lyrics (namedPieceInstrObject piece name "Lyrics"))
180 (trpPitch (oly:extractTranspositionPitch piece name))
181 (musiccontent '())
184 (if (ly:music? lyrics)
185 (set! musiccontent (append musiccontent (list dynamicUp)))
186 (if (not-null? lyrics) (ly:warning (_ "Wrong type (no lyrics) for lyrics for instrument ~S in piece ~S") name piece))
188 ; Append the settings, key and clef (if defined)
189 (map
190 (lambda (type)
191 (let* ((object (namedPieceInstrObject piece name type)))
192 (if (ly:music? object)
193 (set! musiccontent (append musiccontent (list object)))
194 (if (not-null? object) (ly:warning (_ "Wrong type (no ly:music) for ~S for instrument ~S in piece ~S") type name piece))
198 '("Settings" "Key" "Clef" "TimeSignature")
201 (if (ly:music? music)
202 (begin
203 (set! musiccontent (make-simultaneous-music (append musiccontent (list music))))
204 ;(ly:message "Generating staff for ~a" name)
205 (if (ly:pitch? trpPitch)
206 (set! musiccontent (ly:music-transpose musiccontent trpPitch))
209 (let* (
210 (voicename (oly:generate_object_name piece name "Voice" ))
211 (voicetype (oly:staff_type type))
212 (voice (context-spec-music musiccontent voicetype voicename))
213 (staffcont (list voice))
215 ; If we have lyrics, create a lyrics context containing LyricCombineMusic
216 ; and add that as second element to the staff's elements list...
217 (if (ly:music? lyrics)
218 (let* (
219 (lyricsname (oly:generate_object_name piece name "Lyrics" ))
220 (lyricscont (make-music 'LyricCombineMusic 'element lyrics 'associated-context voicename))
222 (set! staffcont (append staffcont
223 (list (context-spec-music lyricscont 'Lyrics lyricsname))))
226 staffcont
229 ; For empty music, return empty
235 #(define (oly:voice_handler parser piece name type)
236 (let* ((music (oly:get_music_object piece name))
238 (oly:voice_handler_internal parser piece name type music)
243 #(define (oly:staff_handler_internal parser piece name type voices)
244 (if (not-null? voices)
245 (let* (
246 (staffname (oly:generate_staff_name piece name))
247 (stafftype (oly:staff_type type))
248 (staff (make-simultaneous-music voices))
249 (propops (oly:staff_handler_properties piece name))
251 (case stafftype
252 ((SimultaneousMusic ParallelMusic) #f)
253 (else (set! staff (context-spec-music staff stafftype staffname)))
255 (if (not-null? propops)
256 (set! (ly:music-property staff 'property-operations) propops)
258 staff
260 ; For empty music, return empty
265 #(define (oly:staff_handler parser piece name type children)
266 (let* ((c (if (not-null? children) children (list name)))
267 (voices (apply append (map (lambda (v) (oly:create_voice parser piece v)) c)) )
269 (if (not-null? voices)
270 (oly:staff_handler_internal parser piece name type voices)
276 #(define (oly:parallel_voices_staff_handler parser piece name type children)
277 (let* (
278 (voices (map (lambda (i) (oly:create_voice parser piece i)) children))
279 ; get the lsit of non-empty voices and flatten it!
280 (nonemptyvoices (apply append (filter not-null? voices)))
282 (if (not-null? nonemptyvoices)
283 (oly:staff_handler_internal parser piece name "Staff" nonemptyvoices)
289 #(define (oly:part_combined_staff_handler parser piece name type children)
290 (let* ((music (oly:get_music_objects piece children)))
291 (cond
292 ((and (pair? music) (ly:music? (car music)) (not-null? (cdr music)) (ly:music? (cadr music)))
293 ;(ly:message "Part-combine with two music expressions")
294 (oly:staff_handler_internal parser piece name "Staff" (list (make-part-combine-music parser music))))
295 ((null? music)
296 (ly:warning "Part-combine without any music expressions")
297 '())
298 ; exactly one is a music expression, simply use that by joining
299 ((list? music)
300 (ly:message "Part-combine with only one music expressions")
301 (oly:staff_handler_internal parser piece name "Staff" (list (apply append music))))
302 (else
303 ;(ly:message "make_part_combined_staff: ~S ~S ~a" piece instr instruments)
304 '() )
309 % Generate the properties for the staff for piece and instr. Typically, these
310 % are the instrument name and the short instrument name (if defined).
311 % return a (possibly empty) list of all assignments.
312 #(define (oly:staff_handler_properties piece instr)
313 (let* (
314 (mapping '(
315 (instrumentName . "InstrumentName")
316 (shortInstrumentName . "ShortInstrumentName")
317 (midiInstrument . "MidiInstrument")
319 (assignments (map
320 (lambda (pr)
321 (oly:generate_property_pair (car pr) piece instr (cdr pr))
323 mapping))
324 (props (filter not-null? assignments))
326 props
330 % Figured bass is a special case, as it can be voice- or staff-type. When
331 % given as a staff type, simply call the voice handler, instead
333 #(define (oly:figured_bass_staff_handler parser piece name type children)
334 (let* ((c (if (not-null? children) children (list name)))
335 (voice (oly:voice_handler parser piece (car c) type)))
336 (if (pair? voice) (car voice) ())
341 #(define (oly:staff_group_handler parser piece name type children)
342 (let* (
343 (staves (map (lambda (i) (oly:create_staff_or_group parser piece i)) children))
344 (nonemptystaves (filter not-null? staves))
346 (if (not-null? nonemptystaves)
347 (let* (
348 (musicexpr (if (= 1 (length nonemptystaves))
349 (car nonemptystaves)
350 (make-simultaneous-music nonemptystaves)))
351 (groupname (oly:generate_staff_name piece name))
352 (grouptype (oly:staff_type type))
353 (group musicexpr)
354 (propops (oly:staff_handler_properties piece name))
356 (case grouptype
357 ((SimultaneousMusic ParallelMusic) #f)
358 (else (set! group (context-spec-music group grouptype groupname)))
360 (set! (ly:music-property group 'property-operations) propops)
361 group
363 ; Return empty list if no staves are generated
369 #(define oly:staff_handlers
370 (list
371 ; staff group types
372 '("GrandStaff" . oly:staff_group_handler )
373 '("PianoStaff" . oly:staff_group_handler )
374 '("ChoirStaff" . oly:staff_group_handler )
375 '("StaffGroup" . oly:staff_group_handler )
376 '("InnerChoirStaff" . oly:staff_group_handler )
377 '("InnerStaffGroup" . oly:staff_group_handler )
378 '("ParallelMusic" . oly:staff_group_handler )
379 '("SimultaneousMusic" . oly:staff_group_handler )
380 ; staff types
381 '("Staff" . oly:staff_handler )
382 '("DrumStaff" . oly:staff_handler )
383 '("RhythmicStaff" . oly:staff_handler )
384 '("TabStaff" . oly:staff_handler )
385 '("GregorianTranscriptionStaff" . oly:staff_handler )
386 '("MensuralStaff" . oly:staff_handler )
387 '("VaticanaStaff" . oly:staff_handler )
388 ; staves with multiple voices
389 '("PartCombinedStaff" . oly:part_combined_staff_handler )
390 '("ParallelVoicesStaff" . oly:parallel_voices_staff_handler )
391 ; special cases: Figured bass can be staff or voice type!
392 '("FiguredBass" . oly:figured_bass_staff_handler )
396 #(define oly:voice_handlers
397 (list
398 ; voice types
399 '("Voice" . oly:voice_handler )
400 '("CueVoice" . oly:voice_handler )
401 '("DrumVoice" . oly:voice_handler )
402 '("FiguredBass" . oly:voice_handler )
403 '("GregorianTranscriptionVoice" . oly:voice_handler )
404 '("NoteNames" . oly:voice_handler )
405 '("TabVoice" . oly:voice_handler )
406 '("VaticanaVoice" . oly:voice_handler )
407 ;'("Dynamics" . oly:dynamics_handler )
411 #(define (oly:create_voice parser piece name)
412 (let* ( (voice (namedPieceInstrObject piece name "Voice"))
413 (type (assoc-ref oly:voice_types name)) )
414 (if (not-null? voice)
415 ; Explicit voice variable, use that
416 voice
418 (if (not type)
419 ; No entry in structure found => simple voice
420 (oly:voice_handler parser piece name "Voice")
421 ; Entry found in structure => use the handler for the given type
422 (let* (
423 (voicetype (car type))
424 (handler (assoc-ref oly:voice_handlers voicetype))
426 (if handler
427 ((primitive-eval handler) parser piece name voicetype)
428 (begin
429 (ly:warning "No handler found for voice type ~a, using default voice handler" voicetype)
430 (oly:voice_handler parser piece name voicetype)
439 #(define (oly:create_staff_or_group parser piece name)
440 (let* ( (staff (namedPieceInstrObject piece name "Staff"))
441 (type_from_structure (assoc-ref oly:orchestral_score_structure name)) )
442 ;(if (not-null? staff)
443 ; (ly:message "Found staff variable for instrument ~a in piece ~a" instr piece)
444 ; (ly:message "Staff variable for instrument ~a in piece ~a NOT FOUND" instr piece)
446 (if (not-null? staff)
447 ; Explicit staff variable, use that
448 staff
450 (if (not (list? type_from_structure))
451 ; No entry in structure found => simple staff
452 (oly:staff_handler parser piece name "Staff" '())
454 ; Entry found in structure => use the handler for the given type
455 (let* ((type (car type_from_structure))
456 (handler (assoc-ref oly:staff_handlers type))
457 (children (cadr type_from_structure))
459 (if handler
460 ((primitive-eval handler) parser piece name type children)
461 (begin
462 (ly:warning "No handler found for staff type ~a, using default staff handler" type)
463 (oly:staff_handler parser piece name type children)
472 #(define (oly:register_staff_type_handler type func)
473 ; (ly:message "Registering staff handler ~a for type ~a" func type)
474 (set! oly:staff_handlers (assoc-set! oly:staff_handlers type func))
477 #(define (oly:register_voice_type_handler type func)
478 ; (ly:message "Registering voice type handler ~a for type ~a" func type)
479 (set! oly:voice_handlers (assoc-set! oly:voice_handlers type func))
482 % handlers for deprecated API
483 #(oly:register_staff_type_handler 'StaffGroup 'oly:staff_group_handler)
484 #(oly:register_staff_type_handler 'ParallelMusic 'oly:staff_group_handler)
487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
488 % Automatic score generation
489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
491 % \setUseBook ##t/##f sets a flag to determine whether the calls to createScore
492 % are from within a book block or not
493 % #(define oly:score_handler collect-scores-for-book)
494 #(define oly:score_handler toplevel-score-handler)
495 #(define oly:music_handler toplevel-music-handler)
496 #(define oly:text_handler toplevel-text-handler)
498 setUseBook = #(define-music-function (parser location usebook) (boolean?)
499 (if usebook
500 (begin
501 (set! oly:score_handler book-score-handler)
502 (set! oly:music_handler book-music-handler)
503 (set! oly:text_handler book-text-handler)
505 (begin
506 (set! oly:score_handler toplevel-score-handler)
507 (set! oly:music_handler toplevel-music-handler)
508 (set! oly:text_handler toplevel-text-handler)
511 (make-music 'Music 'void #t)
515 % Two functions to handle midi-blocks: Either don't set one, or set an empty
516 % one so that MIDI is generated
517 #(define (oly:set_no_midi_block score) '())
518 #(define (oly:set_midi_block score)
519 (let* ((midiblock (if (defined? '$defaultmidi)
520 (ly:output-def-clone $defaultmidi)
521 (ly:make-output-def))))
522 (ly:output-def-set-variable! midiblock 'is-midi #t)
523 (ly:score-add-output-def! score midiblock)
527 % \setCreateMidi ##t/##f sets a flag to determine wheter MIDI output should
528 % be generated
529 #(define oly:apply_score_midi oly:set_no_midi_block)
530 setCreateMIDI = #(define-music-function (parser location createmidi) (boolean?)
531 (if createmidi
532 (set! oly:apply_score_midi oly:set_midi_block)
533 (set! oly:apply_score_midi oly:set_no_midi_block)
535 (make-music 'Music 'void #t)
539 % Two functions to handle layout-blocks: Either don't set one, or set an empty
540 % one so that a PDF is generated
541 #(define (oly:set_no_layout_block score) '())
542 #(define (oly:set_layout_block score)
543 (let* ((layoutblock (if (defined? '$defaultlayout)
544 (ly:output-def-clone $defaultlayout)
545 (ly:make-output-def))))
546 (ly:output-def-set-variable! layoutblock 'is-layout #t)
547 (ly:score-add-output-def! score layoutblock)
551 % \setCreatePDF ##t/##f sets a flag to determine wheter PDF output should
552 % be generated
553 #(define oly:apply_score_layout oly:set_no_layout_block)
554 setCreatePDF = #(define-music-function (parser location createlayout) (boolean?)
555 (if createlayout
556 (set! oly:apply_score_layout oly:set_layout_block)
557 (set! oly:apply_score_layout oly:set_no_layout_block)
559 (make-music 'Music 'void #t)
563 % Set the piece title in a new header block.
564 #(define (oly:set_piece_header score piecename)
565 (if (not-null? piecename)
566 (let* ((header (make-module)))
567 (module-define! header 'piece piecename)
568 (ly:score-set-header! score header)
574 % post-filter functions. By default, no filtering is done. However,
575 % for the *NoCues* function, the cue notes should be killed
576 identity = #(define-music-function (parser location music) (ly:music?) music)
577 cuefilter = #(define-music-function (parser location music) (ly:music?)
578 ((ly:music-function-extract removeWithTag) parser location 'cued ((ly:music-function-extract killCues) parser location music))
581 #(define-public (oly:add-toc-item parser markup-symbol text)
582 (oly:music_handler parser (add-toc-item! markup-symbol text)))
585 #(define (oly:add-score parser score piecename)
586 (if (not-null? piecename)
587 (oly:add-toc-item parser 'tocItemMarkup piecename))
588 (oly:score_handler parser score)
590 % The helper function to build a score.
591 #(define (oly:createScoreHelper parser location piece children func)
592 (let* (
593 (staves (oly:staff_group_handler parser piece "" "SimultaneousMusic" children))
594 (music (if (not-null? staves)
595 ((ly:music-function-extract func) parser location staves)
598 (score '())
599 (piecename (namedPieceInstrObject piece (car children) "PieceName"))
600 (piecenametacet (namedPieceInstrObject piece (car children) "PieceNameTacet"))
601 (header '())
603 (if (null? music)
604 ; No staves, print tacet
605 (begin
606 (if (not-null? piecenametacet) (set! piecename piecenametacet))
607 (if (not-null? piecename)
608 (oly:add-score parser (list (oly:piece-title-markup piecename)) piecename)
609 (ly:warning (_ "No music and no score title found for part ~a and instrument ~a") piece children)
612 ; we have staves, apply the piecename to the score and add layout/midi blocks if needed
613 (begin
614 (set! score (scorify-music music parser))
615 (oly:set_piece_header score piecename)
616 (oly:apply_score_midi score)
617 (oly:apply_score_layout score)
618 ; Schedule the score for typesetting
619 (oly:add-score parser score piecename)
623 ; This is a void function, the score has been schedulled for typesetting already
624 (make-music 'Music 'void #t)
627 createScore = #(define-music-function (parser location piece children) (string? list?)
628 (oly:createScoreHelper parser location piece children identity)
630 createNoCuesScore = #(define-music-function (parser location piece children) (string? list?)
631 (oly:createScoreHelper parser location piece children cuefilter)
634 createHeadline = #(define-music-function (parser location headline) (string?)
635 (oly:add-toc-item parser 'tocItemMarkup headline)
636 (oly:score_handler parser (list (oly:piece-title-markup headline)))
637 (make-music 'Music 'void #t)
642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
644 %%%%% CUE NOTES
645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
648 % set the cue instrument name
649 setCue = #(define-music-function (parser location instr) (string?)
650 #{ \set Voice.instrumentCueName = $instr #} )
652 % generate a cue music section with instrument names
653 % Parameters: \namedCueDuring NameOfQuote CueDirection CueInstrument OriginalInstrument music
654 % -) NameOfQuote CueDirection music are the parameters for \cueDuring
655 % -) CueInstrument and OriginalInstrument are the displayed instrument names
656 % typical call:
657 % \namedCueDuring #"vIQuote" #UP #"V.I" #"Sop." { R1*3 }
658 % This adds the notes from vIQuote (defined via \addQuote) to three measures, prints "V.I" at
659 % the beginning of the cue notes and "Sop." at the end
660 namedCueDuring = #(define-music-function (parser location cuevoice direction instrcue instr cuemusic) (string? number? string? string? ly:music?)
662 \cueDuring #$cuevoice #$direction { \tag #'cued \setCue #$instrcue $cuemusic \tag #'cued \setCue #$instr }
663 % \tag #'uncued $cuemusic
666 namedTransposedCueDuring = #(define-music-function (parser location cuevoice direction instrcue instr trans cuemusic) (string? number? string? string? ly:music? ly:music?)
668 \transposedCueDuring #$cuevoice #$direction $trans { \tag #'cued \setCue #$instrcue $cuemusic \tag #'cued \setCue #$instr }
669 % \tag #'uncued $cuemusic
673 % set the cue instrument name and clef
674 setClefCue = #(define-music-function (parser location instr clef)
675 (string? ly:music?)
677 \once \override Staff.Clef #'font-size = #-3 $clef
678 \set Voice.instrumentCueName = $instr
679 #} )
681 % generate a cue music section with instrument names and clef changes
682 % Parameters: \cleffedCueDuring NameOfQuote CueDirection CueInstrument CueClef OriginalInstrument OriginalClef music
683 % -) NameOfQuote CueDirection music are the parameters for \cueDuring
684 % -) CueInstrument and OriginalInstrument are the displayed instrument names
685 % -) CueClef and OriginalClef are the clefs for the the cue notes and the clef of the containing voice
686 % typical call:
687 % \cleffedCueDuring #"vIQuote" #UP #"V.I" #"treble" #"Basso" #"bass" { R1*3 }
688 % This adds the notes from vIQuote (defined via \addQuote) to three measures, prints "V.I" at
689 % the beginning of the cue notes and "Basso" at the end. The clef is changed to treble at the
690 % beginning of the cue notes and reset to bass at the end
691 cleffedCueDuring = #(define-music-function (parser location cuevoice direction instrcue clefcue instr clefinstr cuemusic)
692 (string? number? string? ly:music? string? ly:music? ly:music?)
694 \cueDuring #$cuevoice #$direction { \tag #'cued \setClefCue #$instrcue $clefcue $cuemusic \tag #'cued \setClefCue #$instr $clefinstr }
695 % \tag #'uncued $cuemusic
702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
704 %%%%% DYNAMICS
705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
708 tempoMark = #(define-music-function (parser location padding marktext) (number? string?)
710 \once \override Score . RehearsalMark #'padding = $padding
711 \mark \markup { \bold \smaller $marktext }
714 shiftDynamics = #(define-music-function (parser location xshift yshift) (number? number?)
716 \once \override DynamicTextSpanner #'padding = $yshift
717 \once\override DynamicText #'extra-offset = #(cons $xshift $yshift)
720 ffz = #(make-dynamic-script "ffz")
721 pf = #(make-dynamic-script "pf")
722 sempp = #(make-dynamic-script (markup #:line( #:with-dimensions '(0 . 0)
723 '(0 . 0) #:right-align #:normal-text #:italic "sempre" #:dynamic "pp")))
724 parenf = #(make-dynamic-script (markup #:line(#:normal-text #:italic #:fontsize 2 "(" #:dynamic "f" #:normal-text #:italic #:fontsize 2 ")" )))
725 parenp = #(make-dynamic-script (markup #:line(#:normal-text #:italic #:fontsize 2 "(" #:dynamic "p" #:normal-text #:italic #:fontsize 2 ")" )))
729 dim = #(make-span-event 'DecrescendoEvent START)
730 enddim = #(make-span-event 'DecrescendoEvent STOP)
731 decresc = #(make-span-event 'DecrescendoEvent START)
732 enddecresc = #(make-span-event 'DecrescendoEvent STOP)
733 cresc = #(make-span-event 'CrescendoEvent START)
734 endcresc = #(make-span-event 'CrescendoEvent STOP)
736 setCresc = {
737 \set crescendoText = \markup { \italic "cresc." }
738 \set crescendoSpanner = #'text
739 \override DynamicTextSpanner #'style = #'dashed-line
741 setDecresc = {
742 \set decrescendoText = \markup { \italic "decresc." }
743 \set crescendoSpanner = #'text
744 \override DynamicTextSpanner #'style = #'dashed-line
746 setDim = {
747 \set decrescendoText = \markup { \italic "dim." }
748 \set crescendoSpanner = #'text
749 \override DynamicTextSpanner #'style = #'dashed-line
752 newOrOldClef = #(define-music-function (parser location new old ) (string? string?)
753 (if (ly:get-option 'old-clefs) #{ \clef $old #} #{ \clef $new #})
758 %%% Thanks to "Gilles THIBAULT" <gilles.thibault@free.fr>, there is a way
759 % to remove also the fermata from R1-\fermataMarkup: By filtering the music
760 % and removing the corresponding events.
761 % Documented as an LSR snippet: http://lsr.dsi.unimi.it/LSR/Item?id=372
762 #(define (filterOneEventsMarkup event)
763 ( let ( (eventname (ly:music-property event 'name)) )
764 (not
765 (or ;; add here event name you do NOT want
766 (eq? eventname 'MultiMeasureTextEvent)
767 (eq? eventname 'AbsoluteDynamicEvent)
768 (eq? eventname 'TextScriptEvent)
769 (eq? eventname 'ArticulationEvent)
770 (eq? eventname 'CrescendoEvent)
771 (eq? eventname 'DecrescendoEvent)
776 filterArticulations = #(define-music-function (parser location music) (ly:music?)
777    (music-filter filterOneEventsMarkup music)
790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
792 %%%%% REST COMBINATION
793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
798 %% REST COMBINING, TAKEN FROM http://lsr.dsi.unimi.it/LSR/Item?id=336
800 %% Usage:
801 %% \new Staff \with {
802 %% \override RestCollision #'positioning-done = #merge-rests-on-positioning
803 %% } << \somevoice \\ \othervoice >>
804 %% or (globally):
805 %% \layout {
806 %% \context {
807 %% \Staff
808 %% \override RestCollision #'positioning-done = #merge-rests-on-positioning
809 %% }
810 %% }
812 %% Limitations:
813 %% - only handles two voices
814 %% - does not handle multi-measure/whole-measure rests
816 #(define (rest-score r)
817 (let ((score 0)
818 (yoff (ly:grob-property-data r 'Y-offset))
819 (sp (ly:grob-property-data r 'staff-position)))
820 (if (number? yoff)
821 (set! score (+ score 2))
822 (if (eq? yoff 'calculation-in-progress)
823 (set! score (- score 3))))
824 (and (number? sp)
825 (<= 0 2 sp)
826 (set! score (+ score 2))
827 (set! score (- score (abs (- 1 sp)))))
828 score))
830 #(define (merge-rests-on-positioning grob)
831 (let* ((can-merge #f)
832 (elts (ly:grob-object grob 'elements))
833 (num-elts (and (ly:grob-array? elts)
834 (ly:grob-array-length elts)))
835 (two-voice? (= num-elts 2)))
836 (if two-voice?
837 (let* ((v1-grob (ly:grob-array-ref elts 0))
838 (v2-grob (ly:grob-array-ref elts 1))
839 (v1-rest (ly:grob-object v1-grob 'rest))
840 (v2-rest (ly:grob-object v2-grob 'rest)))
841 (and
842 (ly:grob? v1-rest)
843 (ly:grob? v2-rest)
844 (let* ((v1-duration-log (ly:grob-property v1-rest 'duration-log))
845 (v2-duration-log (ly:grob-property v2-rest 'duration-log))
846 (v1-dot (ly:grob-object v1-rest 'dot))
847 (v2-dot (ly:grob-object v2-rest 'dot))
848 (v1-dot-count (and (ly:grob? v1-dot)
849 (ly:grob-property v1-dot 'dot-count -1)))
850 (v2-dot-count (and (ly:grob? v2-dot)
851 (ly:grob-property v2-dot 'dot-count -1))))
852 (set! can-merge
853 (and
854 (number? v1-duration-log)
855 (number? v2-duration-log)
856 (= v1-duration-log v2-duration-log)
857 (eq? v1-dot-count v2-dot-count)))
858 (if can-merge
859 ;; keep the rest that looks best:
860 (let* ((keep-v1? (>= (rest-score v1-rest)
861 (rest-score v2-rest)))
862 (rest-to-keep (if keep-v1? v1-rest v2-rest))
863 (dot-to-kill (if keep-v1? v2-dot v1-dot)))
864 ;; uncomment if you're curious of which rest was chosen:
865 ;;(ly:grob-set-property! v1-rest 'color green)
866 ;;(ly:grob-set-property! v2-rest 'color blue)
867 (ly:grob-suicide! (if keep-v1? v2-rest v1-rest))
868 (if (ly:grob? dot-to-kill)
869 (ly:grob-suicide! dot-to-kill))
870 (ly:grob-set-property! rest-to-keep 'direction 0)
871 (ly:rest::y-offset-callback rest-to-keep)))))))
872 (if can-merge
874 (ly:rest-collision::calc-positioning-done grob))))
880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
882 %%%%% TABLE OF CONTENTS
883 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
887 contentsTitle = "Inhalt / Contents"
889 \paper {
890 tocTitleMarkup = \markup \fill-line{
891 \null
892 \column {
893 \override #(cons 'line-width (* 7 cm))
894 \line{ \fill-line {\piece-title {\contentsTitle} \null }}
895 \hspace #1
897 \null
899 tocItemMarkup = \markup \fill-line {
900 \null
901 \column {
902 \override #(cons 'line-width (* 7 cm ))
903 \line { \fill-line{\fromproperty #'toc:text \fromproperty #'toc:page }}
905 \null
910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
912 %%%%% TITLE PAGE / HEADER
913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
916 #(define-markup-command (when-property layout props symbol markp) (symbol? markup?)
917 (if (chain-assoc-get symbol props)
918 (interpret-markup layout props markp)
919 (ly:make-stencil '() '(1 . -1) '(1 . -1))))
921 #(define-markup-command (vspace layout props amount) (number?)
922 "This produces a invisible object taking vertical space."
923 (let ((amount (* amount 3.0)))
924 (if (> amount 0)
925 (ly:make-stencil "" (cons -1 1) (cons 0 amount))
926 (ly:make-stencil "" (cons -1 1) (cons amount amount)))))
930 titlePageMarkup = \markup { \fontsize #2 \when-property #'header:title \column {
931 \vspace #4
932 \fill-line { \fontsize #8 \fromproperty #'header:composer }
933 \vspace #1
934 \fill-line { \fontsize #8 \fromproperty #'header:poet }
935 \vspace #4
936 \fill-line { \fontsize #10 \bold \fromproperty #'header:titlepagetitle }
937 \vspace #1
938 \fontsize #2 \when-property #'header:subtitle {
939 \fill-line { \fromproperty #'header:subtitle }
940 \vspace #1
942 \fill-line { \postscript #"-20 0 moveto 40 0 rlineto stroke" }
943 \vspace #8
944 \fill-line { \fontsize #5 \fromproperty #'header:ensemble }
945 \vspace #0.02
946 \fill-line { \fontsize #2 \fromproperty #'header:instruments }
947 \vspace #9
948 \fill-line { \fontsize #5 \fromproperty #'header:date }
949 \vspace #1
950 \fill-line { \fontsize #5 \fromproperty #'header:scoretype }
951 \vspace #8
952 \fontsize #2 \when-property #'header:enteredby {
953 \fill-line { "Herausgegeben von: / Edited by:"}
954 \vspace #0.
955 \fill-line { \fromproperty #'header:enteredby }
957 \fill-line {
958 \when-property #'header:arrangement \column {
959 \vspace #8
960 \fill-line { \fontsize #3 \fromproperty #'header:arrangement }
966 titleHeaderMarkup = \markup {
967 \override #'(baseline-skip . 3.5)
968 \column {
969 \override #'(baseline-skip . 3.5)
970 \column {
971 \huge \bigger \bold
972 \fill-line {
973 \bigger \fromproperty #'header:title
975 \fill-line {
976 \large \smaller \bold
977 \bigger \fromproperty #'header:subtitle
979 \fill-line {
980 \smaller \bold
981 \fromproperty #'header:subsubtitle
983 \fill-line {
984 { \large \bold \fromproperty #'header:instrument }
986 \fill-line {
987 \fromproperty #'header:poet
988 \fromproperty #'header:composer
990 \fill-line {
991 \fromproperty #'header:meter
992 \fromproperty #'header:arranger
998 titleScoreMarkup = \markup \piece-title \fromproperty #'header:piece
1000 \paper {
1001 scoreTitleMarkup = \titleScoreMarkup
1002 bookTitleMarkup = \titleHeaderMarkup
1007 %%%%%%%%%%%%%% headers and footers %%%%%%%%%%%%%%%%%%%%%%%%%%
1009 #(define (first-score-page layout props arg)
1010 (let* ((label 'first-score-page)
1011 (table (ly:output-def-lookup layout 'label-page-table))
1012 (label-page (and (list? table) (assoc label table)))
1013 (page-number (and label-page (cdr label-page)))
1015 (if (eq? (chain-assoc-get 'page:page-number props -1) page-number)
1016 (interpret-markup layout props arg)
1017 empty-stencil)))
1019 #(define no-header-table '())
1020 thisPageNoHeader = #(define-music-function (parser location) ()
1021 (let* ((label (gensym "header")))
1022 (set! no-header-table (cons label no-header-table))
1023 (make-music 'Music
1024 'page-marker #t
1025 'page-label label)))
1028 % TODO: Use the no-header-table!
1029 #(define (is-header-page layout props arg)
1030 (let* ((page-number (chain-assoc-get 'page:page-number props -1))
1032 (if (and (> page-number 2) (!= page-number 7))
1033 (interpret-markup layout props arg)
1034 empty-stencil)))
1036 #(define no-footer-table '())
1037 thisPageNoFooter = #(define-music-function (parser location) ()
1038 (let* ((label (gensym "footer")))
1039 (set! no-footer-table (cons label no-footer-table))
1040 (make-music 'Music
1041 'page-marker #t
1042 'page-label label)))
1044 % TODO: Use the no-footer-table!
1045 #(define (is-footer-page layout props arg)
1046 (let* ((page-number (chain-assoc-get 'page:page-number props -1))
1047 (label 'first-score-page)
1048 (table (ly:output-def-lookup layout 'label-page-table))
1049 (label-page (and (list? table) (assoc label table)))
1050 ;(page-number (and label-page (cdr label-page)))
1052 (if (and (> page-number 2) (!= page-number 7))
1053 (interpret-markup layout props arg)
1054 empty-stencil)))
1057 #(define copyright-footer-table '())
1058 thisPageCopyrightFooter = #(define-music-function (parser location) ()
1059 (let* ((label (gensym "copyrightfooter")))
1060 (set! copyright-footer-table (cons label copyright-footer-table))
1061 (make-music 'Music
1062 'page-marker #t
1063 'page-label label)))
1065 % TODO: Use the copyright-footer-table!
1066 #(define (copyright-page layout props arg)
1067 (if (= (chain-assoc-get 'page:page-number props -1) 7)
1068 (interpret-markup layout props arg)
1069 empty-stencil))
1072 \paper {
1073 oddHeaderMarkup = \markup \fill-line {
1074 %% force the header to take some space, otherwise the
1075 %% page layout becomes a complete mess.
1077 \on-the-fly #is-header-page \fromproperty #'header:title
1078 \on-the-fly #is-header-page \fromproperty #'page:page-number-string
1080 evenHeaderMarkup = \markup \fill-line {
1081 \on-the-fly #is-header-page \fromproperty #'page:page-number-string
1082 \on-the-fly #is-header-page \fromproperty #'header:composer
1086 oddFooterMarkup = \markup {
1087 \column {
1088 \fill-line {
1089 %% publisher header field only on title page.
1090 \on-the-fly #first-page \fromproperty #'header:publisher
1092 \fill-line {
1093 %% copyright on the first real score page
1094 \on-the-fly #copyright-page \fromproperty #'header:copyright
1095 \on-the-fly #copyright-page \null
1097 \fill-line {
1098 %% All other pages get the number of the edition centered
1099 \on-the-fly #is-footer-page \fromproperty #'header:scorenumber
1116 % Interpret the given markup with the header fields added to the props.
1117 % This way, one can re-use the same functions (using fromproperty
1118 % #'header:field) in the header block and as top-level markup.
1120 % This function is originally copied from mark-up-title (file scm/titling.scm),
1121 % which is lilypond's internal function to handle the title markups. I needed
1122 % to replace the scopes and manually add the $defaultheader (which is internally
1123 % done in paper-book.cc before calling mark-up-title. Also, I don't extract the
1124 % markup from the header block, but use the given markup.
1126 % I'm not sure if I really need the page properties in props, too... But I
1127 % suppose it does not hurt, either.
1128 #(define-markup-command (markupWithHeader layout props markup) (markup?)
1129 "Interpret the given markup with the header fields added to the props.
1130 This way, one can re-use the same functions (using fromproperty
1131 #'header:field) in the header block and as top-level markup."
1132 (let* (
1133 ; TODO: If we are inside a score, add the score's local header block, too!
1134 ; Currently, I only use the global header block, stored in $defaultheader
1135 (scopes (list $defaultheader))
1136 (alists (map ly:module->alist scopes))
1138 (prefixed-alist
1139 (map (lambda (alist)
1140 (map (lambda (entry)
1141 (cons
1142 (string->symbol (string-append "header:" (symbol->string (car entry))))
1143 (cdr entry)))
1144 alist))
1145 alists))
1146 (props (append prefixed-alist
1147 props
1148 (layout-extract-page-properties layout)))
1150 (interpret-markup layout props markup)
1159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1161 %%%%% Equally spacing multiple columns (e.g. for translations)
1162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1165 % Credits: Nicolas Sceaux on the lilypond-user mailinglist
1166 #(define-markup-command (columns layout props args) (markup-list?)
1167 (let ((line-width (/ (chain-assoc-get 'line-width props
1168 (ly:output-def-lookup layout 'line-width))
1169 (max (length args) 1))))
1170 (interpret-markup layout props
1171 (make-line-markup (map (lambda (line)
1172 (markup #:pad-to-box `(0 . ,line-width) '(0 . 0)
1173 #:override `(line-width . ,line-width)
1174 line))
1175 args)))))
1178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1180 %%%%% Defaults for instrument names, short names, cue names, etc.
1181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1184 %%% Clef definitions, either old-style (using the Breitkopf style) or new style
1185 FlClef = \clef "treble"
1186 FlIClef = \FlClef
1187 FlIIClef = \FlClef
1188 ObClef = \clef "treble"
1189 ObIClef = \ObClef
1190 ObIIClef = \ObClef
1191 ClIClef = \clef "treble"
1192 ClIIClef = \ClIClef
1193 FagClef = \clef "bass"
1194 FagIClef = \FagClef
1195 FagIIClef = \FagClef
1196 CFagClef = \clef "bass"
1197 CorClef = \clef "treble"
1198 CorIClef = \CorClef
1199 CorIIClef = \CorClef
1200 TrClef = \clef "tenor"
1201 TrIClef = \TrClef
1202 TrIIClef = \TrClef
1203 TrIIIClef = \clef "bass"
1204 TbeIClef = \clef "treble"
1205 TbeIIClef = \clef "treble"
1206 TimClef = \clef "bass"
1207 VClef = \clef "treble"
1208 VIClef = \VClef
1209 VIIClef = \VClef
1210 VaClef = \clef "alto"
1211 VaIClef = \VaClef
1212 VaIIClef = \VaClef
1213 VcBClef = \clef "bass"
1214 VcClef = \VcBClef
1215 CbClef = \VcBClef
1216 SClef = \clef "treble"
1217 AClef = \clef "treble"
1218 TClef = \clef "treble_8"
1219 BClef = \clef "bass"
1220 SSoloClef = \SClef
1221 ASoloClef = \AClef
1222 TSoloClef = \TClef
1223 BSoloClef = \BClef
1224 OIClef = \clef "treble"
1225 OIIClef = \clef "bass"
1229 FlInstrumentName = "Flauti"
1230 FlIInstrumentName = "Flauto I"
1231 FlIIInstrumentName = "Flauto II"
1232 ObInstrumentName = "Oboi"
1233 ObIInstrumentName = "Oboe I"
1234 ObIIInstrumentName = "Oboe II"
1235 ClInstrumentName = "Clarinetti"
1236 ClIInstrumentName = "Clarinetto I"
1237 ClIIInstrumentName = "Clarinetto II"
1238 FagInstrumentName = "Fagotti"
1239 FagIInstrumentName = "Fagotto I"
1240 FagIIInstrumentName = "Fagotto II"
1241 CFagInstrumentName = "Contrafagotto"
1242 CorInstrumentName = "Corni"
1243 CorIInstrumentName = "Corno I"
1244 CorIIInstrumentName = "Corno II"
1245 TrInstrumentName = "Tromboni"
1246 TrIInstrumentName = "Trombone I"
1247 TrIIInstrumentName = "Trombone II"
1248 TrIIIInstrumentName = "Trombone III"
1249 TbeInstrumentName = "Trombe"
1250 TbeIInstrumentName = "Tromba I"
1251 TbeIIInstrumentName = "Tromba II"
1252 TimInstrumentName = "Timpani"
1253 VIInstrumentName = "Violino I"
1254 VIIInstrumentName = "Violino II"
1255 VaInstrumentName = "Viola"
1256 VaIInstrumentName = "Viola I"
1257 VaIIInstrumentName = "Viola II"
1258 VcBInstrumentName = \markup {\column { "Cello e" "Contrabbasso"}}
1259 VcInstrumentName ="Violoncello"
1260 CbInstrumentName ="Basso"
1261 SInstrumentName = "Soprano"
1262 AInstrumentName = "Alto"
1263 TInstrumentName = "Tenore"
1264 BInstrumentName = "Basso"
1265 SSoloInstrumentName = "Soprano Solo"
1266 TSoloInstrumentName = "Tenore Solo"
1267 BSoloInstrumentName = "Basso Solo"
1268 ASoloInstrumentName = "Alto Solo"
1269 OInstrumentName = "Organo"
1271 ChInstrumentTitle = "Coro"
1274 FlShortInstrumentName = "Fl."
1275 FlIShortInstrumentName = "Fl. I"
1276 FlIIShortInstrumentName = "Fl. II"
1277 ObShortInstrumentName = "Ob."
1278 ObIShortInstrumentName = "Ob. I"
1279 ObIIShortInstrumentName = "Ob. II"
1280 ClShortInstrumentName = "Cl."
1281 ClIShortInstrumentName = "Cl.I"
1282 ClIIShortInstrumentName = "Cl.II"
1283 FagShortInstrumentName = "Fag."
1284 FagIShortInstrumentName = "Fag. I"
1285 FagIIShortInstrumentName = "Fag. II"
1286 CFagShortInstrumentName = "Cfag."
1287 CorShortInstrumentName = "Cor."
1288 CorIShortInstrumentName = "Cor.I"
1289 CorIIShortInstrumentName = "Cor.II"
1290 TrShortInstrumentName = "Tr."
1291 TrIShortInstrumentName = "Tr. I"
1292 TrIIShortInstrumentName = "Tr. II"
1293 TrIIIShortInstrumentName = "Tr. III"
1294 TbeShortInstrumentName = "Tbe."
1295 TbeIShortInstrumentName = "Tbe.I"
1296 TbeIIShortInstrumentName = "Tbe.II"
1297 TimShortInstrumentName = "Tim."
1298 VIShortInstrumentName = "V.I"
1299 VIIShortInstrumentName = "V.II"
1300 VaShortInstrumentName = "Va."
1301 VaIShortInstrumentName = "Va.I"
1302 VaIIShortInstrumentName = "Va.II"
1303 VcBShortInstrumentName = \markup{\column{"Vc." "e B."}}
1304 VcShortInstrumentName = "Vc."
1305 CbShortInstrumentName = "B."
1306 SShortInstrumentName = "S."
1307 AShortInstrumentName = "A."
1308 TShortInstrumentName = "T."
1309 BShortInstrumentName = "B."
1310 SSoloShortInstrumentName = "S.Solo"
1311 ASoloShortInstrumentName = "A.Solo"
1312 TSoloShortInstrumentName = "T.Solo"
1313 BSoloShortInstrumentName = "B.Solo"
1314 OShortInstrumentName = "Org."
1318 newInstrument = #(define-music-function (parser location instr) (string?)
1320 \set Voice.instrumentCueName = #$(string-join (list "+" instr))
1323 cueText = #(define-music-function (parser location instr) (string?)
1325 \set Voice.instrumentCueName = $instr
1329 cueFl = "Fl"
1330 cueCl = "Clt"
1331 cueClI = "Clt I"
1332 cueClII = "Clt II"
1333 cueCor = "Cor"
1334 cueCorI = "Cor I"
1335 cueCorII = "Cor II"
1336 cueTbe = "Tbe"
1337 cueTbeI = "Tbe I"
1338 cueTbeII = "Tbe II"
1339 cueTim = "Tim"
1340 cueVI = "V I"
1341 cueVII = "V II"
1342 cueVa = "Va"
1343 cueVaI = "Va I"
1344 cueVaII = "Va II"
1345 cueVcB = "Vc/B"
1346 cueArchi = "Archi"
1347 cueS = "S"
1348 cueA = "A"
1349 cueT = "T"
1350 cueB = "B"
1351 cueO = "Org"
1356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1357 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1358 %%%%% SCORE NUMBERS FOR PUBLISHING
1359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1362 scoreNumber =
1363 #(define-markup-command (scoreNumber layout props nr) (markup?)
1364 (interpret-markup layout props (markup (format "~a-~a" EKnumber nr)))
1367 FullScoreNumber = "1"
1368 PianoScoreNumber = "2"
1369 VocalScoreNumber = "3"
1371 ChoirScoreNumber = "10"
1372 SNumber = "11"
1373 ANumber = "12"
1374 TNumber = "13"
1375 BNumber = "14"
1376 SoloScoreNumber = "15"
1377 SSoloNumber = "16"
1378 ASoloNumber = "17"
1379 TSoloNumber = "18"
1380 BSoloNumber = "19"
1382 ONumber = "20"
1384 InstrumentsNumber = "25"
1385 VINumber = "30"
1386 VIINumber = "31"
1387 VaNumber = "32"
1388 VcBNumber = "33"
1390 FlINumber = "40"
1391 FlIINumber = "41"
1392 ObINumber = "42"
1393 ObIINumber = "43"
1394 ClINumber = "44"
1395 ClIINumber = "45"
1396 FagINumber = "46"
1397 FagIINumber = "47"
1398 CFagNumber = "48"
1400 CorINumber = "50"
1401 CorIINumber = "51"
1402 TreINumber = "52"
1403 TreIINumber = "53"
1404 TrbINumber = "54"
1405 TrbIINumber = "55"
1406 TrbIIINumber = "56"
1407 TbaNumber = "57"
1409 TimNumber = "60"
1410 ArpaNumber = "65"
1414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1416 %%%%% SCORE (HEADER / LAYOUT) SETTINGS
1417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1420 \paper {
1421 left-margin = 2\cm
1422 right-margin = 2\cm
1423 line-width = 17\cm
1424 bottom-margin = 1\cm
1425 top-margin = 1\cm
1426 % after-title-space = 0.5\cm
1427 ragged-bottom = ##f
1428 ragged-last-bottom = ##f
1430 \layout {
1431 \context {
1432 \ChoirStaff
1433 % If only one non-empty staff in a system exists, still print the backet
1434 \override SystemStartBracket #'collapse-height = #1
1435 \consists "Instrument_name_engraver"
1437 \context {
1438 \StaffGroup
1439 % If only one non-empty staff in a system exists, still print the backet
1440 \override SystemStartBracket #'collapse-height = #1
1441 \consists "Instrument_name_engraver"
1443 \context {
1444 \GrandStaff
1445 \override SystemStartBracket #'collapse-height = #1
1446 \consists "Instrument_name_engraver"
1448 \context {
1449 \Score
1450 % Force multi-measure rests to be written as one span
1451 \override MultiMeasureRest #'expand-limit = #3
1452 skipBars = ##t
1453 autoBeaming = ##f
1454 % hairpinToBarline = ##f
1455 \override BarNumber #'break-visibility = #end-of-line-invisible
1456 \override CombineTextScript #'avoid-slur = #'outside
1457 barNumberVisibility = #(every-nth-bar-number-visible 5)
1458 \override DynamicTextSpanner #'dash-period = #-1.0
1459 \override InstrumentSwitch #'font-size = #-1
1461 % Rest collision
1462 \override RestCollision #'positioning-done = #merge-rests-on-positioning
1463 % Auto-Accidentals: Use modern-cautionary style...
1464 extraNatural = ##f
1465 autoAccidentals = #'(Staff (same-octave . 0))
1466 autoCautionaries = #'(Staff (any-octave . 0) (same-octave . 1))
1467 printKeyCancellation = ##t
1469 \context {
1470 \RemoveEmptyStaffContext
1472 \context {
1473 \Lyrics
1474 \override VerticalAxisGroup #'minimum-Y-extent = #'(0.5 . 0.5)
1480 \layout {
1481 \context {
1482 \type "Engraver_group"
1483 \name Dynamics
1484 % So that \cresc works, for example.
1485 \alias Voice
1486 \consists "Output_property_engraver"
1488 \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
1489 pedalSustainStrings = #'("Ped." "*Ped." "*")
1490 pedalUnaCordaStrings = #'("una corda" "" "tre corde")
1492 \consists "Piano_pedal_engraver"
1493 \consists "Script_engraver"
1494 \consists "Dynamic_engraver"
1495 \consists "Text_engraver"
1497 \override TextScript #'font-size = #2
1498 \override TextScript #'font-shape = #'italic
1499 \override DynamicText #'extra-offset = #'(0 . 2.5)
1500 \override Hairpin #'extra-offset = #'(0 . 2.5)
1502 \consists "Skip_event_swallow_translator"
1504 \consists "Axis_group_engraver"
1506 \context {
1507 \PianoStaff
1508 \accepts Dynamics
1509 % \override VerticalAlignment #'forced-distance = #7