Move instrument names to separate include file
[orchestrallily.git] / orchestrallily.ly
blob27917fbd03e4ca1aebeda1aa6ea1d9d40b6e688b
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 newInstrument = #(define-music-function (parser location instr) (string?)
661 \set Voice.instrumentCueName = #$(string-join (list "+" instr))
664 cueText = #(define-music-function (parser location instr) (string?)
666 \set Voice.instrumentCueName = $instr
670 % generate a cue music section with instrument names
671 % Parameters: \namedCueDuring NameOfQuote CueDirection CueInstrument OriginalInstrument music
672 % -) NameOfQuote CueDirection music are the parameters for \cueDuring
673 % -) CueInstrument and OriginalInstrument are the displayed instrument names
674 % typical call:
675 % \namedCueDuring #"vIQuote" #UP #"V.I" #"Sop." { R1*3 }
676 % This adds the notes from vIQuote (defined via \addQuote) to three measures, prints "V.I" at
677 % the beginning of the cue notes and "Sop." at the end
678 namedCueDuring = #(define-music-function (parser location cuevoice direction instrcue instr cuemusic) (string? number? string? string? ly:music?)
680 \cueDuring #$cuevoice #$direction { \tag #'cued \cueText #$instrcue $cuemusic \tag #'cued \cueText #$instr }
681 % \tag #'uncued $cuemusic
684 namedTransposedCueDuring = #(define-music-function (parser location cuevoice direction instrcue instr trans cuemusic) (string? number? string? string? ly:music? ly:music?)
686 \transposedCueDuring #$cuevoice #$direction $trans { \tag #'cued \cueText #$instrcue $cuemusic \tag #'cued \cueText #$instr }
687 % \tag #'uncued $cuemusic
691 % set the cue instrument name and clef
692 setClefCue = #(define-music-function (parser location instr clef)
693 (string? ly:music?)
695 \once \override Staff.Clef #'font-size = #-3 $clef
696 \set Voice.instrumentCueName = $instr
697 #} )
699 % generate a cue music section with instrument names and clef changes
700 % Parameters: \cleffedCueDuring NameOfQuote CueDirection CueInstrument CueClef OriginalInstrument OriginalClef music
701 % -) NameOfQuote CueDirection music are the parameters for \cueDuring
702 % -) CueInstrument and OriginalInstrument are the displayed instrument names
703 % -) CueClef and OriginalClef are the clefs for the the cue notes and the clef of the containing voice
704 % typical call:
705 % \cleffedCueDuring #"vIQuote" #UP #"V.I" #"treble" #"Basso" #"bass" { R1*3 }
706 % This adds the notes from vIQuote (defined via \addQuote) to three measures, prints "V.I" at
707 % the beginning of the cue notes and "Basso" at the end. The clef is changed to treble at the
708 % beginning of the cue notes and reset to bass at the end
709 cleffedCueDuring = #(define-music-function (parser location cuevoice direction instrcue clefcue instr clefinstr cuemusic)
710 (string? number? string? ly:music? string? ly:music? ly:music?)
712 \cueDuring #$cuevoice #$direction { \tag #'cued \setClefCue #$instrcue $clefcue $cuemusic \tag #'cued \setClefCue #$instr $clefinstr }
713 % \tag #'uncued $cuemusic
720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
722 %%%%% DYNAMICS
723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
727 shiftDynamics = #(define-music-function (parser location xshift yshift) (number? number?)
729 \once \override DynamicTextSpanner #'padding = $yshift
730 \once\override DynamicText #'extra-offset = #(cons $xshift $yshift)
733 ffz = #(make-dynamic-script "ffz")
734 pf = #(make-dynamic-script "pf")
735 sempp = #(make-dynamic-script (markup #:line( #:with-dimensions '(0 . 0)
736 '(0 . 0) #:right-align #:normal-text #:italic "sempre" #:dynamic "pp")))
737 parenf = #(make-dynamic-script (markup #:line(#:normal-text #:italic #:fontsize 2 "(" #:dynamic "f" #:normal-text #:italic #:fontsize 2 ")" )))
738 parenp = #(make-dynamic-script (markup #:line(#:normal-text #:italic #:fontsize 2 "(" #:dynamic "p" #:normal-text #:italic #:fontsize 2 ")" )))
739 pdolce = #(make-dynamic-script (markup #:line(#:dynamic "p" #:with-dimensions '(0 . 0) '(0 . 0) #:normal-text #:italic "dolce" )))
743 dim = #(make-span-event 'DecrescendoEvent START)
744 enddim = #(make-span-event 'DecrescendoEvent STOP)
745 decresc = #(make-span-event 'DecrescendoEvent START)
746 enddecresc = #(make-span-event 'DecrescendoEvent STOP)
747 cresc = #(make-span-event 'CrescendoEvent START)
748 endcresc = #(make-span-event 'CrescendoEvent STOP)
750 setCresc = {
751 \set crescendoText = \markup { \italic "cresc." }
752 \set crescendoSpanner = #'text
753 \override DynamicTextSpanner #'style = #'dashed-line
755 setDecresc = {
756 \set decrescendoText = \markup { \italic "decresc." }
757 \set crescendoSpanner = #'text
758 \override DynamicTextSpanner #'style = #'dashed-line
760 setDim = {
761 \set decrescendoText = \markup { \italic "dim." }
762 \set crescendoSpanner = #'text
763 \override DynamicTextSpanner #'style = #'dashed-line
766 newOrOldClef = #(define-music-function (parser location new old ) (string? string?)
767 (if (ly:get-option 'old-clefs) #{ \clef $old #} #{ \clef $new #})
772 %%% Thanks to "Gilles THIBAULT" <gilles.thibault@free.fr>, there is a way
773 % to remove also the fermata from R1-\fermataMarkup: By filtering the music
774 % and removing the corresponding events.
775 % Documented as an LSR snippet: http://lsr.dsi.unimi.it/LSR/Item?id=372
776 #(define (filterOneEventsMarkup event)
777 ( let ( (eventname (ly:music-property event 'name)) )
778 (not
779 (or ;; add here event name you do NOT want
780 (eq? eventname 'MultiMeasureTextEvent)
781 (eq? eventname 'AbsoluteDynamicEvent)
782 (eq? eventname 'TextScriptEvent)
783 (eq? eventname 'ArticulationEvent)
784 (eq? eventname 'CrescendoEvent)
785 (eq? eventname 'DecrescendoEvent)
790 filterArticulations = #(define-music-function (parser location music) (ly:music?)
791    (music-filter filterOneEventsMarkup music)
804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
806 %%%%% REST COMBINATION
807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
812 %% REST COMBINING, TAKEN FROM http://lsr.dsi.unimi.it/LSR/Item?id=336
814 %% Usage:
815 %% \new Staff \with {
816 %% \override RestCollision #'positioning-done = #merge-rests-on-positioning
817 %% } << \somevoice \\ \othervoice >>
818 %% or (globally):
819 %% \layout {
820 %% \context {
821 %% \Staff
822 %% \override RestCollision #'positioning-done = #merge-rests-on-positioning
823 %% }
824 %% }
826 %% Limitations:
827 %% - only handles two voices
828 %% - does not handle multi-measure/whole-measure rests
830 #(define (rest-score r)
831 (let ((score 0)
832 (yoff (ly:grob-property-data r 'Y-offset))
833 (sp (ly:grob-property-data r 'staff-position)))
834 (if (number? yoff)
835 (set! score (+ score 2))
836 (if (eq? yoff 'calculation-in-progress)
837 (set! score (- score 3))))
838 (and (number? sp)
839 (<= 0 2 sp)
840 (set! score (+ score 2))
841 (set! score (- score (abs (- 1 sp)))))
842 score))
844 #(define (merge-rests-on-positioning grob)
845 (let* ((can-merge #f)
846 (elts (ly:grob-object grob 'elements))
847 (num-elts (and (ly:grob-array? elts)
848 (ly:grob-array-length elts)))
849 (two-voice? (= num-elts 2)))
850 (if two-voice?
851 (let* ((v1-grob (ly:grob-array-ref elts 0))
852 (v2-grob (ly:grob-array-ref elts 1))
853 (v1-rest (ly:grob-object v1-grob 'rest))
854 (v2-rest (ly:grob-object v2-grob 'rest)))
855 (and
856 (ly:grob? v1-rest)
857 (ly:grob? v2-rest)
858 (let* ((v1-duration-log (ly:grob-property v1-rest 'duration-log))
859 (v2-duration-log (ly:grob-property v2-rest 'duration-log))
860 (v1-dot (ly:grob-object v1-rest 'dot))
861 (v2-dot (ly:grob-object v2-rest 'dot))
862 (v1-dot-count (and (ly:grob? v1-dot)
863 (ly:grob-property v1-dot 'dot-count -1)))
864 (v2-dot-count (and (ly:grob? v2-dot)
865 (ly:grob-property v2-dot 'dot-count -1))))
866 (set! can-merge
867 (and
868 (number? v1-duration-log)
869 (number? v2-duration-log)
870 (= v1-duration-log v2-duration-log)
871 (eq? v1-dot-count v2-dot-count)))
872 (if can-merge
873 ;; keep the rest that looks best:
874 (let* ((keep-v1? (>= (rest-score v1-rest)
875 (rest-score v2-rest)))
876 (rest-to-keep (if keep-v1? v1-rest v2-rest))
877 (dot-to-kill (if keep-v1? v2-dot v1-dot)))
878 ;; uncomment if you're curious of which rest was chosen:
879 ;;(ly:grob-set-property! v1-rest 'color green)
880 ;;(ly:grob-set-property! v2-rest 'color blue)
881 (ly:grob-suicide! (if keep-v1? v2-rest v1-rest))
882 (if (ly:grob? dot-to-kill)
883 (ly:grob-suicide! dot-to-kill))
884 (ly:grob-set-property! rest-to-keep 'direction 0)
885 (ly:rest::y-offset-callback rest-to-keep)))))))
886 (if can-merge
888 (ly:rest-collision::calc-positioning-done grob))))
894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
896 %%%%% TABLE OF CONTENTS
897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
901 contentsTitle = "Inhalt / Contents"
903 \paper {
904 tocTitleMarkup = \markup \fill-line{
905 \null
906 \column {
907 \override #(cons 'line-width (* 7 cm))
908 \line{ \fill-line {\piece-title {\contentsTitle} \null }}
909 \hspace #1
911 \null
913 tocItemMarkup = \markup \fill-line {
914 \null
915 \column {
916 \override #(cons 'line-width (* 7 cm ))
917 \line { \fill-line{\fromproperty #'toc:text \fromproperty #'toc:page }}
919 \null
924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
926 %%%%% TITLE PAGE / HEADER
927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
930 #(define-markup-command (when-property layout props symbol markp) (symbol? markup?)
931 (if (chain-assoc-get symbol props)
932 (interpret-markup layout props markp)
933 (ly:make-stencil '() '(1 . -1) '(1 . -1))))
935 #(define-markup-command (vspace layout props amount) (number?)
936 "This produces a invisible object taking vertical space."
937 (let ((amount (* amount 3.0)))
938 (if (> amount 0)
939 (ly:make-stencil "" (cons -1 1) (cons 0 amount))
940 (ly:make-stencil "" (cons -1 1) (cons amount amount)))))
944 titlePageMarkup = \markup { \fontsize #2 \when-property #'header:title \column {
945 \vspace #4
946 \fill-line { \fontsize #8 \fromproperty #'header:composer }
947 \vspace #1
948 \fill-line { \fontsize #8 \fromproperty #'header:poet }
949 \vspace #4
950 \fill-line { \fontsize #10 \bold \fromproperty #'header:titlepagetitle }
951 \vspace #1
952 \fontsize #2 \when-property #'header:titlepagesubtitle {
953 \fill-line { \fromproperty #'header:titlepagesubtitle }
954 \vspace #1
956 \fill-line { \postscript #"-20 0 moveto 40 0 rlineto stroke" }
957 \vspace #8
958 \fill-line { \fontsize #5 \fromproperty #'header:ensemble }
959 \vspace #0.02
960 \fill-line { \fontsize #2 \fromproperty #'header:instruments }
961 \vspace #9
962 \fill-line { \fontsize #5 \fromproperty #'header:date }
963 \vspace #1
964 \fill-line { \fontsize #5 \fromproperty #'header:scoretype }
965 \vspace #8
966 \fontsize #2 \when-property #'header:enteredby {
967 \fill-line { "Herausgegeben von: / Edited by:"}
968 \vspace #0.
969 \fill-line { \fromproperty #'header:enteredby }
971 \fill-line {
972 \when-property #'header:arrangement \column {
973 \vspace #8
974 \fill-line { \fontsize #3 \fromproperty #'header:arrangement }
980 titleHeaderMarkup = \markup {
981 \override #'(baseline-skip . 3.5)
982 \column {
983 \override #'(baseline-skip . 3.5)
984 \column {
985 \huge \bigger \bold
986 \fill-line {
987 \bigger \fromproperty #'header:title
989 \fill-line {
990 \large \smaller \bold
991 \bigger \fromproperty #'header:subtitle
993 \fill-line {
994 \smaller \bold
995 \fromproperty #'header:subsubtitle
997 \fill-line {
998 { \large \bold \fromproperty #'header:instrument }
1000 \fill-line {
1001 \fromproperty #'header:poet
1002 \fromproperty #'header:composer
1004 \fill-line {
1005 \fromproperty #'header:meter
1006 \fromproperty #'header:arranger
1012 titleScoreMarkup = \markup \piece-title \fromproperty #'header:piece
1014 \paper {
1015 scoreTitleMarkup = \titleScoreMarkup
1016 bookTitleMarkup = \titleHeaderMarkup
1021 %%%%%%%%%%%%%% headers and footers %%%%%%%%%%%%%%%%%%%%%%%%%%
1023 #(define (first-score-page layout props arg)
1024 (let* ((label 'first-score-page)
1025 (table (ly:output-def-lookup layout 'label-page-table))
1026 (label-page (and (list? table) (assoc label table)))
1027 (page-number (and label-page (cdr label-page)))
1029 (if (eq? (chain-assoc-get 'page:page-number props -1) page-number)
1030 (interpret-markup layout props arg)
1031 empty-stencil)))
1033 #(define no-header-table '())
1034 thisPageNoHeader = #(define-music-function (parser location) ()
1035 (let* ((label (gensym "header")))
1036 (set! no-header-table (cons label no-header-table))
1037 (make-music 'Music
1038 'page-marker #t
1039 'page-label label)))
1042 % TODO: Use the no-header-table!
1043 #(define (is-header-page layout props arg)
1044 (let* ((page-number (chain-assoc-get 'page:page-number props -1))
1046 (if (and (> page-number 2) (!= page-number 7))
1047 (interpret-markup layout props arg)
1048 empty-stencil)))
1050 #(define no-footer-table '())
1051 thisPageNoFooter = #(define-music-function (parser location) ()
1052 (let* ((label (gensym "footer")))
1053 (set! no-footer-table (cons label no-footer-table))
1054 (make-music 'Music
1055 'page-marker #t
1056 'page-label label)))
1058 % TODO: Use the no-footer-table!
1059 #(define (is-footer-page layout props arg)
1060 (let* ((page-number (chain-assoc-get 'page:page-number props -1))
1061 (label 'first-score-page)
1062 (table (ly:output-def-lookup layout 'label-page-table))
1063 (label-page (and (list? table) (assoc label table)))
1064 ;(page-number (and label-page (cdr label-page)))
1066 (if (and (> page-number 2) (!= page-number 7))
1067 (interpret-markup layout props arg)
1068 empty-stencil)))
1071 #(define copyright-footer-table '())
1072 thisPageCopyrightFooter = #(define-music-function (parser location) ()
1073 (let* ((label (gensym "copyrightfooter")))
1074 (set! copyright-footer-table (cons label copyright-footer-table))
1075 (make-music 'Music
1076 'page-marker #t
1077 'page-label label)))
1079 #(define copyright-pg 1)
1080 #(define (set-copyright-pg page)
1081 (set! copyright-pg page)
1084 % TODO: Use the copyright-footer-table!
1085 #(define (copyright-page layout props arg)
1086 (if (= (chain-assoc-get 'page:page-number props -1) copyright-pg)
1087 (interpret-markup layout props arg)
1088 empty-stencil))
1091 \paper {
1092 oddHeaderMarkup = \markup \fill-line {
1093 %% force the header to take some space, otherwise the
1094 %% page layout becomes a complete mess.
1096 \on-the-fly #is-header-page \fromproperty #'header:title
1097 \on-the-fly #is-header-page \fromproperty #'page:page-number-string
1099 evenHeaderMarkup = \markup \fill-line {
1100 \on-the-fly #is-header-page \fromproperty #'page:page-number-string
1101 \on-the-fly #is-header-page \fromproperty #'header:composer
1105 oddFooterMarkup = \markup {
1106 \column {
1107 \fill-line {
1108 %% publisher header field only on title page.
1109 \on-the-fly #first-page \fromproperty #'header:publisher
1111 \fill-line {
1112 %% copyright on the first real score page
1113 \on-the-fly #copyright-page \fromproperty #'header:copyright
1114 \on-the-fly #copyright-page \null
1116 \fill-line {
1117 %% All other pages get the number of the edition centered
1118 \on-the-fly #is-footer-page \fromproperty #'header:scorenumber
1135 % Interpret the given markup with the header fields added to the props.
1136 % This way, one can re-use the same functions (using fromproperty
1137 % #'header:field) in the header block and as top-level markup.
1139 % This function is originally copied from mark-up-title (file scm/titling.scm),
1140 % which is lilypond's internal function to handle the title markups. I needed
1141 % to replace the scopes and manually add the $defaultheader (which is internally
1142 % done in paper-book.cc before calling mark-up-title. Also, I don't extract the
1143 % markup from the header block, but use the given markup.
1145 % I'm not sure if I really need the page properties in props, too... But I
1146 % suppose it does not hurt, either.
1147 #(define-markup-command (markupWithHeader layout props markup) (markup?)
1148 "Interpret the given markup with the header fields added to the props.
1149 This way, one can re-use the same functions (using fromproperty
1150 #'header:field) in the header block and as top-level markup."
1151 (let* (
1152 ; TODO: If we are inside a score, add the score's local header block, too!
1153 ; Currently, I only use the global header block, stored in $defaultheader
1154 (scopes (list $defaultheader))
1155 (alists (map ly:module->alist scopes))
1157 (prefixed-alist
1158 (map (lambda (alist)
1159 (map (lambda (entry)
1160 (cons
1161 (string->symbol (string-append "header:" (symbol->string (car entry))))
1162 (cdr entry)))
1163 alist))
1164 alists))
1165 (props (append prefixed-alist
1166 props
1167 (layout-extract-page-properties layout)))
1169 (interpret-markup layout props markup)
1178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1180 %%%%% Equally spacing multiple columns (e.g. for translations)
1181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1184 % Credits: Nicolas Sceaux on the lilypond-user mailinglist
1185 #(define-markup-command (columns layout props args) (markup-list?)
1186 (let ((line-width (/ (chain-assoc-get 'line-width props
1187 (ly:output-def-lookup layout 'line-width))
1188 (max (length args) 1))))
1189 (interpret-markup layout props
1190 (make-line-markup (map (lambda (line)
1191 (markup #:pad-to-box `(0 . ,line-width) '(0 . 0)
1192 #:override `(line-width . ,line-width)
1193 line))
1194 args)))))
1200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1202 %%%%% SCORE (HEADER / LAYOUT) SETTINGS
1203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1206 \paper {
1207 left-margin = 2\cm
1208 right-margin = 2\cm
1209 % line-width = 17\cm
1210 bottom-margin = 1\cm
1211 top-margin = 1\cm
1212 % after-title-space = 0.5\cm
1213 ragged-right = ##f
1214 ragged-last = ##f
1215 ragged-bottom = ##f
1216 ragged-last-bottom = ##f
1218 \layout {
1219 \context {
1220 \ChoirStaff
1221 % If only one non-empty staff in a system exists, still print the backet
1222 \override SystemStartBracket #'collapse-height = #1
1223 \consists "Instrument_name_engraver"
1225 \context {
1226 \StaffGroup
1227 % If only one non-empty staff in a system exists, still print the backet
1228 \override SystemStartBracket #'collapse-height = #1
1229 \consists "Instrument_name_engraver"
1231 \context {
1232 \GrandStaff
1233 \override SystemStartBracket #'collapse-height = #1
1234 \consists "Instrument_name_engraver"
1236 \context {
1237 \PianoStaff
1238 \override VerticalAxisGroup #'keep-fixed-while-stretching = ##t
1240 \context {
1241 \FiguredBass
1242 \override VerticalAxisGroup #'keep-fixed-while-stretching = ##t
1243 \override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 1)
1244 \override VerticalAxisGroup #'padding = #0
1246 \context {
1247 \Score
1248 % Force multi-measure rests to be written as one span
1249 \override MultiMeasureRest #'expand-limit = #3
1250 skipBars = ##t
1251 autoBeaming = ##f
1252 % hairpinToBarline = ##f
1253 \override BarNumber #'break-visibility = #end-of-line-invisible
1254 \override CombineTextScript #'avoid-slur = #'outside
1255 barNumberVisibility = #(every-nth-bar-number-visible 5)
1256 \override DynamicTextSpanner #'dash-period = #-1.0
1257 \override InstrumentSwitch #'font-size = #-1
1259 % Rest collision
1260 \override RestCollision #'positioning-done = #merge-rests-on-positioning
1261 % Auto-Accidentals: Use modern-cautionary style...
1262 extraNatural = ##f
1263 autoAccidentals = #'(Staff (same-octave . 0))
1264 autoCautionaries = #'(Staff (any-octave . 0) (same-octave . 1))
1265 printKeyCancellation = ##t
1267 \context {
1268 \RemoveEmptyStaffContext
1270 \context {
1271 \Lyrics
1272 \override VerticalAxisGroup #'minimum-Y-extent = #'(0.5 . 0.5)
1278 \layout {
1279 \context {
1280 \type "Engraver_group"
1281 \name Dynamics
1282 % So that \cresc works, for example.
1283 \alias Voice
1284 \consists "Output_property_engraver"
1286 \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
1287 pedalSustainStrings = #'("Ped." "*Ped." "*")
1288 pedalUnaCordaStrings = #'("una corda" "" "tre corde")
1290 \consists "Piano_pedal_engraver"
1291 \consists "Script_engraver"
1292 \consists "Dynamic_engraver"
1293 \consists "Text_engraver"
1295 \override TextScript #'font-size = #2
1296 \override TextScript #'font-shape = #'italic
1297 \override DynamicText #'extra-offset = #'(0 . 2.5)
1298 \override Hairpin #'extra-offset = #'(0 . 2.5)
1300 \consists "Skip_event_swallow_translator"
1302 \consists "Axis_group_engraver"
1304 \context {
1305 \PianoStaff
1306 \accepts Dynamics
1307 % \override VerticalAlignment #'forced-distance = #7