Won't release in June...
[orchestrallily.git] / orchestrallily.ly
blob9e36ecef3b3176d7e9bc5fdbb5f1e1ec5b45056a
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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719 tempoMark = #(define-music-function (parser location padding marktext) (number? string?)
721 \once \override Score . RehearsalMark #'padding = $padding
722 \mark \markup { \bold \smaller $marktext }
725 shiftDynamics = #(define-music-function (parser location xshift yshift) (number? number?)
727 \once \override DynamicTextSpanner #'padding = $yshift
728 \once\override DynamicText #'extra-offset = #(cons $xshift $yshift)
731 ffz = #(make-dynamic-script "ffz")
732 pf = #(make-dynamic-script "pf")
733 sempp = #(make-dynamic-script (markup #:line( #:with-dimensions '(0 . 0)
734 '(0 . 0) #:right-align #:normal-text #:italic "sempre" #:dynamic "pp")))
735 parenf = #(make-dynamic-script (markup #:line(#:normal-text #:italic #:fontsize 2 "(" #:dynamic "f" #:normal-text #:italic #:fontsize 2 ")" )))
736 parenp = #(make-dynamic-script (markup #:line(#:normal-text #:italic #:fontsize 2 "(" #:dynamic "p" #:normal-text #:italic #:fontsize 2 ")" )))
740 dim = #(make-span-event 'DecrescendoEvent START)
741 enddim = #(make-span-event 'DecrescendoEvent STOP)
742 decresc = #(make-span-event 'DecrescendoEvent START)
743 enddecresc = #(make-span-event 'DecrescendoEvent STOP)
744 cresc = #(make-span-event 'CrescendoEvent START)
745 endcresc = #(make-span-event 'CrescendoEvent STOP)
747 setCresc = {
748 \set crescendoText = \markup { \italic "cresc." }
749 \set crescendoSpanner = #'text
750 \override DynamicTextSpanner #'style = #'dashed-line
752 setDecresc = {
753 \set decrescendoText = \markup { \italic "decresc." }
754 \set crescendoSpanner = #'text
755 \override DynamicTextSpanner #'style = #'dashed-line
757 setDim = {
758 \set decrescendoText = \markup { \italic "dim." }
759 \set crescendoSpanner = #'text
760 \override DynamicTextSpanner #'style = #'dashed-line
763 newOrOldClef = #(define-music-function (parser location new old ) (string? string?)
764 (if (ly:get-option 'old-clefs) #{ \clef $old #} #{ \clef $new #})
769 %%% Thanks to "Gilles THIBAULT" <gilles.thibault@free.fr>, there is a way
770 % to remove also the fermata from R1-\fermataMarkup: By filtering the music
771 % and removing the corresponding events.
772 % Documented as an LSR snippet: http://lsr.dsi.unimi.it/LSR/Item?id=372
773 #(define (filterOneEventsMarkup event)
774 ( let ( (eventname (ly:music-property event 'name)) )
775 (not
776 (or ;; add here event name you do NOT want
777 (eq? eventname 'MultiMeasureTextEvent)
778 (eq? eventname 'AbsoluteDynamicEvent)
779 (eq? eventname 'TextScriptEvent)
780 (eq? eventname 'ArticulationEvent)
781 (eq? eventname 'CrescendoEvent)
782 (eq? eventname 'DecrescendoEvent)
787 filterArticulations = #(define-music-function (parser location music) (ly:music?)
788    (music-filter filterOneEventsMarkup music)
801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803 %%%%% REST COMBINATION
804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
809 %% REST COMBINING, TAKEN FROM http://lsr.dsi.unimi.it/LSR/Item?id=336
811 %% Usage:
812 %% \new Staff \with {
813 %% \override RestCollision #'positioning-done = #merge-rests-on-positioning
814 %% } << \somevoice \\ \othervoice >>
815 %% or (globally):
816 %% \layout {
817 %% \context {
818 %% \Staff
819 %% \override RestCollision #'positioning-done = #merge-rests-on-positioning
820 %% }
821 %% }
823 %% Limitations:
824 %% - only handles two voices
825 %% - does not handle multi-measure/whole-measure rests
827 #(define (rest-score r)
828 (let ((score 0)
829 (yoff (ly:grob-property-data r 'Y-offset))
830 (sp (ly:grob-property-data r 'staff-position)))
831 (if (number? yoff)
832 (set! score (+ score 2))
833 (if (eq? yoff 'calculation-in-progress)
834 (set! score (- score 3))))
835 (and (number? sp)
836 (<= 0 2 sp)
837 (set! score (+ score 2))
838 (set! score (- score (abs (- 1 sp)))))
839 score))
841 #(define (merge-rests-on-positioning grob)
842 (let* ((can-merge #f)
843 (elts (ly:grob-object grob 'elements))
844 (num-elts (and (ly:grob-array? elts)
845 (ly:grob-array-length elts)))
846 (two-voice? (= num-elts 2)))
847 (if two-voice?
848 (let* ((v1-grob (ly:grob-array-ref elts 0))
849 (v2-grob (ly:grob-array-ref elts 1))
850 (v1-rest (ly:grob-object v1-grob 'rest))
851 (v2-rest (ly:grob-object v2-grob 'rest)))
852 (and
853 (ly:grob? v1-rest)
854 (ly:grob? v2-rest)
855 (let* ((v1-duration-log (ly:grob-property v1-rest 'duration-log))
856 (v2-duration-log (ly:grob-property v2-rest 'duration-log))
857 (v1-dot (ly:grob-object v1-rest 'dot))
858 (v2-dot (ly:grob-object v2-rest 'dot))
859 (v1-dot-count (and (ly:grob? v1-dot)
860 (ly:grob-property v1-dot 'dot-count -1)))
861 (v2-dot-count (and (ly:grob? v2-dot)
862 (ly:grob-property v2-dot 'dot-count -1))))
863 (set! can-merge
864 (and
865 (number? v1-duration-log)
866 (number? v2-duration-log)
867 (= v1-duration-log v2-duration-log)
868 (eq? v1-dot-count v2-dot-count)))
869 (if can-merge
870 ;; keep the rest that looks best:
871 (let* ((keep-v1? (>= (rest-score v1-rest)
872 (rest-score v2-rest)))
873 (rest-to-keep (if keep-v1? v1-rest v2-rest))
874 (dot-to-kill (if keep-v1? v2-dot v1-dot)))
875 ;; uncomment if you're curious of which rest was chosen:
876 ;;(ly:grob-set-property! v1-rest 'color green)
877 ;;(ly:grob-set-property! v2-rest 'color blue)
878 (ly:grob-suicide! (if keep-v1? v2-rest v1-rest))
879 (if (ly:grob? dot-to-kill)
880 (ly:grob-suicide! dot-to-kill))
881 (ly:grob-set-property! rest-to-keep 'direction 0)
882 (ly:rest::y-offset-callback rest-to-keep)))))))
883 (if can-merge
885 (ly:rest-collision::calc-positioning-done grob))))
891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
893 %%%%% TABLE OF CONTENTS
894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
898 contentsTitle = "Inhalt / Contents"
900 \paper {
901 tocTitleMarkup = \markup \fill-line{
902 \null
903 \column {
904 \override #(cons 'line-width (* 7 cm))
905 \line{ \fill-line {\piece-title {\contentsTitle} \null }}
906 \hspace #1
908 \null
910 tocItemMarkup = \markup \fill-line {
911 \null
912 \column {
913 \override #(cons 'line-width (* 7 cm ))
914 \line { \fill-line{\fromproperty #'toc:text \fromproperty #'toc:page }}
916 \null
921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
923 %%%%% TITLE PAGE / HEADER
924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
927 #(define-markup-command (when-property layout props symbol markp) (symbol? markup?)
928 (if (chain-assoc-get symbol props)
929 (interpret-markup layout props markp)
930 (ly:make-stencil '() '(1 . -1) '(1 . -1))))
932 #(define-markup-command (vspace layout props amount) (number?)
933 "This produces a invisible object taking vertical space."
934 (let ((amount (* amount 3.0)))
935 (if (> amount 0)
936 (ly:make-stencil "" (cons -1 1) (cons 0 amount))
937 (ly:make-stencil "" (cons -1 1) (cons amount amount)))))
941 titlePageMarkup = \markup { \fontsize #2 \when-property #'header:title \column {
942 \vspace #4
943 \fill-line { \fontsize #8 \fromproperty #'header:composer }
944 \vspace #1
945 \fill-line { \fontsize #8 \fromproperty #'header:poet }
946 \vspace #4
947 \fill-line { \fontsize #10 \bold \fromproperty #'header:titlepagetitle }
948 \vspace #1
949 \fontsize #2 \when-property #'header:subtitle {
950 \fill-line { \fromproperty #'header:subtitle }
951 \vspace #1
953 \fill-line { \postscript #"-20 0 moveto 40 0 rlineto stroke" }
954 \vspace #8
955 \fill-line { \fontsize #5 \fromproperty #'header:ensemble }
956 \vspace #0.02
957 \fill-line { \fontsize #2 \fromproperty #'header:instruments }
958 \vspace #9
959 \fill-line { \fontsize #5 \fromproperty #'header:date }
960 \vspace #1
961 \fill-line { \fontsize #5 \fromproperty #'header:scoretype }
962 \vspace #8
963 \fontsize #2 \when-property #'header:enteredby {
964 \fill-line { "Herausgegeben von: / Edited by:"}
965 \vspace #0.
966 \fill-line { \fromproperty #'header:enteredby }
968 \fill-line {
969 \when-property #'header:arrangement \column {
970 \vspace #8
971 \fill-line { \fontsize #3 \fromproperty #'header:arrangement }
977 titleHeaderMarkup = \markup {
978 \override #'(baseline-skip . 3.5)
979 \column {
980 \override #'(baseline-skip . 3.5)
981 \column {
982 \huge \bigger \bold
983 \fill-line {
984 \bigger \fromproperty #'header:title
986 \fill-line {
987 \large \smaller \bold
988 \bigger \fromproperty #'header:subtitle
990 \fill-line {
991 \smaller \bold
992 \fromproperty #'header:subsubtitle
994 \fill-line {
995 { \large \bold \fromproperty #'header:instrument }
997 \fill-line {
998 \fromproperty #'header:poet
999 \fromproperty #'header:composer
1001 \fill-line {
1002 \fromproperty #'header:meter
1003 \fromproperty #'header:arranger
1009 titleScoreMarkup = \markup \piece-title \fromproperty #'header:piece
1011 \paper {
1012 scoreTitleMarkup = \titleScoreMarkup
1013 bookTitleMarkup = \titleHeaderMarkup
1018 %%%%%%%%%%%%%% headers and footers %%%%%%%%%%%%%%%%%%%%%%%%%%
1020 #(define (first-score-page layout props arg)
1021 (let* ((label 'first-score-page)
1022 (table (ly:output-def-lookup layout 'label-page-table))
1023 (label-page (and (list? table) (assoc label table)))
1024 (page-number (and label-page (cdr label-page)))
1026 (if (eq? (chain-assoc-get 'page:page-number props -1) page-number)
1027 (interpret-markup layout props arg)
1028 empty-stencil)))
1030 #(define no-header-table '())
1031 thisPageNoHeader = #(define-music-function (parser location) ()
1032 (let* ((label (gensym "header")))
1033 (set! no-header-table (cons label no-header-table))
1034 (make-music 'Music
1035 'page-marker #t
1036 'page-label label)))
1039 % TODO: Use the no-header-table!
1040 #(define (is-header-page layout props arg)
1041 (let* ((page-number (chain-assoc-get 'page:page-number props -1))
1043 (if (and (> page-number 2) (!= page-number 7))
1044 (interpret-markup layout props arg)
1045 empty-stencil)))
1047 #(define no-footer-table '())
1048 thisPageNoFooter = #(define-music-function (parser location) ()
1049 (let* ((label (gensym "footer")))
1050 (set! no-footer-table (cons label no-footer-table))
1051 (make-music 'Music
1052 'page-marker #t
1053 'page-label label)))
1055 % TODO: Use the no-footer-table!
1056 #(define (is-footer-page layout props arg)
1057 (let* ((page-number (chain-assoc-get 'page:page-number props -1))
1058 (label 'first-score-page)
1059 (table (ly:output-def-lookup layout 'label-page-table))
1060 (label-page (and (list? table) (assoc label table)))
1061 ;(page-number (and label-page (cdr label-page)))
1063 (if (and (> page-number 2) (!= page-number 7))
1064 (interpret-markup layout props arg)
1065 empty-stencil)))
1068 #(define copyright-footer-table '())
1069 thisPageCopyrightFooter = #(define-music-function (parser location) ()
1070 (let* ((label (gensym "copyrightfooter")))
1071 (set! copyright-footer-table (cons label copyright-footer-table))
1072 (make-music 'Music
1073 'page-marker #t
1074 'page-label label)))
1076 % TODO: Use the copyright-footer-table!
1077 #(define (copyright-page layout props arg)
1078 (if (= (chain-assoc-get 'page:page-number props -1) 7)
1079 (interpret-markup layout props arg)
1080 empty-stencil))
1083 \paper {
1084 oddHeaderMarkup = \markup \fill-line {
1085 %% force the header to take some space, otherwise the
1086 %% page layout becomes a complete mess.
1088 \on-the-fly #is-header-page \fromproperty #'header:title
1089 \on-the-fly #is-header-page \fromproperty #'page:page-number-string
1091 evenHeaderMarkup = \markup \fill-line {
1092 \on-the-fly #is-header-page \fromproperty #'page:page-number-string
1093 \on-the-fly #is-header-page \fromproperty #'header:composer
1097 oddFooterMarkup = \markup {
1098 \column {
1099 \fill-line {
1100 %% publisher header field only on title page.
1101 \on-the-fly #first-page \fromproperty #'header:publisher
1103 \fill-line {
1104 %% copyright on the first real score page
1105 \on-the-fly #copyright-page \fromproperty #'header:copyright
1106 \on-the-fly #copyright-page \null
1108 \fill-line {
1109 %% All other pages get the number of the edition centered
1110 \on-the-fly #is-footer-page \fromproperty #'header:scorenumber
1127 % Interpret the given markup with the header fields added to the props.
1128 % This way, one can re-use the same functions (using fromproperty
1129 % #'header:field) in the header block and as top-level markup.
1131 % This function is originally copied from mark-up-title (file scm/titling.scm),
1132 % which is lilypond's internal function to handle the title markups. I needed
1133 % to replace the scopes and manually add the $defaultheader (which is internally
1134 % done in paper-book.cc before calling mark-up-title. Also, I don't extract the
1135 % markup from the header block, but use the given markup.
1137 % I'm not sure if I really need the page properties in props, too... But I
1138 % suppose it does not hurt, either.
1139 #(define-markup-command (markupWithHeader layout props markup) (markup?)
1140 "Interpret the given markup with the header fields added to the props.
1141 This way, one can re-use the same functions (using fromproperty
1142 #'header:field) in the header block and as top-level markup."
1143 (let* (
1144 ; TODO: If we are inside a score, add the score's local header block, too!
1145 ; Currently, I only use the global header block, stored in $defaultheader
1146 (scopes (list $defaultheader))
1147 (alists (map ly:module->alist scopes))
1149 (prefixed-alist
1150 (map (lambda (alist)
1151 (map (lambda (entry)
1152 (cons
1153 (string->symbol (string-append "header:" (symbol->string (car entry))))
1154 (cdr entry)))
1155 alist))
1156 alists))
1157 (props (append prefixed-alist
1158 props
1159 (layout-extract-page-properties layout)))
1161 (interpret-markup layout props markup)
1170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1171 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1172 %%%%% Equally spacing multiple columns (e.g. for translations)
1173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1176 % Credits: Nicolas Sceaux on the lilypond-user mailinglist
1177 #(define-markup-command (columns layout props args) (markup-list?)
1178 (let ((line-width (/ (chain-assoc-get 'line-width props
1179 (ly:output-def-lookup layout 'line-width))
1180 (max (length args) 1))))
1181 (interpret-markup layout props
1182 (make-line-markup (map (lambda (line)
1183 (markup #:pad-to-box `(0 . ,line-width) '(0 . 0)
1184 #:override `(line-width . ,line-width)
1185 line))
1186 args)))))
1189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1191 %%%%% Defaults for instrument names, short names, cue names, etc.
1192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1195 %%% Clef definitions, either old-style (using the Breitkopf style) or new style
1196 FlClef = \clef "treble"
1197 FlIClef = \FlClef
1198 FlIIClef = \FlClef
1199 ObClef = \clef "treble"
1200 ObIClef = \ObClef
1201 ObIIClef = \ObClef
1202 ClIClef = \clef "treble"
1203 ClIIClef = \ClIClef
1204 FagClef = \clef "bass"
1205 FagIClef = \FagClef
1206 FagIIClef = \FagClef
1207 CFagClef = \clef "bass"
1208 CorClef = \clef "treble"
1209 CorIClef = \CorClef
1210 CorIIClef = \CorClef
1211 TrClef = \clef "tenor"
1212 TrIClef = \TrClef
1213 TrIIClef = \TrClef
1214 TrIIIClef = \clef "bass"
1215 TbeIClef = \clef "treble"
1216 TbeIIClef = \clef "treble"
1217 TimClef = \clef "bass"
1218 VClef = \clef "treble"
1219 VIClef = \VClef
1220 VIIClef = \VClef
1221 VaClef = \clef "alto"
1222 VaIClef = \VaClef
1223 VaIIClef = \VaClef
1224 VcBClef = \clef "bass"
1225 VcClef = \VcBClef
1226 CbClef = \VcBClef
1227 SClef = \clef "treble"
1228 AClef = \clef "treble"
1229 TClef = \clef "treble_8"
1230 BClef = \clef "bass"
1231 SSoloClef = \SClef
1232 ASoloClef = \AClef
1233 TSoloClef = \TClef
1234 BSoloClef = \BClef
1235 OIClef = \clef "treble"
1236 OIIClef = \clef "bass"
1240 FlInstrumentName = "Flauti"
1241 FlIInstrumentName = "Flauto I"
1242 FlIIInstrumentName = "Flauto II"
1243 ObInstrumentName = "Oboi"
1244 ObIInstrumentName = "Oboe I"
1245 ObIIInstrumentName = "Oboe II"
1246 ClInstrumentName = "Clarinetti"
1247 ClIInstrumentName = "Clarinetto I"
1248 ClIIInstrumentName = "Clarinetto II"
1249 FagInstrumentName = "Fagotti"
1250 FagIInstrumentName = "Fagotto I"
1251 FagIIInstrumentName = "Fagotto II"
1252 CFagInstrumentName = "Contrafagotto"
1253 CorInstrumentName = "Corni"
1254 CorIInstrumentName = "Corno I"
1255 CorIIInstrumentName = "Corno II"
1256 TrInstrumentName = "Tromboni"
1257 TrIInstrumentName = "Trombone I"
1258 TrIIInstrumentName = "Trombone II"
1259 TrIIIInstrumentName = "Trombone III"
1260 TbeInstrumentName = "Trombe"
1261 TbeIInstrumentName = "Tromba I"
1262 TbeIIInstrumentName = "Tromba II"
1263 TimInstrumentName = "Timpani"
1264 VIInstrumentName = "Violino I"
1265 VIIInstrumentName = "Violino II"
1266 VaInstrumentName = "Viola"
1267 VaIInstrumentName = "Viola I"
1268 VaIIInstrumentName = "Viola II"
1269 VcBInstrumentName = \markup {\column { "Cello e" "Contrabbasso"}}
1270 VcInstrumentName ="Violoncello"
1271 CbInstrumentName ="Basso"
1272 SInstrumentName = "Soprano"
1273 AInstrumentName = "Alto"
1274 TInstrumentName = "Tenore"
1275 BInstrumentName = "Basso"
1276 SSoloInstrumentName = "Soprano Solo"
1277 TSoloInstrumentName = "Tenore Solo"
1278 BSoloInstrumentName = "Basso Solo"
1279 ASoloInstrumentName = "Alto Solo"
1280 OInstrumentName = "Organo"
1282 ChInstrumentTitle = "Coro"
1285 FlShortInstrumentName = "Fl."
1286 FlIShortInstrumentName = "Fl. I"
1287 FlIIShortInstrumentName = "Fl. II"
1288 ObShortInstrumentName = "Ob."
1289 ObIShortInstrumentName = "Ob. I"
1290 ObIIShortInstrumentName = "Ob. II"
1291 ClShortInstrumentName = "Cl."
1292 ClIShortInstrumentName = "Cl.I"
1293 ClIIShortInstrumentName = "Cl.II"
1294 FagShortInstrumentName = "Fag."
1295 FagIShortInstrumentName = "Fag. I"
1296 FagIIShortInstrumentName = "Fag. II"
1297 CFagShortInstrumentName = "Cfag."
1298 CorShortInstrumentName = "Cor."
1299 CorIShortInstrumentName = "Cor.I"
1300 CorIIShortInstrumentName = "Cor.II"
1301 TrShortInstrumentName = "Tr."
1302 TrIShortInstrumentName = "Tr. I"
1303 TrIIShortInstrumentName = "Tr. II"
1304 TrIIIShortInstrumentName = "Tr. III"
1305 TbeShortInstrumentName = "Tbe."
1306 TbeIShortInstrumentName = "Tbe.I"
1307 TbeIIShortInstrumentName = "Tbe.II"
1308 TimShortInstrumentName = "Tim."
1309 VIShortInstrumentName = "V.I"
1310 VIIShortInstrumentName = "V.II"
1311 VaShortInstrumentName = "Va."
1312 VaIShortInstrumentName = "Va.I"
1313 VaIIShortInstrumentName = "Va.II"
1314 VcBShortInstrumentName = \markup{\column{"Vc." "e B."}}
1315 VcShortInstrumentName = "Vc."
1316 CbShortInstrumentName = "B."
1317 SShortInstrumentName = "S."
1318 AShortInstrumentName = "A."
1319 TShortInstrumentName = "T."
1320 BShortInstrumentName = "B."
1321 SSoloShortInstrumentName = "S.Solo"
1322 ASoloShortInstrumentName = "A.Solo"
1323 TSoloShortInstrumentName = "T.Solo"
1324 BSoloShortInstrumentName = "B.Solo"
1325 OShortInstrumentName = "Org."
1329 newInstrument = #(define-music-function (parser location instr) (string?)
1331 \set Voice.instrumentCueName = #$(string-join (list "+" instr))
1334 cueText = #(define-music-function (parser location instr) (string?)
1336 \set Voice.instrumentCueName = $instr
1340 cueFl = "Fl"
1341 cueCl = "Clt"
1342 cueClI = "Clt I"
1343 cueClII = "Clt II"
1344 cueCor = "Cor"
1345 cueCorI = "Cor I"
1346 cueCorII = "Cor II"
1347 cueTbe = "Tbe"
1348 cueTbeI = "Tbe I"
1349 cueTbeII = "Tbe II"
1350 cueTim = "Tim"
1351 cueVI = "V I"
1352 cueVII = "V II"
1353 cueVa = "Va"
1354 cueVaI = "Va I"
1355 cueVaII = "Va II"
1356 cueVcB = "Vc/B"
1357 cueArchi = "Archi"
1358 cueS = "S"
1359 cueA = "A"
1360 cueT = "T"
1361 cueB = "B"
1362 cueO = "Org"
1367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1369 %%%%% SCORE NUMBERS FOR PUBLISHING
1370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1373 scoreNumber =
1374 #(define-markup-command (scoreNumber layout props nr) (markup?)
1375 (interpret-markup layout props (markup (format "~a-~a" EKnumber nr)))
1378 FullScoreNumber = "1"
1379 PianoScoreNumber = "2"
1380 VocalScoreNumber = "3"
1382 ChoirScoreNumber = "10"
1383 SNumber = "11"
1384 ANumber = "12"
1385 TNumber = "13"
1386 BNumber = "14"
1387 SoloScoreNumber = "15"
1388 SSoloNumber = "16"
1389 ASoloNumber = "17"
1390 TSoloNumber = "18"
1391 BSoloNumber = "19"
1393 ONumber = "20"
1395 InstrumentsNumber = "25"
1396 VINumber = "30"
1397 VIINumber = "31"
1398 VaNumber = "32"
1399 VcBNumber = "33"
1401 FlINumber = "40"
1402 FlIINumber = "41"
1403 ObINumber = "42"
1404 ObIINumber = "43"
1405 ClINumber = "44"
1406 ClIINumber = "45"
1407 FagINumber = "46"
1408 FagIINumber = "47"
1409 CFagNumber = "48"
1411 CorINumber = "50"
1412 CorIINumber = "51"
1413 TreINumber = "52"
1414 TreIINumber = "53"
1415 TrbINumber = "54"
1416 TrbIINumber = "55"
1417 TrbIIINumber = "56"
1418 TbaNumber = "57"
1420 TimNumber = "60"
1421 ArpaNumber = "65"
1425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1427 %%%%% SCORE (HEADER / LAYOUT) SETTINGS
1428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1431 \paper {
1432 left-margin = 2\cm
1433 right-margin = 2\cm
1434 % line-width = 17\cm
1435 bottom-margin = 1\cm
1436 top-margin = 1\cm
1437 % after-title-space = 0.5\cm
1438 ragged-bottom = ##f
1439 ragged-last-bottom = ##f
1441 \layout {
1442 \context {
1443 \ChoirStaff
1444 % If only one non-empty staff in a system exists, still print the backet
1445 \override SystemStartBracket #'collapse-height = #1
1446 \consists "Instrument_name_engraver"
1448 \context {
1449 \StaffGroup
1450 % If only one non-empty staff in a system exists, still print the backet
1451 \override SystemStartBracket #'collapse-height = #1
1452 \consists "Instrument_name_engraver"
1454 \context {
1455 \GrandStaff
1456 \override SystemStartBracket #'collapse-height = #1
1457 \consists "Instrument_name_engraver"
1459 \context {
1460 \Score
1461 % Force multi-measure rests to be written as one span
1462 \override MultiMeasureRest #'expand-limit = #3
1463 skipBars = ##t
1464 autoBeaming = ##f
1465 % hairpinToBarline = ##f
1466 \override BarNumber #'break-visibility = #end-of-line-invisible
1467 \override CombineTextScript #'avoid-slur = #'outside
1468 barNumberVisibility = #(every-nth-bar-number-visible 5)
1469 \override DynamicTextSpanner #'dash-period = #-1.0
1470 \override InstrumentSwitch #'font-size = #-1
1472 % Rest collision
1473 \override RestCollision #'positioning-done = #merge-rests-on-positioning
1474 % Auto-Accidentals: Use modern-cautionary style...
1475 extraNatural = ##f
1476 autoAccidentals = #'(Staff (same-octave . 0))
1477 autoCautionaries = #'(Staff (any-octave . 0) (same-octave . 1))
1478 printKeyCancellation = ##t
1480 \context {
1481 \RemoveEmptyStaffContext
1483 \context {
1484 \Lyrics
1485 \override VerticalAxisGroup #'minimum-Y-extent = #'(0.5 . 0.5)
1491 \layout {
1492 \context {
1493 \type "Engraver_group"
1494 \name Dynamics
1495 % So that \cresc works, for example.
1496 \alias Voice
1497 \consists "Output_property_engraver"
1499 \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
1500 pedalSustainStrings = #'("Ped." "*Ped." "*")
1501 pedalUnaCordaStrings = #'("una corda" "" "tre corde")
1503 \consists "Piano_pedal_engraver"
1504 \consists "Script_engraver"
1505 \consists "Dynamic_engraver"
1506 \consists "Text_engraver"
1508 \override TextScript #'font-size = #2
1509 \override TextScript #'font-shape = #'italic
1510 \override DynamicText #'extra-offset = #'(0 . 2.5)
1511 \override Hairpin #'extra-offset = #'(0 . 2.5)
1513 \consists "Skip_event_swallow_translator"
1515 \consists "Axis_group_engraver"
1517 \context {
1518 \PianoStaff
1519 \accepts Dynamics
1520 % \override VerticalAlignment #'forced-distance = #7