Use titlepagesubtitle for the title page
[orchestrallily.git] / orchestrallily.ly
blob88998ca2ea50b3cd5afbad37137982997d4ba36e
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 % 0.03 (2008-07-xx): General staff/voice types, title pages, etc.
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19 #(use-modules (ice-9 match))
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24 %%%%% SCORE STRUCTURE AND AUTOMATIC GENERATION
25 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 % Helper functions
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 % Helper function to filter all non-null entries
36 #(define (not-null? x) (not (null? x)))
38 % Helper function to extract a given variable, built from [Piece][Instrument]Identifier
39 #(define (namedPieceInstrObject piece instr name)
40 (let* (
41 (fullname (string->symbol (string-append piece instr name)))
42 (instrname (string->symbol (string-append instr name)))
43 (piecename (string->symbol (string-append piece name)))
45 (cond
46 ((defined? fullname) (primitive-eval fullname))
47 ((defined? instrname) (primitive-eval instrname))
48 ((defined? piecename) (primitive-eval piecename))
49 (else '())
54 %% Print text as a justified paragraph, taken from the lilypond Notation Reference
55 #(define-markup-list-command (paragraph layout props args) (markup-list?)
56 (let ((indent (chain-assoc-get 'par-indent props 2)))
57 (interpret-markup-list layout props
58 (make-justified-lines-markup-list (cons (make-hspace-markup indent)
59 args)))))
61 conditionalBreak = #(define-music-function (parser location) ()
62 #{ \tag #'instrumental-score \pageBreak #}
65 #(define (oly:piece-title-markup title) (markup #:column (#:line (#:fontsize #'3 #:bold title))) )
67 #(define-markup-command (piece-title layout props title) (markup?)
68 (interpret-markup layout props (oly:piece-title-markup title))
71 #(define (oly:generate_object_name piece instr obj )
72 (if (and (string? piece) (string? instr) (string? obj))
73 (string-append piece instr obj)
77 #(define (oly:generate_staff_name piece instr) (oly:generate_object_name piece instr "St"))
79 #(define (set-context-property context property value)
80 (set! (ly:music-property context property) value)
84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
85 % Score structure and voice types
86 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88 #(define oly:orchestral_score_structure '())
90 #(define (oly:set_score_structure struct)
91 (if (list? struct)
92 (set! oly:orchestral_score_structure struct)
93 (ly:warning (_ "oly:set_score_structure needs an association list as argument!"))
97 orchestralScoreStructure = #(define-music-function (parser location structure) (list?)
98 (oly:set_score_structure structure)
99 (make-music 'Music 'void #t)
102 #(define oly:voice_types '())
104 #(define (oly:set_voice_types types)
105 (if (list? types)
106 (set! oly:voice_types types)
107 (ly:warning (_ "oly:set_voice_types needs an association list as argument!"))
111 orchestralVoiceTypes = #(define-music-function (parser location types) (list?)
112 (oly:set_voice_types types)
113 (make-music 'Music 'void #t)
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118 % Automatic staff and group generation
119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
121 % Retrieve all music definitions for the given
122 #(define (oly:get_music_object piece instrument)
123 (namedPieceInstrObject piece instrument "Music")
125 #(define (oly:get_music_objects piece instruments)
126 (filter not-null? (map (lambda (i) (oly:get_music_object piece i)) instruments))
129 % Given a property name and the extensions, either generate the pair to set
130 % the property or an empty list, if no pre-defined variable could be found
131 #(define (oly:generate_property_pair prop piece instr type)
132 (let* ((val (namedPieceInstrObject piece instr type)))
133 (if (not-null? val) (list 'assign prop val) '() )
137 #(define (oly:staff_type type)
138 (cond
139 ((string? type) (string->symbol type))
140 ((symbol? type) type)
141 (else 'Staff)
145 #(define (oly:extractPitch music)
146 (let* (
147 (elems (if (ly:music? music) (ly:music-property music 'elements)))
148 (note (if (pair? elems) (car elems)))
149 (pitch (if (ly:music? note) (ly:music-property note 'pitch)))
151 (if (and (not-null? music) (not (ly:pitch? pitch)))
152 (ly:warning "Unable to interpret as a pitch!")
154 pitch
158 #(define (oly:extractTranspositionPitch piece name)
159 (let* (
160 (trpFromPitch (oly:extractPitch (namedPieceInstrObject piece name "TransposeFrom")))
161 (trpToPitch (oly:extractPitch (namedPieceInstrObject piece name "TransposeTo")))
163 (if (ly:pitch? trpFromPitch)
164 (if (ly:pitch? trpToPitch)
165 ; Both pitches
166 (ly:pitch-diff trpFromPitch trpToPitch)
167 (ly:pitch-diff trpFromPitch (ly:make-pitch 0 0 0))
169 (if (ly:pitch? trpToPitch)
170 (ly:pitch-diff (ly:make-pitch 0 0 0) trpToPitch)
177 #(define (oly:voice_handler_internal parser piece name type music)
178 (let* (
179 (tempo (namedPieceInstrObject piece name "Tempo"))
180 (lyrics (namedPieceInstrObject piece name "Lyrics"))
181 (trpPitch (oly:extractTranspositionPitch piece name))
182 (musiccontent '())
185 (if (ly:music? lyrics)
186 (set! musiccontent (append musiccontent (list dynamicUp)))
187 (if (not-null? lyrics) (ly:warning (_ "Wrong type (no lyrics) for lyrics for instrument ~S in piece ~S") name piece))
189 ; Append the settings, key and clef (if defined)
190 (map
191 (lambda (type)
192 (let* ((object (namedPieceInstrObject piece name type)))
193 (if (ly:music? object)
194 (set! musiccontent (append musiccontent (list object)))
195 (if (not-null? object) (ly:warning (_ "Wrong type (no ly:music) for ~S for instrument ~S in piece ~S") type name piece))
199 '("Settings" "Key" "Clef" "TimeSignature")
202 (if (ly:music? music)
203 (begin
204 (set! musiccontent (make-simultaneous-music (append musiccontent (list music))))
205 ;(ly:message "Generating staff for ~a" name)
206 (if (ly:pitch? trpPitch)
207 (set! musiccontent (ly:music-transpose musiccontent trpPitch))
210 (let* (
211 (voicename (oly:generate_object_name piece name "Voice" ))
212 (voicetype (oly:staff_type type))
213 (voice (context-spec-music musiccontent voicetype voicename))
214 (staffcont (list voice))
216 ; If we have lyrics, create a lyrics context containing LyricCombineMusic
217 ; and add that as second element to the staff's elements list...
218 (if (ly:music? lyrics)
219 (let* (
220 (lyricsname (oly:generate_object_name piece name "Lyrics" ))
221 (lyricscont (make-music 'LyricCombineMusic 'element lyrics 'associated-context voicename))
223 (set! staffcont (append staffcont
224 (list (context-spec-music lyricscont 'Lyrics lyricsname))))
227 staffcont
230 ; For empty music, return empty
236 #(define (oly:voice_handler parser piece name type)
237 (let* ((music (oly:get_music_object piece name))
239 (oly:voice_handler_internal parser piece name type music)
244 #(define (oly:staff_handler_internal parser piece name type voices)
245 (if (not-null? voices)
246 (let* (
247 (staffname (oly:generate_staff_name piece name))
248 (stafftype (oly:staff_type type))
249 (staff (make-simultaneous-music voices))
250 (propops (oly:staff_handler_properties piece name))
252 (case stafftype
253 ((SimultaneousMusic ParallelMusic) #f)
254 (else (set! staff (context-spec-music staff stafftype staffname)))
256 (if (not-null? propops)
257 (set! (ly:music-property staff 'property-operations) propops)
259 staff
261 ; For empty music, return empty
266 #(define (oly:staff_handler parser piece name type children)
267 (let* ((c (if (not-null? children) children (list name)))
268 (voices (apply append (map (lambda (v) (oly:create_voice parser piece v)) c)) )
270 (if (not-null? voices)
271 (oly:staff_handler_internal parser piece name type voices)
277 #(define (oly:parallel_voices_staff_handler parser piece name type children)
278 (let* (
279 (voices (map (lambda (i) (oly:create_voice parser piece i)) children))
280 ; get the lsit of non-empty voices and flatten it!
281 (nonemptyvoices (apply append (filter not-null? voices)))
283 (if (not-null? nonemptyvoices)
284 (oly:staff_handler_internal parser piece name "Staff" nonemptyvoices)
290 #(define (oly:part_combined_staff_handler parser piece name type children)
291 (let* ((music (oly:get_music_objects piece children)))
293 (cond
294 ((and (pair? music) (ly:music? (car music)) (not-null? (cdr music)) (ly:music? (cadr music)))
295 ;(ly:message "Part-combine with two music expressions")
296 (oly:staff_handler_internal parser piece name "Staff" (list (make-part-combine-music parser music))))
297 ((null? music)
298 (ly:warning "Part-combine without any music expressions")
299 '())
300 ; exactly one is a music expression, simply use that by joining
301 ((list? music)
302 (ly:message "Part-combine with only one music expressions")
303 (oly:staff_handler_internal parser piece name "Staff" (list (apply append music))))
304 (else
305 ;(ly:message "make_part_combined_staff: ~S ~S ~a" piece instr instruments)
306 '() )
311 % Generate the properties for the staff for piece and instr. Typically, these
312 % are the instrument name and the short instrument name (if defined).
313 % return a (possibly empty) list of all assignments.
314 #(define (oly:staff_handler_properties piece instr)
315 (let* (
316 (mapping '(
317 (instrumentName . "InstrumentName")
318 (shortInstrumentName . "ShortInstrumentName")
319 (midiInstrument . "MidiInstrument")
321 (assignments (map
322 (lambda (pr)
323 (oly:generate_property_pair (car pr) piece instr (cdr pr))
325 mapping))
326 (props (filter not-null? assignments))
328 props
332 % Figured bass is a special case, as it can be voice- or staff-type. When
333 % given as a staff type, simply call the voice handler, instead
335 #(define (oly:figured_bass_staff_handler parser piece name type children)
336 (let* ((c (if (not-null? children) children (list name)))
337 (voice (oly:voice_handler parser piece (car c) type)))
338 (if (pair? voice) (car voice) ())
343 #(define (oly:staff_group_handler parser piece name type children)
344 (let* (
345 (staves (map (lambda (i) (oly:create_staff_or_group parser piece i)) children))
346 (nonemptystaves (filter not-null? staves))
348 (if (not-null? nonemptystaves)
349 (let* (
350 (musicexpr (if (= 1 (length nonemptystaves))
351 (car nonemptystaves)
352 (make-simultaneous-music nonemptystaves)))
353 (groupname (oly:generate_staff_name piece name))
354 (grouptype (oly:staff_type type))
355 (group musicexpr)
356 (propops (oly:staff_handler_properties piece name))
358 (case grouptype
359 ((SimultaneousMusic ParallelMusic) #f)
360 (else (set! group (context-spec-music group grouptype groupname)))
362 (set! (ly:music-property group 'property-operations) propops)
363 group
365 ; Return empty list if no staves are generated
371 #(define (oly:create_voice parser piece name)
372 (let* ( (voice (namedPieceInstrObject piece name "Voice"))
373 (type (assoc-ref oly:voice_types name)) )
374 (if (not-null? voice)
375 ; Explicit voice variable, use that
376 voice
378 (if (not type)
379 ; No entry in structure found => simple voice
380 (oly:voice_handler parser piece name "Voice")
381 ; Entry found in structure => use the handler for the given type
382 (let* (
383 (voicetype (car type))
384 (handler (assoc-ref oly:voice_handlers voicetype))
386 (if handler
387 ((primitive-eval handler) parser piece name voicetype)
388 (begin
389 (ly:warning "No handler found for voice type ~a, using default voice handler" voicetype)
390 (oly:voice_handler parser piece name voicetype)
399 #(define (oly:create_staff_or_group parser piece name)
400 (let* ( (staff (namedPieceInstrObject piece name "Staff"))
401 (type_from_structure (assoc-ref oly:orchestral_score_structure name)) )
402 ;(if (not-null? staff)
403 ; (ly:message "Found staff variable for instrument ~a in piece ~a" instr piece)
404 ; (ly:message "Staff variable for instrument ~a in piece ~a NOT FOUND" instr piece)
406 (if (not-null? staff)
407 ; Explicit staff variable, use that
408 staff
410 (if (not (list? type_from_structure))
411 ; No entry in structure found => simple staff
412 (oly:staff_handler parser piece name "Staff" '())
414 ; Entry found in structure => use the handler for the given type
415 (let* ((type (car type_from_structure))
416 (handler (assoc-ref oly:staff_handlers type))
417 (children (cadr type_from_structure))
419 (if handler
420 ((primitive-eval handler) parser piece name type children)
421 (begin
422 (ly:warning "No handler found for staff type ~a, using default staff handler" type)
423 (oly:staff_handler parser piece name type children)
432 #(define oly:staff_handlers
433 (list
434 ; staff group types
435 '("GrandStaff" . oly:staff_group_handler )
436 '("PianoStaff" . oly:staff_group_handler )
437 '("ChoirStaff" . oly:staff_group_handler )
438 '("StaffGroup" . oly:staff_group_handler )
439 '("InnerChoirStaff" . oly:staff_group_handler )
440 '("InnerStaffGroup" . oly:staff_group_handler )
441 '("ParallelMusic" . oly:staff_group_handler )
442 '("SimultaneousMusic" . oly:staff_group_handler )
443 ; staff types
444 '("Staff" . oly:staff_handler )
445 '("DrumStaff" . oly:staff_handler )
446 '("RhythmicStaff" . oly:staff_handler )
447 '("TabStaff" . oly:staff_handler )
448 '("GregorianTranscriptionStaff" . oly:staff_handler )
449 '("MensuralStaff" . oly:staff_handler )
450 '("VaticanaStaff" . oly:staff_handler )
451 ; staves with multiple voices
452 '("PartCombinedStaff" . oly:part_combined_staff_handler )
453 '("ParallelVoicesStaff" . oly:parallel_voices_staff_handler )
454 ; special cases: Figured bass can be staff or voice type!
455 '("FiguredBass" . oly:figured_bass_staff_handler )
459 #(define oly:voice_handlers
460 (list
461 ; voice types
462 '("Voice" . oly:voice_handler )
463 '("CueVoice" . oly:voice_handler )
464 '("DrumVoice" . oly:voice_handler )
465 '("FiguredBass" . oly:voice_handler )
466 '("GregorianTranscriptionVoice" . oly:voice_handler )
467 '("NoteNames" . oly:voice_handler )
468 '("TabVoice" . oly:voice_handler )
469 '("VaticanaVoice" . oly:voice_handler )
470 ;'("Dynamics" . oly:dynamics_handler )
475 #(define (oly:register_staff_type_handler type func)
476 ; (ly:message "Registering staff handler ~a for type ~a" func type)
477 (set! oly:staff_handlers (assoc-set! oly:staff_handlers type func))
480 #(define (oly:register_voice_type_handler type func)
481 ; (ly:message "Registering voice type handler ~a for type ~a" func type)
482 (set! oly:voice_handlers (assoc-set! oly:voice_handlers type func))
485 % handlers for deprecated API
486 #(oly:register_staff_type_handler 'StaffGroup 'oly:staff_group_handler)
487 #(oly:register_staff_type_handler 'GrandStaff 'oly:staff_group_handler)
488 #(oly:register_staff_type_handler 'PianoStaff 'oly:staff_group_handler)
489 #(oly:register_staff_type_handler 'ChoirStaff 'oly:staff_group_handler)
490 #(oly:register_staff_type_handler 'Staff 'oly:staff_handler )
491 #(oly:register_staff_type_handler 'ParallelMusic 'oly:staff_group_handler)
492 #(oly:register_staff_type_handler 'SimultaneousMusic 'oly:staff_group_handler)
493 #(oly:register_staff_type_handler #t 'oly:part_combined_staff_handler )
494 #(oly:register_staff_type_handler #f 'oly:parallel_voices_staff_handler )
498 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
499 % Automatic score generation
500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
502 % \setUseBook ##t/##f sets a flag to determine whether the calls to createScore
503 % are from within a book block or not
504 % #(define oly:score_handler collect-scores-for-book)
505 #(define oly:score_handler toplevel-score-handler)
506 #(define oly:music_handler toplevel-music-handler)
507 #(define oly:text_handler toplevel-text-handler)
509 setUseBook = #(define-music-function (parser location usebook) (boolean?)
510 (if usebook
511 (begin
512 (set! oly:score_handler book-score-handler)
513 (set! oly:music_handler book-music-handler)
514 (set! oly:text_handler book-text-handler)
516 (begin
517 (set! oly:score_handler toplevel-score-handler)
518 (set! oly:music_handler toplevel-music-handler)
519 (set! oly:text_handler toplevel-text-handler)
522 (make-music 'Music 'void #t)
526 % Two functions to handle midi-blocks: Either don't set one, or set an empty
527 % one so that MIDI is generated
528 #(define (oly:set_no_midi_block score) '())
529 #(define (oly:set_midi_block score)
530 (let* ((midiblock (if (defined? '$defaultmidi)
531 (ly:output-def-clone $defaultmidi)
532 (ly:make-output-def))))
533 (ly:output-def-set-variable! midiblock 'is-midi #t)
534 (ly:score-add-output-def! score midiblock)
538 % \setCreateMidi ##t/##f sets a flag to determine wheter MIDI output should
539 % be generated
540 #(define oly:apply_score_midi oly:set_no_midi_block)
541 setCreateMIDI = #(define-music-function (parser location createmidi) (boolean?)
542 (if createmidi
543 (set! oly:apply_score_midi oly:set_midi_block)
544 (set! oly:apply_score_midi oly:set_no_midi_block)
546 (make-music 'Music 'void #t)
550 % Two functions to handle layout-blocks: Either don't set one, or set an empty
551 % one so that a PDF is generated
552 #(define (oly:set_no_layout_block score) '())
553 #(define (oly:set_layout_block score)
554 (let* ((layoutblock (if (defined? '$defaultlayout)
555 (ly:output-def-clone $defaultlayout)
556 (ly:make-output-def))))
557 (ly:output-def-set-variable! layoutblock 'is-layout #t)
558 (ly:score-add-output-def! score layoutblock)
562 % \setCreatePDF ##t/##f sets a flag to determine wheter PDF output should
563 % be generated
564 #(define oly:apply_score_layout oly:set_no_layout_block)
565 setCreatePDF = #(define-music-function (parser location createlayout) (boolean?)
566 (if createlayout
567 (set! oly:apply_score_layout oly:set_layout_block)
568 (set! oly:apply_score_layout oly:set_no_layout_block)
570 (make-music 'Music 'void #t)
574 % Set the piece title in a new header block.
575 #(define (oly:set_piece_header score piecename)
576 (if (not-null? piecename)
577 (let* ((header (make-module)))
578 (module-define! header 'piece piecename)
579 (ly:score-set-header! score header)
585 % post-filter functions. By default, no filtering is done. However,
586 % for the *NoCues* function, the cue notes should be killed
587 identity = #(define-music-function (parser location music) (ly:music?) music)
588 cuefilter = #(define-music-function (parser location music) (ly:music?)
589 ((ly:music-function-extract removeWithTag) parser location 'cued ((ly:music-function-extract killCues) parser location music))
592 #(define-public (oly:add-toc-item parser markup-symbol text)
593 (oly:music_handler parser (add-toc-item! markup-symbol text)))
596 #(define (oly:add-score parser score piecename)
597 (if (not-null? piecename)
598 (oly:add-toc-item parser 'tocItemMarkup piecename))
599 (oly:score_handler parser score)
601 % The helper function to build a score.
602 #(define (oly:createScoreHelper parser location piece children func)
603 (let* (
604 (staves (oly:staff_group_handler parser piece "" "SimultaneousMusic" children))
605 (music (if (not-null? staves)
606 ((ly:music-function-extract func) parser location staves)
609 (score '())
610 (piecename (namedPieceInstrObject piece (car children) "PieceName"))
611 (piecenametacet (namedPieceInstrObject piece (car children) "PieceNameTacet"))
612 (header '())
614 (if (null? music)
615 ; No staves, print tacet
616 (begin
617 (if (not-null? piecenametacet) (set! piecename piecenametacet))
618 (if (not-null? piecename)
619 (oly:add-score parser (list (oly:piece-title-markup piecename)) piecename)
620 (ly:warning (_ "No music and no score title found for part ~a and instrument ~a") piece children)
623 ; we have staves, apply the piecename to the score and add layout/midi blocks if needed
624 (begin
625 (set! score (scorify-music music parser))
626 (oly:set_piece_header score piecename)
627 (oly:apply_score_midi score)
628 (oly:apply_score_layout score)
629 ; Schedule the score for typesetting
630 (oly:add-score parser score piecename)
634 ; This is a void function, the score has been schedulled for typesetting already
635 (make-music 'Music 'void #t)
638 createScore = #(define-music-function (parser location piece children) (string? list?)
639 (oly:createScoreHelper parser location piece children identity)
641 createNoCuesScore = #(define-music-function (parser location piece children) (string? list?)
642 (oly:createScoreHelper parser location piece children cuefilter)
645 createHeadline = #(define-music-function (parser location headline) (string?)
646 (oly:add-toc-item parser 'tocItemMarkup headline)
647 (oly:score_handler parser (list (oly:piece-title-markup headline)))
648 (make-music 'Music 'void #t)
653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
655 %%%%% CUE NOTES
656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
659 % set the cue instrument name
660 setCue = #(define-music-function (parser location instr) (string?)
661 #{ \set Voice.instrumentCueName = $instr #} )
663 % generate a cue music section with instrument names
664 % Parameters: \namedCueDuring NameOfQuote CueDirection CueInstrument OriginalInstrument music
665 % -) NameOfQuote CueDirection music are the parameters for \cueDuring
666 % -) CueInstrument and OriginalInstrument are the displayed instrument names
667 % typical call:
668 % \namedCueDuring #"vIQuote" #UP #"V.I" #"Sop." { R1*3 }
669 % This adds the notes from vIQuote (defined via \addQuote) to three measures, prints "V.I" at
670 % the beginning of the cue notes and "Sop." at the end
671 namedCueDuring = #(define-music-function (parser location cuevoice direction instrcue instr cuemusic) (string? number? string? string? ly:music?)
673 \cueDuring #$cuevoice #$direction { \tag #'cued \setCue #$instrcue $cuemusic \tag #'cued \setCue #$instr }
674 % \tag #'uncued $cuemusic
677 namedTransposedCueDuring = #(define-music-function (parser location cuevoice direction instrcue instr trans cuemusic) (string? number? string? string? ly:music? ly:music?)
679 \transposedCueDuring #$cuevoice #$direction $trans { \tag #'cued \setCue #$instrcue $cuemusic \tag #'cued \setCue #$instr }
680 % \tag #'uncued $cuemusic
684 % set the cue instrument name and clef
685 setClefCue = #(define-music-function (parser location instr clef)
686 (string? ly:music?)
688 \once \override Staff.Clef #'font-size = #-3 $clef
689 \set Voice.instrumentCueName = $instr
690 #} )
692 % generate a cue music section with instrument names and clef changes
693 % Parameters: \cleffedCueDuring NameOfQuote CueDirection CueInstrument CueClef OriginalInstrument OriginalClef music
694 % -) NameOfQuote CueDirection music are the parameters for \cueDuring
695 % -) CueInstrument and OriginalInstrument are the displayed instrument names
696 % -) CueClef and OriginalClef are the clefs for the the cue notes and the clef of the containing voice
697 % typical call:
698 % \cleffedCueDuring #"vIQuote" #UP #"V.I" #"treble" #"Basso" #"bass" { R1*3 }
699 % This adds the notes from vIQuote (defined via \addQuote) to three measures, prints "V.I" at
700 % the beginning of the cue notes and "Basso" at the end. The clef is changed to treble at the
701 % beginning of the cue notes and reset to bass at the end
702 cleffedCueDuring = #(define-music-function (parser location cuevoice direction instrcue clefcue instr clefinstr cuemusic)
703 (string? number? string? ly:music? string? ly:music? ly:music?)
705 \cueDuring #$cuevoice #$direction { \tag #'cued \setClefCue #$instrcue $clefcue $cuemusic \tag #'cued \setClefCue #$instr $clefinstr }
706 % \tag #'uncued $cuemusic
713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
715 %%%%% DYNAMICS
716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
720 shiftDynamics = #(define-music-function (parser location xshift yshift) (number? number?)
722 \once \override DynamicTextSpanner #'padding = $yshift
723 \once\override DynamicText #'extra-offset = #(cons $xshift $yshift)
726 ffz = #(make-dynamic-script "ffz")
727 pf = #(make-dynamic-script "pf")
728 sempp = #(make-dynamic-script (markup #:line( #:with-dimensions '(0 . 0)
729 '(0 . 0) #:right-align #:normal-text #:italic "sempre" #:dynamic "pp")))
730 parenf = #(make-dynamic-script (markup #:line(#:normal-text #:italic #:fontsize 2 "(" #:dynamic "f" #:normal-text #:italic #:fontsize 2 ")" )))
731 parenp = #(make-dynamic-script (markup #:line(#:normal-text #:italic #:fontsize 2 "(" #:dynamic "p" #:normal-text #:italic #:fontsize 2 ")" )))
732 pdolce = #(make-dynamic-script (markup #:line(#:dynamic "p" #:with-dimensions '(0 . 0) '(0 . 0) #:normal-text #:italic "dolce" )))
736 dim = #(make-span-event 'DecrescendoEvent START)
737 enddim = #(make-span-event 'DecrescendoEvent STOP)
738 decresc = #(make-span-event 'DecrescendoEvent START)
739 enddecresc = #(make-span-event 'DecrescendoEvent STOP)
740 cresc = #(make-span-event 'CrescendoEvent START)
741 endcresc = #(make-span-event 'CrescendoEvent STOP)
743 setCresc = {
744 \set crescendoText = \markup { \italic "cresc." }
745 \set crescendoSpanner = #'text
746 \override DynamicTextSpanner #'style = #'dashed-line
748 setDecresc = {
749 \set decrescendoText = \markup { \italic "decresc." }
750 \set crescendoSpanner = #'text
751 \override DynamicTextSpanner #'style = #'dashed-line
753 setDim = {
754 \set decrescendoText = \markup { \italic "dim." }
755 \set crescendoSpanner = #'text
756 \override DynamicTextSpanner #'style = #'dashed-line
759 newOrOldClef = #(define-music-function (parser location new old ) (string? string?)
760 (if (ly:get-option 'old-clefs) #{ \clef $old #} #{ \clef $new #})
765 %%% Thanks to "Gilles THIBAULT" <gilles.thibault@free.fr>, there is a way
766 % to remove also the fermata from R1-\fermataMarkup: By filtering the music
767 % and removing the corresponding events.
768 % Documented as an LSR snippet: http://lsr.dsi.unimi.it/LSR/Item?id=372
769 #(define (filterOneEventsMarkup event)
770 ( let ( (eventname (ly:music-property event 'name)) )
771 (not
772 (or ;; add here event name you do NOT want
773 (eq? eventname 'MultiMeasureTextEvent)
774 (eq? eventname 'AbsoluteDynamicEvent)
775 (eq? eventname 'TextScriptEvent)
776 (eq? eventname 'ArticulationEvent)
777 (eq? eventname 'CrescendoEvent)
778 (eq? eventname 'DecrescendoEvent)
783 filterArticulations = #(define-music-function (parser location music) (ly:music?)
784    (music-filter filterOneEventsMarkup music)
797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
798 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
799 %%%%% REST COMBINATION
800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
805 %% REST COMBINING, TAKEN FROM http://lsr.dsi.unimi.it/LSR/Item?id=336
807 %% Usage:
808 %% \new Staff \with {
809 %% \override RestCollision #'positioning-done = #merge-rests-on-positioning
810 %% } << \somevoice \\ \othervoice >>
811 %% or (globally):
812 %% \layout {
813 %% \context {
814 %% \Staff
815 %% \override RestCollision #'positioning-done = #merge-rests-on-positioning
816 %% }
817 %% }
819 %% Limitations:
820 %% - only handles two voices
821 %% - does not handle multi-measure/whole-measure rests
823 #(define (rest-score r)
824 (let ((score 0)
825 (yoff (ly:grob-property-data r 'Y-offset))
826 (sp (ly:grob-property-data r 'staff-position)))
827 (if (number? yoff)
828 (set! score (+ score 2))
829 (if (eq? yoff 'calculation-in-progress)
830 (set! score (- score 3))))
831 (and (number? sp)
832 (<= 0 2 sp)
833 (set! score (+ score 2))
834 (set! score (- score (abs (- 1 sp)))))
835 score))
837 #(define (merge-rests-on-positioning grob)
838 (let* ((can-merge #f)
839 (elts (ly:grob-object grob 'elements))
840 (num-elts (and (ly:grob-array? elts)
841 (ly:grob-array-length elts)))
842 (two-voice? (= num-elts 2)))
843 (if two-voice?
844 (let* ((v1-grob (ly:grob-array-ref elts 0))
845 (v2-grob (ly:grob-array-ref elts 1))
846 (v1-rest (ly:grob-object v1-grob 'rest))
847 (v2-rest (ly:grob-object v2-grob 'rest)))
848 (and
849 (ly:grob? v1-rest)
850 (ly:grob? v2-rest)
851 (let* ((v1-duration-log (ly:grob-property v1-rest 'duration-log))
852 (v2-duration-log (ly:grob-property v2-rest 'duration-log))
853 (v1-dot (ly:grob-object v1-rest 'dot))
854 (v2-dot (ly:grob-object v2-rest 'dot))
855 (v1-dot-count (and (ly:grob? v1-dot)
856 (ly:grob-property v1-dot 'dot-count -1)))
857 (v2-dot-count (and (ly:grob? v2-dot)
858 (ly:grob-property v2-dot 'dot-count -1))))
859 (set! can-merge
860 (and
861 (number? v1-duration-log)
862 (number? v2-duration-log)
863 (= v1-duration-log v2-duration-log)
864 (eq? v1-dot-count v2-dot-count)))
865 (if can-merge
866 ;; keep the rest that looks best:
867 (let* ((keep-v1? (>= (rest-score v1-rest)
868 (rest-score v2-rest)))
869 (rest-to-keep (if keep-v1? v1-rest v2-rest))
870 (dot-to-kill (if keep-v1? v2-dot v1-dot)))
871 ;; uncomment if you're curious of which rest was chosen:
872 ;;(ly:grob-set-property! v1-rest 'color green)
873 ;;(ly:grob-set-property! v2-rest 'color blue)
874 (ly:grob-suicide! (if keep-v1? v2-rest v1-rest))
875 (if (ly:grob? dot-to-kill)
876 (ly:grob-suicide! dot-to-kill))
877 (ly:grob-set-property! rest-to-keep 'direction 0)
878 (ly:rest::y-offset-callback rest-to-keep)))))))
879 (if can-merge
881 (ly:rest-collision::calc-positioning-done grob))))
887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
889 %%%%% TABLE OF CONTENTS
890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
894 contentsTitle = "Inhalt / Contents"
896 \paper {
897 tocTitleMarkup = \markup \fill-line{
898 \null
899 \column {
900 \override #(cons 'line-width (* 7 cm))
901 \line{ \fill-line {\piece-title {\contentsTitle} \null }}
902 \hspace #1
904 \null
906 tocItemMarkup = \markup \fill-line {
907 \null
908 \column {
909 \override #(cons 'line-width (* 7 cm ))
910 \line { \fill-line{\fromproperty #'toc:text \fromproperty #'toc:page }}
912 \null
917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
919 %%%%% TITLE PAGE / HEADER
920 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
923 #(define-markup-command (when-property layout props symbol markp) (symbol? markup?)
924 (if (chain-assoc-get symbol props)
925 (interpret-markup layout props markp)
926 (ly:make-stencil '() '(1 . -1) '(1 . -1))))
928 #(define-markup-command (vspace layout props amount) (number?)
929 "This produces a invisible object taking vertical space."
930 (let ((amount (* amount 3.0)))
931 (if (> amount 0)
932 (ly:make-stencil "" (cons -1 1) (cons 0 amount))
933 (ly:make-stencil "" (cons -1 1) (cons amount amount)))))
937 titlePageMarkup = \markup { \fontsize #2 \when-property #'header:title \column {
938 \vspace #4
939 \fill-line { \fontsize #8 \fromproperty #'header:composer }
940 \vspace #1
941 \fill-line { \fontsize #8 \fromproperty #'header:poet }
942 \vspace #4
943 \fill-line { \fontsize #10 \bold \fromproperty #'header:titlepagetitle }
944 \vspace #1
945 \fontsize #2 \when-property #'header:titlepagesubtitle {
946 \fill-line { \fromproperty #'header:titlepagesubtitle }
947 \vspace #1
949 \fill-line { \postscript #"-20 0 moveto 40 0 rlineto stroke" }
950 \vspace #8
951 \fill-line { \fontsize #5 \fromproperty #'header:ensemble }
952 \vspace #0.02
953 \fill-line { \fontsize #2 \fromproperty #'header:instruments }
954 \vspace #9
955 \fill-line { \fontsize #5 \fromproperty #'header:date }
956 \vspace #1
957 \fill-line { \fontsize #5 \fromproperty #'header:scoretype }
958 \vspace #8
959 \fontsize #2 \when-property #'header:enteredby {
960 \fill-line { "Herausgegeben von: / Edited by:"}
961 \vspace #0.
962 \fill-line { \fromproperty #'header:enteredby }
964 \fill-line {
965 \when-property #'header:arrangement \column {
966 \vspace #8
967 \fill-line { \fontsize #3 \fromproperty #'header:arrangement }
973 titleHeaderMarkup = \markup {
974 \override #'(baseline-skip . 3.5)
975 \column {
976 \override #'(baseline-skip . 3.5)
977 \column {
978 \huge \bigger \bold
979 \fill-line {
980 \bigger \fromproperty #'header:title
982 \fill-line {
983 \large \smaller \bold
984 \bigger \fromproperty #'header:subtitle
986 \fill-line {
987 \smaller \bold
988 \fromproperty #'header:subsubtitle
990 \fill-line {
991 { \large \bold \fromproperty #'header:instrument }
993 \fill-line {
994 \fromproperty #'header:poet
995 \fromproperty #'header:composer
997 \fill-line {
998 \fromproperty #'header:meter
999 \fromproperty #'header:arranger
1005 titleScoreMarkup = \markup \piece-title \fromproperty #'header:piece
1007 \paper {
1008 scoreTitleMarkup = \titleScoreMarkup
1009 bookTitleMarkup = \titleHeaderMarkup
1014 %%%%%%%%%%%%%% headers and footers %%%%%%%%%%%%%%%%%%%%%%%%%%
1016 #(define (first-score-page layout props arg)
1017 (let* ((label 'first-score-page)
1018 (table (ly:output-def-lookup layout 'label-page-table))
1019 (label-page (and (list? table) (assoc label table)))
1020 (page-number (and label-page (cdr label-page)))
1022 (if (eq? (chain-assoc-get 'page:page-number props -1) page-number)
1023 (interpret-markup layout props arg)
1024 empty-stencil)))
1026 #(define no-header-table '())
1027 thisPageNoHeader = #(define-music-function (parser location) ()
1028 (let* ((label (gensym "header")))
1029 (set! no-header-table (cons label no-header-table))
1030 (make-music 'Music
1031 'page-marker #t
1032 'page-label label)))
1035 % TODO: Use the no-header-table!
1036 #(define (is-header-page layout props arg)
1037 (let* ((page-number (chain-assoc-get 'page:page-number props -1))
1039 (if (and (> page-number 2) (!= page-number 7))
1040 (interpret-markup layout props arg)
1041 empty-stencil)))
1043 #(define no-footer-table '())
1044 thisPageNoFooter = #(define-music-function (parser location) ()
1045 (let* ((label (gensym "footer")))
1046 (set! no-footer-table (cons label no-footer-table))
1047 (make-music 'Music
1048 'page-marker #t
1049 'page-label label)))
1051 % TODO: Use the no-footer-table!
1052 #(define (is-footer-page layout props arg)
1053 (let* ((page-number (chain-assoc-get 'page:page-number props -1))
1054 (label 'first-score-page)
1055 (table (ly:output-def-lookup layout 'label-page-table))
1056 (label-page (and (list? table) (assoc label table)))
1057 ;(page-number (and label-page (cdr label-page)))
1059 (if (and (> page-number 2) (!= page-number 7))
1060 (interpret-markup layout props arg)
1061 empty-stencil)))
1064 #(define copyright-footer-table '())
1065 thisPageCopyrightFooter = #(define-music-function (parser location) ()
1066 (let* ((label (gensym "copyrightfooter")))
1067 (set! copyright-footer-table (cons label copyright-footer-table))
1068 (make-music 'Music
1069 'page-marker #t
1070 'page-label label)))
1072 % TODO: Use the copyright-footer-table!
1073 #(define (copyright-page layout props arg)
1074 (if (= (chain-assoc-get 'page:page-number props -1) 7)
1075 (interpret-markup layout props arg)
1076 empty-stencil))
1079 \paper {
1080 oddHeaderMarkup = \markup \fill-line {
1081 %% force the header to take some space, otherwise the
1082 %% page layout becomes a complete mess.
1084 \on-the-fly #is-header-page \fromproperty #'header:title
1085 \on-the-fly #is-header-page \fromproperty #'page:page-number-string
1087 evenHeaderMarkup = \markup \fill-line {
1088 \on-the-fly #is-header-page \fromproperty #'page:page-number-string
1089 \on-the-fly #is-header-page \fromproperty #'header:composer
1093 oddFooterMarkup = \markup {
1094 \column {
1095 \fill-line {
1096 %% publisher header field only on title page.
1097 \on-the-fly #first-page \fromproperty #'header:publisher
1099 \fill-line {
1100 %% copyright on the first real score page
1101 \on-the-fly #copyright-page \fromproperty #'header:copyright
1102 \on-the-fly #copyright-page \null
1104 \fill-line {
1105 %% All other pages get the number of the edition centered
1106 \on-the-fly #is-footer-page \fromproperty #'header:scorenumber
1123 % Interpret the given markup with the header fields added to the props.
1124 % This way, one can re-use the same functions (using fromproperty
1125 % #'header:field) in the header block and as top-level markup.
1127 % This function is originally copied from mark-up-title (file scm/titling.scm),
1128 % which is lilypond's internal function to handle the title markups. I needed
1129 % to replace the scopes and manually add the $defaultheader (which is internally
1130 % done in paper-book.cc before calling mark-up-title. Also, I don't extract the
1131 % markup from the header block, but use the given markup.
1133 % I'm not sure if I really need the page properties in props, too... But I
1134 % suppose it does not hurt, either.
1135 #(define-markup-command (markupWithHeader layout props markup) (markup?)
1136 "Interpret the given markup with the header fields added to the props.
1137 This way, one can re-use the same functions (using fromproperty
1138 #'header:field) in the header block and as top-level markup."
1139 (let* (
1140 ; TODO: If we are inside a score, add the score's local header block, too!
1141 ; Currently, I only use the global header block, stored in $defaultheader
1142 (scopes (list $defaultheader))
1143 (alists (map ly:module->alist scopes))
1145 (prefixed-alist
1146 (map (lambda (alist)
1147 (map (lambda (entry)
1148 (cons
1149 (string->symbol (string-append "header:" (symbol->string (car entry))))
1150 (cdr entry)))
1151 alist))
1152 alists))
1153 (props (append prefixed-alist
1154 props
1155 (layout-extract-page-properties layout)))
1157 (interpret-markup layout props markup)
1166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1168 %%%%% Equally spacing multiple columns (e.g. for translations)
1169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1172 % Credits: Nicolas Sceaux on the lilypond-user mailinglist
1173 #(define-markup-command (columns layout props args) (markup-list?)
1174 (let ((line-width (/ (chain-assoc-get 'line-width props
1175 (ly:output-def-lookup layout 'line-width))
1176 (max (length args) 1))))
1177 (interpret-markup layout props
1178 (make-line-markup (map (lambda (line)
1179 (markup #:pad-to-box `(0 . ,line-width) '(0 . 0)
1180 #:override `(line-width . ,line-width)
1181 line))
1182 args)))))
1185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1187 %%%%% Defaults for instrument names, short names, cue names, etc.
1188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1191 %%% Clef definitions, either old-style (using the Breitkopf style) or new style
1192 FlClef = \clef "treble"
1193 FlIClef = \FlClef
1194 FlIIClef = \FlClef
1195 ObClef = \clef "treble"
1196 ObIClef = \ObClef
1197 ObIIClef = \ObClef
1198 ClIClef = \clef "treble"
1199 ClIIClef = \ClIClef
1200 FagClef = \clef "bass"
1201 FagIClef = \FagClef
1202 FagIIClef = \FagClef
1203 CFagClef = \clef "bass"
1204 CorClef = \clef "treble"
1205 CorIClef = \CorClef
1206 CorIIClef = \CorClef
1207 TrClef = \clef "tenor"
1208 TrIClef = \TrClef
1209 TrIIClef = \TrClef
1210 TrIIIClef = \clef "bass"
1211 TbeIClef = \clef "treble"
1212 TbeIIClef = \clef "treble"
1213 TimClef = \clef "bass"
1214 VClef = \clef "treble"
1215 VIClef = \VClef
1216 VIIClef = \VClef
1217 VaClef = \clef "alto"
1218 VaIClef = \VaClef
1219 VaIIClef = \VaClef
1220 VcBClef = \clef "bass"
1221 VcClef = \VcBClef
1222 CbClef = \VcBClef
1223 SClef = \clef "treble"
1224 AClef = \clef "treble"
1225 TClef = \clef "treble_8"
1226 BClef = \clef "bass"
1227 SSoloClef = \SClef
1228 ASoloClef = \AClef
1229 TSoloClef = \TClef
1230 BSoloClef = \BClef
1231 OIClef = \clef "treble"
1232 OIIClef = \clef "bass"
1236 FlInstrumentName = "Flauti"
1237 FlIInstrumentName = "Flauto I"
1238 FlIIInstrumentName = "Flauto II"
1239 ObInstrumentName = "Oboi"
1240 ObIInstrumentName = "Oboe I"
1241 ObIIInstrumentName = "Oboe II"
1242 ClInstrumentName = "Clarinetti"
1243 ClIInstrumentName = "Clarinetto I"
1244 ClIIInstrumentName = "Clarinetto II"
1245 FagInstrumentName = "Fagotti"
1246 FagIInstrumentName = "Fagotto I"
1247 FagIIInstrumentName = "Fagotto II"
1248 CFagInstrumentName = "Contrafagotto"
1249 CorInstrumentName = "Corni"
1250 CorIInstrumentName = "Corno I"
1251 CorIIInstrumentName = "Corno II"
1252 TrInstrumentName = "Tromboni"
1253 TrIInstrumentName = "Trombone I"
1254 TrIIInstrumentName = "Trombone II"
1255 TrIIIInstrumentName = "Trombone III"
1256 TbeInstrumentName = "Trombe"
1257 TbeIInstrumentName = "Tromba I"
1258 TbeIIInstrumentName = "Tromba II"
1259 TimInstrumentName = "Timpani"
1260 VIInstrumentName = "Violino I"
1261 VIIInstrumentName = "Violino II"
1262 VaInstrumentName = "Viola"
1263 VaIInstrumentName = "Viola I"
1264 VaIIInstrumentName = "Viola II"
1265 VcBInstrumentName = \markup {\column { "Cello e" "Contrabbasso"}}
1266 VcInstrumentName ="Violoncello"
1267 CbInstrumentName ="Basso"
1268 SInstrumentName = "Soprano"
1269 AInstrumentName = "Alto"
1270 TInstrumentName = "Tenore"
1271 BInstrumentName = "Basso"
1272 SSoloInstrumentName = "Soprano Solo"
1273 TSoloInstrumentName = "Tenore Solo"
1274 BSoloInstrumentName = "Basso Solo"
1275 ASoloInstrumentName = "Alto Solo"
1276 OInstrumentName = "Organo"
1278 ChInstrumentTitle = "Coro"
1281 FlShortInstrumentName = "Fl."
1282 FlIShortInstrumentName = "Fl. I"
1283 FlIIShortInstrumentName = "Fl. II"
1284 ObShortInstrumentName = "Ob."
1285 ObIShortInstrumentName = "Ob. I"
1286 ObIIShortInstrumentName = "Ob. II"
1287 ClShortInstrumentName = "Cl."
1288 ClIShortInstrumentName = "Cl.I"
1289 ClIIShortInstrumentName = "Cl.II"
1290 FagShortInstrumentName = "Fag."
1291 FagIShortInstrumentName = "Fag. I"
1292 FagIIShortInstrumentName = "Fag. II"
1293 CFagShortInstrumentName = "Cfag."
1294 CorShortInstrumentName = "Cor."
1295 CorIShortInstrumentName = "Cor.I"
1296 CorIIShortInstrumentName = "Cor.II"
1297 TrShortInstrumentName = "Tr."
1298 TrIShortInstrumentName = "Tr. I"
1299 TrIIShortInstrumentName = "Tr. II"
1300 TrIIIShortInstrumentName = "Tr. III"
1301 TbeShortInstrumentName = "Tbe."
1302 TbeIShortInstrumentName = "Tbe.I"
1303 TbeIIShortInstrumentName = "Tbe.II"
1304 TimShortInstrumentName = "Tim."
1305 VIShortInstrumentName = "V.I"
1306 VIIShortInstrumentName = "V.II"
1307 VaShortInstrumentName = "Va."
1308 VaIShortInstrumentName = "Va.I"
1309 VaIIShortInstrumentName = "Va.II"
1310 VcBShortInstrumentName = \markup{\column{"Vc." "e B."}}
1311 VcShortInstrumentName = "Vc."
1312 CbShortInstrumentName = "B."
1313 SShortInstrumentName = "S."
1314 AShortInstrumentName = "A."
1315 TShortInstrumentName = "T."
1316 BShortInstrumentName = "B."
1317 SSoloShortInstrumentName = "S.Solo"
1318 ASoloShortInstrumentName = "A.Solo"
1319 TSoloShortInstrumentName = "T.Solo"
1320 BSoloShortInstrumentName = "B.Solo"
1321 OShortInstrumentName = "Org."
1325 newInstrument = #(define-music-function (parser location instr) (string?)
1327 \set Voice.instrumentCueName = #$(string-join (list "+" instr))
1330 cueText = #(define-music-function (parser location instr) (string?)
1332 \set Voice.instrumentCueName = $instr
1336 cueFl = "Fl"
1337 cueCl = "Clt"
1338 cueClI = "Clt I"
1339 cueClII = "Clt II"
1340 cueCor = "Cor"
1341 cueCorI = "Cor I"
1342 cueCorII = "Cor II"
1343 cueTbe = "Tbe"
1344 cueTbeI = "Tbe I"
1345 cueTbeII = "Tbe II"
1346 cueTim = "Tim"
1347 cueVI = "V I"
1348 cueVII = "V II"
1349 cueVa = "Va"
1350 cueVaI = "Va I"
1351 cueVaII = "Va II"
1352 cueVcB = "Vc/B"
1353 cueArchi = "Archi"
1354 cueS = "S"
1355 cueA = "A"
1356 cueT = "T"
1357 cueB = "B"
1358 cueO = "Org"
1363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1365 %%%%% SCORE NUMBERS FOR PUBLISHING
1366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1369 scoreNumber =
1370 #(define-markup-command (scoreNumber layout props nr) (markup?)
1371 (interpret-markup layout props (markup (format "~a-~a" EKnumber nr)))
1374 FullScoreNumber = "1"
1375 PianoScoreNumber = "2"
1376 VocalScoreNumber = "3"
1378 ChoirScoreNumber = "10"
1379 SNumber = "11"
1380 ANumber = "12"
1381 TNumber = "13"
1382 BNumber = "14"
1383 SoloScoreNumber = "15"
1384 SSoloNumber = "16"
1385 ASoloNumber = "17"
1386 TSoloNumber = "18"
1387 BSoloNumber = "19"
1389 ONumber = "20"
1391 InstrumentsNumber = "25"
1392 VINumber = "30"
1393 VIINumber = "31"
1394 VaNumber = "32"
1395 VcBNumber = "33"
1397 FlINumber = "40"
1398 FlIINumber = "41"
1399 ObINumber = "42"
1400 ObIINumber = "43"
1401 ClINumber = "44"
1402 ClIINumber = "45"
1403 FagINumber = "46"
1404 FagIINumber = "47"
1405 CFagNumber = "48"
1407 CorINumber = "50"
1408 CorIINumber = "51"
1409 TreINumber = "52"
1410 TreIINumber = "53"
1411 TrbINumber = "54"
1412 TrbIINumber = "55"
1413 TrbIIINumber = "56"
1414 TbaNumber = "57"
1416 TimNumber = "60"
1417 ArpaNumber = "65"
1421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1423 %%%%% SCORE (HEADER / LAYOUT) SETTINGS
1424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1427 \paper {
1428 left-margin = 2\cm
1429 right-margin = 2\cm
1430 % line-width = 17\cm
1431 bottom-margin = 1\cm
1432 top-margin = 1\cm
1433 % after-title-space = 0.5\cm
1434 ragged-bottom = ##f
1435 ragged-last-bottom = ##f
1437 \layout {
1438 \context {
1439 \ChoirStaff
1440 % If only one non-empty staff in a system exists, still print the backet
1441 \override SystemStartBracket #'collapse-height = #1
1442 \consists "Instrument_name_engraver"
1444 \context {
1445 \StaffGroup
1446 % If only one non-empty staff in a system exists, still print the backet
1447 \override SystemStartBracket #'collapse-height = #1
1448 \consists "Instrument_name_engraver"
1450 \context {
1451 \GrandStaff
1452 \override SystemStartBracket #'collapse-height = #1
1453 \consists "Instrument_name_engraver"
1455 \context {
1456 \Score
1457 % Force multi-measure rests to be written as one span
1458 \override MultiMeasureRest #'expand-limit = #3
1459 skipBars = ##t
1460 autoBeaming = ##f
1461 % hairpinToBarline = ##f
1462 \override BarNumber #'break-visibility = #end-of-line-invisible
1463 \override CombineTextScript #'avoid-slur = #'outside
1464 barNumberVisibility = #(every-nth-bar-number-visible 5)
1465 \override DynamicTextSpanner #'dash-period = #-1.0
1466 \override InstrumentSwitch #'font-size = #-1
1468 % Rest collision
1469 \override RestCollision #'positioning-done = #merge-rests-on-positioning
1470 % Auto-Accidentals: Use modern-cautionary style...
1471 extraNatural = ##f
1472 autoAccidentals = #'(Staff (same-octave . 0))
1473 autoCautionaries = #'(Staff (any-octave . 0) (same-octave . 1))
1474 printKeyCancellation = ##t
1476 \context {
1477 \RemoveEmptyStaffContext
1479 \context {
1480 \Lyrics
1481 \override VerticalAxisGroup #'minimum-Y-extent = #'(0.5 . 0.5)
1487 \layout {
1488 \context {
1489 \type "Engraver_group"
1490 \name Dynamics
1491 % So that \cresc works, for example.
1492 \alias Voice
1493 \consists "Output_property_engraver"
1495 \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
1496 pedalSustainStrings = #'("Ped." "*Ped." "*")
1497 pedalUnaCordaStrings = #'("una corda" "" "tre corde")
1499 \consists "Piano_pedal_engraver"
1500 \consists "Script_engraver"
1501 \consists "Dynamic_engraver"
1502 \consists "Text_engraver"
1504 \override TextScript #'font-size = #2
1505 \override TextScript #'font-shape = #'italic
1506 \override DynamicText #'extra-offset = #'(0 . 2.5)
1507 \override Hairpin #'extra-offset = #'(0 . 2.5)
1509 \consists "Skip_event_swallow_translator"
1511 \consists "Axis_group_engraver"
1513 \context {
1514 \PianoStaff
1515 \accepts Dynamics
1516 % \override VerticalAlignment #'forced-distance = #7