Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / ly / music-functions-init.ly
blobf016fe0eaf847cfcc4a977f7496afa776e17acb5
1 % -*-Scheme-*-
3 \version "2.12.0"
6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 %% this file is alphabetically sorted.
8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10 %% need SRFI-1 for filter; optargs for lambda*
11 #(use-modules (srfi srfi-1)
12 (ice-9 optargs))
14 %% TODO: using define-music-function in a .scm causes crash.
16 acciaccatura =
17 #(def-grace-function startAcciaccaturaMusic stopAcciaccaturaMusic
18 (_i "Create an acciaccatura from the following music expression"))
20 %% keep these two together
21 "instrument-definitions" = #'()
22 addInstrumentDefinition =
23 #(define-music-function
24 (parser location name lst) (string? list?)
25 (_i "Create instrument @var{name} with properties @var{list}.")
26 (set! instrument-definitions (acons name lst instrument-definitions))
27 (make-music 'SequentialMusic 'void #t))
29 addQuote =
30 #(define-music-function (parser location name music) (string? ly:music?)
31 (_i "Define @var{music} as a quotable music expression named
32 @var{name}")
33 (add-quotable parser name music)
34 (make-music 'SequentialMusic 'void #t))
36 %% keep these two together
37 afterGraceFraction = #(cons 6 8)
38 afterGrace =
39 #(define-music-function
40 (parser location main grace)
41 (ly:music? ly:music?)
42 (_i "Create @var{grace} note(s) after a @var{main} music expression.")
43 (let*
44 ((main-length (ly:music-length main))
45 (fraction (ly:parser-lookup parser 'afterGraceFraction)))
47 (make-simultaneous-music
48 (list
49 main
50 (make-sequential-music
51 (list
53 (make-music 'SkipMusic
54 'duration (ly:make-duration
55 0 0
56 (* (ly:moment-main-numerator main-length)
57 (car fraction))
58 (* (ly:moment-main-denominator main-length)
59 (cdr fraction)) ))
60 (make-music 'GraceMusic
61 'element grace)))))))
64 %% music identifiers not allowed at top-level,
65 %% so this is a music-function instead.
66 allowPageTurn =
67 #(define-music-function (location parser) ()
68 (_i "Allow a page turn. May be used at toplevel (ie between scores or
69 markups), or inside a score.")
70 (make-music 'EventChord
71 'page-marker #t
72 'page-turn-permission 'allow
73 'elements (list (make-music 'PageTurnEvent
74 'break-permission 'allow))))
76 applyContext =
77 #(define-music-function (parser location proc) (procedure?)
78 (_i "Modify context properties with Scheme procedure @var{proc}.")
79 (make-music 'ApplyContext
80 'origin location
81 'procedure proc))
83 applyMusic =
84 #(define-music-function (parser location func music) (procedure? ly:music?)
85 (_i"Apply procedure @var{func} to @var{music}.")
86 (func music))
88 applyOutput =
89 #(define-music-function (parser location ctx proc) (symbol? procedure?)
90 (_i "Apply function @code{proc} to every layout object in context @code{ctx}")
91 (make-music 'ApplyOutputEvent
92 'origin location
93 'procedure proc
94 'context-type ctx))
96 appoggiatura =
97 #(def-grace-function startAppoggiaturaMusic stopAppoggiaturaMusic
98 (_i "Create an appoggiatura from @var{music}"))
100 % for regression testing purposes.
101 assertBeamQuant =
102 #(define-music-function (parser location l r) (pair? pair?)
103 (_i "Testing function: check whether the beam quants @var{l} and @var{r} are correct")
104 (make-grob-property-override 'Beam 'positions
105 (ly:make-simple-closure
106 (ly:make-simple-closure
107 (append
108 (list chain-grob-member-functions `(,cons 0 0))
109 (check-quant-callbacks l r))))))
111 % for regression testing purposes.
112 assertBeamSlope =
113 #(define-music-function (parser location comp) (procedure?)
114 (_i "Testing function: check whether the slope of the beam is the same as @code{comp}")
115 (make-grob-property-override 'Beam 'positions
116 (ly:make-simple-closure
117 (ly:make-simple-closure
118 (append
119 (list chain-grob-member-functions `(,cons 0 0))
120 (check-slope-callbacks comp))))))
122 autochange =
123 #(define-music-function (parser location music) (ly:music?)
124 (_i "Make voices that switch between staves automatically")
125 (make-autochange-music parser music))
129 balloonGrobText =
130 #(define-music-function (parser location grob-name offset text)
131 (symbol? number-pair? markup?)
132 (_i "Attach @var{text} to @var{grob-name} at offset @var{offset}
133 use like @code{\\once})")
134 (make-music 'AnnotateOutputEvent
135 'symbol grob-name
136 'X-offset (car offset)
137 'Y-offset (cdr offset)
138 'text text))
140 balloonText =
141 #(define-music-function (parser location offset text) (number-pair? markup?)
142 (_i "Attach @var{text} at @var{offset} (use like @code{\\tweak})")
143 (make-music 'AnnotateOutputEvent
144 'X-offset (car offset)
145 'Y-offset (cdr offset)
146 'text text))
148 bar =
149 #(define-music-function (parser location type) (string?)
150 (_i "Insert a bar line of type @var{type}")
151 (context-spec-music
152 (make-property-set 'whichBar type)
153 'Timing))
155 barNumberCheck =
156 #(define-music-function (parser location n) (integer?)
157 (_i "Print a warning if the current bar number is not @var{n}.")
158 (make-music 'ApplyContext
159 'origin location
160 'procedure
161 (lambda (c)
162 (let*
163 ((cbn (ly:context-property c 'currentBarNumber)))
164 (if (and (number? cbn) (not (= cbn n)))
165 (ly:input-message location "Barcheck failed got ~a expect ~a"
166 cbn n))))))
168 bendAfter =
169 #(define-music-function (parser location delta) (real?)
170 (_i "Create a fall or doit of pitch interval @var{delta}.")
171 (make-music 'BendAfterEvent
172 'delta-step delta))
174 bookOutputName =
175 #(define-music-function (parser location newfilename) (string?)
176 (_i "Direct output for the current book block to @var{newfilename}.")
177 (set! book-filename newfilename)
178 (make-music 'SequentialMusic 'void #t))
180 bookOutputSuffix =
181 #(define-music-function (parser location newsuffix) (string?)
182 (_i "Set the output filename suffix for the current book block to
183 @var{newsuffix}.")
184 (set! book-output-suffix newsuffix)
185 (make-music 'SequentialMusic 'void #t))
187 %% why a function?
188 breathe =
189 #(define-music-function (parser location) ()
190 (_i "Insert a breath mark.")
191 (make-music 'EventChord
192 'origin location
193 'elements (list (make-music 'BreathingEvent))))
197 clef =
198 #(define-music-function (parser location type) (string?)
199 (_i "Set the current clef to @var{type}.")
200 (make-clef-set type))
202 cueDuring =
203 #(define-music-function
204 (parser location what dir main-music) (string? ly:dir? ly:music?)
205 (_i "Insert contents of quote @var{what} corresponding to @var{main-music},
206 in a CueVoice oriented by @var{dir}.")
207 (make-music 'QuoteMusic
208 'element main-music
209 'quoted-context-type 'Voice
210 'quoted-context-id "cue"
211 'quoted-music-name what
212 'quoted-voice-direction dir
213 'origin location))
217 displayLilyMusic =
218 #(define-music-function (parser location music) (ly:music?)
219 (_i "Display the LilyPond input representation of @var{music}
220 to the console.")
221 (newline)
222 (display-lily-music music parser)
223 music)
225 displayMusic =
226 #(define-music-function (parser location music) (ly:music?)
227 (_i "Display the internal representation of @var{music} to the console.")
228 (newline)
229 (display-scheme-music music)
230 music)
234 endSpanners =
235 #(define-music-function (parser location music) (ly:music?)
236 (_i "Terminate the next spanner prematurely after exactly one note without the need of a specific end spanner.")
237 (if (eq? (ly:music-property music 'name) 'EventChord)
238 (let*
239 ((elts (ly:music-property music 'elements))
240 (start-span-evs (filter (lambda (ev)
241 (and (music-has-type ev 'span-event)
242 (equal? (ly:music-property ev 'span-direction)
243 START)))
244 elts))
245 (stop-span-evs
246 (map (lambda (m)
247 (let* ((c (music-clone m)))
248 (set! (ly:music-property c 'span-direction) STOP)
250 start-span-evs))
251 (end-ev-chord (make-music 'EventChord
252 'elements stop-span-evs))
253 (total (make-music 'SequentialMusic
254 'elements (list music
255 end-ev-chord))))
256 total)
258 (ly:input-message location (_ "argument endSpanners is not an EventChord: ~a" music))))
262 featherDurations=
263 #(define-music-function (parser location factor argument) (ly:moment? ly:music?)
264 (_i "Adjust durations of music in @var{argument} by rational @var{factor}. ")
265 (let*
266 ((orig-duration (ly:music-length argument))
267 (multiplier (ly:make-moment 1 1)))
269 (music-map
270 (lambda (mus)
271 (if (and (eq? (ly:music-property mus 'name) 'EventChord)
272 (< 0 (ly:moment-main-denominator (ly:music-length mus))))
273 (begin
274 (ly:music-compress mus multiplier)
275 (set! multiplier (ly:moment-mul factor multiplier)))
277 mus)
278 argument)
280 (ly:music-compress
281 argument
282 (ly:moment-div orig-duration (ly:music-length argument)))
284 argument))
288 grace =
289 #(def-grace-function startGraceMusic stopGraceMusic
290 (_i "Insert @var{music} as grace notes."))
294 instrumentSwitch =
295 #(define-music-function
296 (parser location name) (string?)
297 (_i "Switch instrument to @var{name}, which must be predefined with
298 @code{\\addInstrumentDefinition}.")
299 (let*
300 ((handle (assoc name instrument-definitions))
301 (instrument-def (if handle (cdr handle) '()))
304 (if (not handle)
305 (ly:input-message location "No such instrument: ~a" name))
306 (context-spec-music
307 (make-music 'SimultaneousMusic
308 'elements
309 (map (lambda (kv)
310 (make-property-set
311 (car kv)
312 (cdr kv)))
313 instrument-def))
314 'Staff)))
318 keepWithTag =
319 #(define-music-function
320 (parser location tag music) (symbol? ly:music?)
321 (_i "Include only elements of @var{music} that are tagged with @var{tag}.")
322 (music-filter
323 (lambda (m)
324 (let* ((tags (ly:music-property m 'tags))
325 (res (memq tag tags)))
327 (eq? tags '())
328 res)))
329 music))
331 killCues =
332 #(define-music-function
333 (parser location music)
334 (ly:music?)
335 (_i "Remove cue notes from @var{music}.")
336 (music-map
337 (lambda (mus)
338 (if (and (string? (ly:music-property mus 'quoted-music-name))
339 (string=? (ly:music-property mus 'quoted-context-id "") "cue"))
340 (ly:music-property mus 'element)
341 mus)) music))
345 label =
346 #(define-music-function (parser location label) (symbol?)
347 (_i "Create @var{label} as a bookmarking label")
348 (make-music 'EventChord
349 'page-marker #t
350 'page-label label
351 'elements (list (make-music 'LabelEvent
352 'page-label label))))
356 makeClusters =
357 #(define-music-function
358 (parser location arg) (ly:music?)
359 (_i "Display chords in @var{arg} as clusters")
360 (music-map note-to-cluster arg))
362 musicMap =
363 #(define-music-function (parser location proc mus) (procedure? ly:music?)
364 (music-map proc mus))
368 %% noPageBreak and noPageTurn are music functions (not music indentifiers),
369 %% because music identifiers are not allowed at top-level.
370 noPageBreak =
371 #(define-music-function (location parser) ()
372 (_i "Forbid a page break. May be used at toplevel (ie between scores or
373 markups), or inside a score.")
374 (make-music 'EventChord
375 'page-marker #t
376 'page-break-permission 'forbid
377 'elements (list (make-music 'PageBreakEvent
378 'break-permission '()))))
380 noPageTurn =
381 #(define-music-function (location parser) ()
382 (_i "Forbid a page turn. May be used at toplevel (ie between scores or
383 markups), or inside a score.")
384 (make-music 'EventChord
385 'page-marker #t
386 'page-turn-permission 'forbid
387 'elements (list (make-music 'PageTurnEvent
388 'break-permission '()))))
392 octaveCheck =
393 #(define-music-function (parser location pitch-note) (ly:music?)
394 (_i "octave check")
396 (make-music 'RelativeOctaveCheck
397 'origin location
398 'pitch (pitch-of-note pitch-note)
401 ottava = #(define-music-function (parser location octave) (number?)
402 (_i "set the octavation ")
403 (make-ottava-set octave))
405 overrideBeamSettings =
406 #(define-music-function
407 (parser location
408 context time-signature rule-type grouping-rule)
409 (symbol? pair? symbol? pair?)
411 (_i "Override beamSettings in @var{context}
412 for time signatures of @var{time-signature} and rules of type
413 @var{rule-type} to have a grouping rule alist
414 @var{grouping-rule}.
415 @var{rule-type} can be @code{end} or @code{subdivide},
416 with a potential future value of @code{begin}.
417 @var{grouping-rule} is an alist of @var{(beam-type . grouping)}
418 entries. @var{grouping} is in units of @var{beam-type}. If
419 @var{beam-type} is @code{*}, grouping is in units of the denominator
420 of @var{time-signature}.")
422 ;; TODO -- add warning if largest value of grouping is
423 ;; greater than time-signature.
426 #(override-beam-setting
427 $time-signature $rule-type $grouping-rule $context)
430 overrideProperty =
431 #(define-music-function (parser location name property value)
432 (string? symbol? scheme?)
434 (_i "Set @var{property} to @var{value} in all grobs named @var{name}.
435 The @var{name} argument is a string of the form @code{\"Context.GrobName\"}
436 or @code{\"GrobName\"}")
438 (let*
439 ((name-components (string-split name #\.))
440 (context-name 'Bottom)
441 (grob-name #f))
443 (if (> 2 (length name-components))
444 (set! grob-name (string->symbol (car name-components)))
445 (begin
446 (set! grob-name (string->symbol (list-ref name-components 1)))
447 (set! context-name (string->symbol (list-ref name-components 0)))))
449 (make-music 'ApplyOutputEvent
450 'origin location
451 'context-type context-name
452 'procedure
453 (lambda (grob orig-context context)
454 (if (equal?
455 (cdr (assoc 'name (ly:grob-property grob 'meta)))
456 grob-name)
457 (set! (ly:grob-property grob property) value))))))
461 %% pageBreak and pageTurn are music functions (iso music indentifiers),
462 %% because music identifiers are not allowed at top-level.
463 pageBreak =
464 #(define-music-function (location parser) ()
465 (_i "Force a page break. May be used at toplevel (i.e. between scores or
466 markups), or inside a score.")
467 (make-music 'EventChord
468 'page-marker #t
469 'line-break-permission 'force
470 'page-break-permission 'force
471 'elements (list (make-music 'LineBreakEvent
472 'break-permission 'force)
473 (make-music 'PageBreakEvent
474 'break-permission 'force))))
476 pageTurn =
477 #(define-music-function (location parser) ()
478 (_i "Force a page turn between two scores or top-level markups.")
479 (make-music 'EventChord
480 'page-marker #t
481 'line-break-permission 'force
482 'page-break-permission 'force
483 'page-turn-permission 'force
484 'elements (list (make-music 'LineBreakEvent
485 'break-permission 'force)
486 (make-music 'PageBreakEvent
487 'break-permission 'force)
488 (make-music 'PageTurnEvent
489 'break-permission 'force))))
491 parallelMusic =
492 #(define-music-function (parser location voice-ids music) (list? ly:music?)
493 (_i "Define parallel music sequences, separated by '|' (bar check signs),
494 and assign them to the identifiers provided in @var{voice-ids}.
496 @var{voice-ids}: a list of music identifiers (symbols containing only letters)
498 @var{music}: a music sequence, containing BarChecks as limiting expressions.
500 Example:
502 @verbatim
503 \\parallelMusic #'(A B C) {
504 c c | d d | e e |
505 d d | e e | f f |
507 <==>
508 A = { c c | d d | }
509 B = { d d | e e | }
510 C = { e e | f f | }
511 @end verbatim
513 (let* ((voices (apply circular-list (make-list (length voice-ids) (list))))
514 (current-voices voices)
515 (current-sequence (list)))
517 ;; utilities
518 (define (push-music m)
519 "Push the music expression into the current sequence"
520 (set! current-sequence (cons m current-sequence)))
521 (define (change-voice)
522 "Stores the previously built sequence into the current voice and
523 change to the following voice."
524 (list-set! current-voices 0 (cons (make-music 'SequentialMusic
525 'elements (reverse! current-sequence))
526 (car current-voices)))
527 (set! current-sequence (list))
528 (set! current-voices (cdr current-voices)))
529 (define (bar-check? m)
530 "Checks whether m is a bar check."
531 (eq? (ly:music-property m 'name) 'BarCheck))
532 (define (music-origin music)
533 "Recursively search an origin location stored in music."
534 (cond ((null? music) #f)
535 ((not (null? (ly:music-property music 'origin)))
536 (ly:music-property music 'origin))
537 (else (or (music-origin (ly:music-property music 'element))
538 (let ((origins (remove not (map music-origin
539 (ly:music-property music 'elements)))))
540 (and (not (null? origins)) (car origins)))))))
542 ;; first, split the music and fill in voices
543 (map-in-order (lambda (m)
544 (push-music m)
545 (if (bar-check? m) (change-voice)))
546 (ly:music-property music 'elements))
547 (if (not (null? current-sequence)) (change-voice))
548 ;; un-circularize `voices' and reorder the voices
549 (set! voices (map-in-order (lambda (dummy seqs)
550 (reverse! seqs))
551 voice-ids voices))
553 ;; set origin location of each sequence in each voice
554 ;; for better type error tracking
555 (for-each (lambda (voice)
556 (for-each (lambda (seq)
557 (set! (ly:music-property seq 'origin)
558 (or (music-origin seq) location)))
559 voice))
560 voices)
562 ;; check sequence length
563 (apply for-each (lambda* (#:rest seqs)
564 (let ((moment-reference (ly:music-length (car seqs))))
565 (for-each (lambda (seq moment)
566 (if (not (equal? moment moment-reference))
567 (ly:music-message seq
568 "Bars in parallel music don't have the same length")))
569 seqs (map-in-order ly:music-length seqs))))
570 voices)
572 ;; bind voice identifiers to the voices
573 (map (lambda (voice-id voice)
574 (ly:parser-define! parser voice-id
575 (make-music 'SequentialMusic
576 'origin location
577 'elements voice)))
578 voice-ids voices))
579 ;; Return an empty sequence. this function is actually a "void" function.
580 (make-music 'SequentialMusic 'void #t))
582 parenthesize =
583 #(define-music-function (parser loc arg) (ly:music?)
584 (_i "Tag @var{arg} to be parenthesized.")
586 (if (memq 'event-chord (ly:music-property arg 'types))
587 ; arg is an EventChord -> set the parenthesize property on all child notes and rests
588 (map
589 (lambda (ev)
590 (if (or (memq 'note-event (ly:music-property ev 'types))
591 (memq 'rest-event (ly:music-property ev 'types)))
592 (set! (ly:music-property ev 'parenthesize) #t)))
593 (ly:music-property arg 'elements))
594 ; No chord, simply set property for this expression:
595 (set! (ly:music-property arg 'parenthesize) #t))
596 arg)
598 partcombine =
599 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
600 (_i "Take the music in @var{part1} and @var{part2} and typeset so that they share a staff.")
601 (make-part-combine-music parser
602 (list part1 part2)))
604 pitchedTrill =
605 #(define-music-function
606 (parser location main-note secondary-note)
607 (ly:music? ly:music?)
608 (_i "Print a trill with @var{main-note} as the main note of the trill and
609 print @var{secondary-note} as a stemless note head in parentheses.")
610 (let* ((get-notes (lambda (ev-chord)
611 (filter
612 (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name)))
613 (ly:music-property ev-chord 'elements))))
614 (sec-note-events (get-notes secondary-note))
615 (trill-events (filter (lambda (m) (music-has-type m 'trill-span-event))
616 (ly:music-property main-note 'elements))))
618 (if (pair? sec-note-events)
619 (begin
620 (let* ((trill-pitch (ly:music-property (car sec-note-events) 'pitch))
621 (forced (ly:music-property (car sec-note-events) 'force-accidental)))
623 (if (ly:pitch? trill-pitch)
624 (for-each (lambda (m)
625 (ly:music-set-property! m 'pitch trill-pitch)) trill-events)
626 (begin
627 (ly:warning (_ "Second argument of \\pitchedTrill should be single note: "))
628 (display sec-note-events)))
630 (if (eq? forced #t)
631 (for-each (lambda (m)
632 (ly:music-set-property! m 'force-accidental forced))
633 trill-events)))))
634 main-note))
636 quoteDuring =
637 #(define-music-function
638 (parser location what main-music)
639 (string? ly:music?)
640 (_i "Indicate a section of music to be quoted. @var{what} indicates the name
641 of the quoted voice, as specified in an @code{\\addQuote} command.
642 @var{main-music} is used to indicate the length of music to be quoted;
643 usually contains spacers or multi-measure rests.")
644 (make-music 'QuoteMusic
645 'element main-music
646 'quoted-music-name what
647 'origin location))
649 removeWithTag =
650 #(define-music-function
651 (parser location tag music) (symbol? ly:music?)
652 (_i "Remove elements of @var{music} that are tagged with @var{tag}.")
653 (music-filter
654 (lambda (m)
655 (let* ((tags (ly:music-property m 'tags))
656 (res (memq tag tags)))
657 (not res)))
658 music))
660 resetRelativeOctave =
661 #(define-music-function
662 (parser location reference-note)
663 (ly:music?)
664 (_i "Set the octave inside a \\relative section.")
666 (let*
667 ((notes (ly:music-property reference-note 'elements))
668 (pitch (ly:music-property (car notes) 'pitch)))
670 (set! (ly:music-property reference-note 'elements) '())
671 (set! (ly:music-property reference-note
672 'to-relative-callback)
673 (lambda (music last-pitch)
674 pitch))
676 reference-note))
678 revertBeamSettings =
679 #(define-music-function
680 (parser location
681 context time-signature rule-type)
682 (symbol? pair? symbol?)
684 (_i "Revert beam settings in @var{context} for time signatures of
685 @var{time-signature} and groups of type
686 @var{group-type}. @var{group-type} can be @code{end}
687 or @code{subdivide}.")
689 #(revert-beam-setting $time-signature $rule-type $context)
692 rightHandFinger =
693 #(define-music-function (parser location finger) (number-or-string?)
694 (_i "Apply @var{finger} as a fingering indication.")
696 (apply make-music
697 (append
698 (list
699 'StrokeFingerEvent
700 'origin location)
701 (if (string? finger)
702 (list 'text finger)
703 (list 'digit finger)))))
707 scaleDurations =
708 #(define-music-function (parser location fraction music) (number-pair? ly:music?)
709 (_i "Multiply the duration of events in @var{music} by @var{fraction}.")
710 (ly:music-compress music
711 (ly:make-moment (car fraction) (cdr fraction))))
713 setBeatGrouping =
714 #(define-music-function (parser location grouping) (pair?)
715 (_i "Set the beat grouping in the current time signature to
716 @var{grouping}.")
717 (define (default-group-setting c)
718 (let* ((context-time-signature
719 (ly:context-property c 'timeSignatureFraction))
720 (time-signature (if (null? context-time-signature)
721 '(4 . 4)
722 context-time-signature)))
723 (override-property-setting
725 'beamSettings
726 (list time-signature 'end)
727 (list (cons '* grouping)))))
729 (context-spec-music
730 (make-apply-context default-group-setting)
731 'Score))
733 shiftDurations =
734 #(define-music-function (parser location dur dots arg) (integer? integer? ly:music?)
735 (_i "Scale @var{arg} up by a factor of @var{2^dur*(2-(1/2)^dots)}.")
737 (music-map
738 (lambda (x)
739 (shift-one-duration-log x dur dots)) arg))
741 spacingTweaks =
742 #(define-music-function (parser location parameters) (list?)
743 (_i "Set the system stretch, by reading the 'system-stretch property of
744 the `parameters' assoc list.")
746 \overrideProperty #"Score.NonMusicalPaperColumn"
747 #'line-break-system-details
748 #$(list (cons 'alignment-extra-space (cdr (assoc 'system-stretch parameters)))
749 (cons 'system-Y-extent (cdr (assoc 'system-Y-extent parameters))))
752 styledNoteHeads =
753 #(define-music-function
754 (parser location style heads music)
755 (symbol? list-or-symbol? ly:music?)
756 (_i "Set @var{heads} in @var{music} to @var{style}.")
757 (style-note-heads heads style music))
761 tag =
762 #(define-music-function (parser location tag arg)
763 (symbol? ly:music?)
765 (_i "Add @var{tag} to the @code{tags} property of @var{arg}.")
767 (set!
768 (ly:music-property arg 'tags)
769 (cons tag
770 (ly:music-property arg 'tags)))
771 arg)
773 transposedCueDuring =
774 #(define-music-function
775 (parser location what dir pitch-note main-music)
776 (string? ly:dir? ly:music? ly:music?)
778 (_i "Insert notes from the part @var{what} into a voice called @code{cue},
779 using the transposition defined by @var{pitch-note}. This happens
780 simultaneously with @var{main-music}, which is usually a rest. The
781 argument @var{dir} determines whether the cue notes should be notated
782 as a first or second voice.")
784 (make-music 'QuoteMusic
785 'element main-music
786 'quoted-context-type 'Voice
787 'quoted-context-id "cue"
788 'quoted-music-name what
789 'quoted-voice-direction dir
790 'quoted-transposition (pitch-of-note pitch-note)
791 'origin location))
793 transposition =
794 #(define-music-function (parser location pitch-note) (ly:music?)
795 (_i "Set instrument transposition")
797 (context-spec-music
798 (make-property-set 'instrumentTransposition
799 (ly:pitch-negate (pitch-of-note pitch-note)))
800 'Staff))
802 tweak =
803 #(define-music-function (parser location sym val arg)
804 (symbol? scheme? ly:music?)
805 (_i "Add @code{sym . val} to the @code{tweaks} property of @var{arg}.")
807 (if (equal? (object-property sym 'backend-type?) #f)
808 (begin
809 (ly:warning (_ "cannot find property type-check for ~a") sym)
810 (ly:warning (_ "doing assignment anyway"))))
811 (set!
812 (ly:music-property arg 'tweaks)
813 (acons sym val
814 (ly:music-property arg 'tweaks)))
815 arg)
819 unfoldRepeats =
820 #(define-music-function (parser location music) (ly:music?)
821 (_i "Force any @code{\\repeat volta}, @code{\\repeat tremolo} or
822 @code{\\repeat percent} commands in @var{music} to be interpreted
823 as @code{\\repeat unfold}.")
824 (unfold-repeats music))
828 withMusicProperty =
829 #(define-music-function (parser location sym val music) (symbol? scheme? ly:music?)
830 (_i "Set @var{sym} to @var{val} in @var{music}.")
832 (set! (ly:music-property music sym) val)
833 music)