1 %%%% -*- Mode: Scheme -*-
3 %%%% This file is part of LilyPond, the GNU music typesetter.
5 %%%% Copyright (C) 2003--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 %%%% Jan Nieuwenhuizen <janneke@gnu.org>
8 %%%% LilyPond is free software: you can redistribute it and/or modify
9 %%%% it under the terms of the GNU General Public License as published by
10 %%%% the Free Software Foundation, either version 3 of the License, or
11 %%%% (at your option) any later version.
13 %%%% LilyPond is distributed in the hope that it will be useful,
14 %%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
15 %%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 %%%% GNU General Public License for more details.
18 %%%% You should have received a copy of the GNU General Public License
19 %%%% along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 %% this file is alphabetically sorted.
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28 %% need SRFI-1 for filter; optargs for lambda*
29 #(use-modules (srfi srfi-1)
32 %% TODO: using define-music-function in a .scm causes crash.
35 #(def-grace-function startAcciaccaturaMusic stopAcciaccaturaMusic
36 (_i "Create an acciaccatura from the following music expression"))
38 %% keep these two together
39 "instrument-definitions" = #'()
40 addInstrumentDefinition =
41 #(define-music-function
42 (parser location name lst) (string? list?)
43 (_i "Create instrument @var{name} with properties @var{list}.")
44 (set! instrument-definitions (acons name lst instrument-definitions))
45 (make-music 'SequentialMusic 'void #t))
48 #(define-music-function (parser location name music) (string? ly:music?)
49 (_i "Define @var{music} as a quotable music expression named
51 (add-quotable parser name music)
52 (make-music 'SequentialMusic 'void #t))
54 %% keep these two together
55 afterGraceFraction = #(cons 6 8)
57 #(define-music-function (parser location main grace) (ly:music? ly:music?)
58 (_i "Create @var{grace} note(s) after a @var{main} music expression.")
59 (let ((main-length (ly:music-length main))
60 (fraction (ly:parser-lookup parser 'afterGraceFraction)))
61 (make-simultaneous-music
64 (make-sequential-music
67 (make-music 'SkipMusic
68 'duration (ly:make-duration
70 (* (ly:moment-main-numerator main-length)
72 (* (ly:moment-main-denominator main-length)
74 (make-music 'GraceMusic
78 %% music identifiers not allowed at top-level,
79 %% so this is a music-function instead.
81 #(define-music-function (location parser) ()
82 (_i "Allow a page turn. May be used at toplevel (ie between scores or
83 markups), or inside a score.")
84 (make-music 'EventChord
86 'page-turn-permission 'allow
87 'elements (list (make-music 'PageTurnEvent
88 'break-permission 'allow))))
91 #(define-music-function (parser location proc) (procedure?)
92 (_i "Modify context properties with Scheme procedure @var{proc}.")
93 (make-music 'ApplyContext
97 #(define-music-function (parser location func music) (procedure? ly:music?)
98 (_i"Apply procedure @var{func} to @var{music}.")
102 #(define-music-function (parser location ctx proc) (symbol? procedure?)
103 (_i "Apply function @code{proc} to every layout object in context @code{ctx}")
104 (make-music 'ApplyOutputEvent
109 #(def-grace-function startAppoggiaturaMusic stopAppoggiaturaMusic
110 (_i "Create an appoggiatura from @var{music}"))
112 % for regression testing purposes.
114 #(define-music-function (parser location l r) (pair? pair?)
115 (_i "Testing function: check whether the beam quants @var{l} and @var{r} are correct")
116 (make-grob-property-override 'Beam 'positions
117 (ly:make-simple-closure
118 (ly:make-simple-closure
120 (list chain-grob-member-functions `(,cons 0 0))
121 (check-quant-callbacks l r))))))
123 % for regression testing purposes.
125 #(define-music-function (parser location comp) (procedure?)
126 (_i "Testing function: check whether the slope of the beam is the same as @code{comp}")
127 (make-grob-property-override 'Beam 'positions
128 (ly:make-simple-closure
129 (ly:make-simple-closure
131 (list chain-grob-member-functions `(,cons 0 0))
132 (check-slope-callbacks comp))))))
135 #(define-music-function (parser location music) (ly:music?)
136 (_i "Make voices that switch between staves automatically")
137 (make-autochange-music parser music))
142 #(define-music-function (parser location grob-name offset text)
143 (symbol? number-pair? markup?)
144 (_i "Attach @var{text} to @var{grob-name} at offset @var{offset}
145 (use like @code{\\once})")
146 (make-music 'AnnotateOutputEvent
148 'X-offset (car offset)
149 'Y-offset (cdr offset)
153 #(define-music-function (parser location offset text) (number-pair? markup?)
154 (_i "Attach @var{text} at @var{offset} (use like @code{\\tweak})")
155 (make-music 'AnnotateOutputEvent
156 'X-offset (car offset)
157 'Y-offset (cdr offset)
161 #(define-music-function (parser location type) (string?)
162 (_i "Insert a bar line of type @var{type}")
164 (make-property-set 'whichBar type)
168 #(define-music-function (parser location n) (integer?)
169 (_i "Print a warning if the current bar number is not @var{n}.")
170 (make-music 'ApplyContext
173 (let ((cbn (ly:context-property c 'currentBarNumber)))
174 (if (and (number? cbn) (not (= cbn n)))
175 (ly:input-warning location
176 "Barcheck failed got ~a expect ~a"
180 #(define-music-function (parser location delta) (real?)
181 (_i "Create a fall or doit of pitch interval @var{delta}.")
182 (make-music 'BendAfterEvent
186 #(define-music-function (parser location newfilename) (string?)
187 (_i "Direct output for the current book block to @var{newfilename}.")
188 (set! book-filename newfilename)
189 (make-music 'SequentialMusic 'void #t))
192 #(define-music-function (parser location newsuffix) (string?)
193 (_i "Set the output filename suffix for the current book block to
195 (set! book-output-suffix newsuffix)
196 (make-music 'SequentialMusic 'void #t))
198 %% \breathe is defined as a music function rather than an event identifier to
199 %% ensure it gets useful input location information: as an event identifier,
200 %% it would have to be wrapped in an EventChord to prevent it from being
201 %% treated as a post_event by the parser
203 #(define-music-function (parser location) ()
204 (_i "Insert a breath mark.")
205 (make-music 'BreathingEvent))
208 #(define-music-function (parser location type) (string?)
209 (_i "Set the current clef to @var{type}.")
210 (make-clef-set type))
214 #(define-music-function (parser location args) (pair?)
215 (_i "Create compound time signatures. The argument is a Scheme list of
216 lists. Each list describes one fraction, with the last entry being the
217 denominator, while the first entries describe the summands in the
218 enumerator. If the time signature consists of just one fraction,
219 the list can be given directly, i.e. not as a list containing a single list.
220 For example, a time signature of (3+1)/8 + 2/4 would be created as
221 @code{\\compoundMeter #'((3 1 8) (2 4))}, and a time signature of (3+2)/8
222 as @code{\\compoundMeter #'((3 2 8))} or shorter
223 @code{\\compoundMeter #'(3 2 8)}.")
224 (let* ((mlen (calculate-compound-measure-length args))
225 (beat (calculate-compound-base-beat args))
226 (beatGrouping (calculate-compound-beat-grouping args))
227 (timesig (cons (ly:moment-main-numerator mlen)
228 (ly:moment-main-denominator mlen))))
230 \once \override Staff.TimeSignature #'stencil = #(lambda (grob)
231 (grob-interpret-markup grob (format-compound-time $args)))
232 \set Timing.timeSignatureFraction = $timesig
233 \set Timing.baseMoment = $beat
234 \set Timing.beatStructure = $beatGrouping
235 \set Timing.beamExceptions = #'()
236 \set Timing.measureLength = $mlen
241 #(define-music-function (parser location type) (string?)
242 (_i "Set the current cue clef to @var{type}.")
243 (make-cue-clef-set type))
245 #(define-music-function (parser location) ()
246 (_i "Unset the current cue clef.")
247 (make-cue-clef-unset))
250 #(define-music-function
251 (parser location what dir main-music) (string? ly:dir? ly:music?)
252 (_i "Insert contents of quote @var{what} corresponding to @var{main-music},
253 in a CueVoice oriented by @var{dir}.")
254 (make-music 'QuoteMusic
256 'quoted-context-type 'Voice
257 'quoted-context-id "cue"
258 'quoted-music-name what
259 'quoted-voice-direction dir))
262 #(define-music-function
263 (parser location what dir clef main-music) (string? ly:dir? string? ly:music?)
264 (_i "Insert contents of quote @var{what} corresponding to @var{main-music},
265 in a CueVoice oriented by @var{dir}.")
266 (make-music 'QuoteMusic
268 'quoted-context-type 'Voice
269 'quoted-context-id "cue"
270 'quoted-music-name what
271 'quoted-music-clef clef
272 'quoted-voice-direction dir))
277 #(define-music-function (parser location music) (ly:music?)
278 (_i "Display the LilyPond input representation of @var{music}
281 (display-lily-music music parser)
285 #(define-music-function (parser location music) (ly:music?)
286 (_i "Display the internal representation of @var{music} to the console.")
288 (display-scheme-music music)
294 #(define-music-function (parser location music) (ly:music?)
295 (_i "Terminate the next spanner prematurely after exactly one note
296 without the need of a specific end spanner.")
297 (if (eq? (ly:music-property music 'name) 'EventChord)
298 (let* ((elts (ly:music-property music 'elements))
299 (start-span-evs (filter (lambda (ev)
300 (and (music-has-type ev 'span-event)
301 (equal? (ly:music-property ev 'span-direction)
306 (let ((c (music-clone m)))
307 (set! (ly:music-property c 'span-direction) STOP)
310 (end-ev-chord (make-music 'EventChord
311 'elements stop-span-evs))
312 (total (make-music 'SequentialMusic
313 'elements (list music
317 (ly:input-message location (_ "argument endSpanners is not an EventChord: ~a" music))))
322 #(define-music-function (parser location factor argument) (ly:moment? ly:music?)
323 (_i "Adjust durations of music in @var{argument} by rational @var{factor}.")
324 (let ((orig-duration (ly:music-length argument))
325 (multiplier (ly:make-moment 1 1)))
329 (if (and (eq? (ly:music-property mus 'name) 'EventChord)
330 (< 0 (ly:moment-main-denominator (ly:music-length mus))))
332 (ly:music-compress mus multiplier)
333 (set! multiplier (ly:moment-mul factor multiplier))))
339 (ly:moment-div orig-duration (ly:music-length argument)))
344 #(define-music-function (parser location grob-name offset text footnote)
345 (symbol? number-pair? markup? markup?)
346 (_i "Attach @var{text} to @var{grob-name} at offset @var{offset},
347 with @var{text} referring to @var{footnote} (use like @code{\\once})")
348 (make-music 'FootnoteEvent
350 'X-offset (car offset)
351 'Y-offset (cdr offset)
353 'footnote-text footnote))
356 #(define-music-function (parser location grob-name offset footnote)
357 (symbol? number-pair? markup?)
358 (_i "Footnote @var{grob-name} with the text in @var{footnote}
359 allowing for the footnote to be automatically numbered such that
360 the number appears at @var{offset}. Note that, for this to take effect,
361 auto-numbering must be turned on in the paper block. Otherwise, no
362 number will appear. Use like @code{\\once})")
364 \footnoteGrob $grob-name $offset \markup { \null } $footnote
368 #(define-music-function (parser location offset text footnote)
369 (number-pair? markup? markup?)
370 (_i "Attach @var{text} at @var{offset} with @var{text} referring
371 to @var{footnote} (use like @code{\\tweak})")
372 (make-music 'FootnoteEvent
373 'X-offset (car offset)
374 'Y-offset (cdr offset)
376 'footnote-text footnote))
378 % this function can't be a simple copy and past of the above because
379 % it needs to be encapsulated in a Sequential Music.
380 % so, there's a code dup of above :-(
382 #(define-music-function (parser location offset footnote)
383 (number-pair? markup?)
384 (_i "Footnote the item after which this comes with the text in
385 @var{footnote} allowing for the footnote to be automatically numbered
386 such that the number appears at @var{offset}. Note that, for this to
387 take effect, auto-numbering must be turned on in the paper block.
388 Otherwise, no number will appear. Use like @code{\\tweak})")
389 (make-music 'FootnoteEvent
390 'X-offset (car offset)
391 'Y-offset (cdr offset)
392 'text (make-null-markup)
393 'footnote-text footnote))
396 #(def-grace-function startGraceMusic stopGraceMusic
397 (_i "Insert @var{music} as grace notes."))
399 harmonicByFret = #(define-music-function (parser location fret music) (number? ly:music?)
400 (let* ((fret (number->string fret))
401 (pitch (fret->pitch fret)))
402 (make-sequential-music
405 \override TabNoteHead #'stencil = #(tab-note-head::print-custom-fret-label $fret)
408 (calc-harmonic-pitch pitch music))
410 \revert TabNoteHead #'stencil
413 harmonicByRatio = #(define-music-function (parser location ratio music) (number? ly:music?)
414 (let ((pitch (ratio->pitch ratio))
415 (fret (ratio->fret ratio)))
416 (make-sequential-music
419 \override TabNoteHead #'stencil = #(tab-note-head::print-custom-fret-label $fret)
422 (calc-harmonic-pitch pitch music))
424 \revert TabNoteHead #'stencil
428 #(define-music-function
429 (parser location name) (string?)
430 (_i "Switch instrument to @var{name}, which must be predefined with
431 @code{\\addInstrumentDefinition}.")
432 (let* ((handle (assoc name instrument-definitions))
433 (instrument-def (if handle (cdr handle) '())))
436 (ly:input-warning location "No such instrument: ~a" name))
438 (make-music 'SimultaneousMusic
450 #(define-music-function (parser location tag music) (symbol? ly:music?)
451 (_i "Include only elements of @var{music} that are tagged with @var{tag}.")
454 (let* ((tags (ly:music-property m 'tags))
455 (res (memq tag tags)))
462 #(define-music-function (parser location music) (ly:music?)
463 (_i "Remove cue notes from @var{music}.")
466 (if (and (string? (ly:music-property mus 'quoted-music-name))
467 (string=? (ly:music-property mus 'quoted-context-id "") "cue"))
468 (ly:music-property mus 'element)
475 #(define-music-function (parser location label) (symbol?)
476 (_i "Create @var{label} as a bookmarking label.")
477 (make-music 'EventChord
480 'elements (list (make-music 'LabelEvent
481 'page-label label))))
485 #(define-music-function (parser location language) (string?)
486 (_i "Set note names for language @var{language}.")
487 (note-names-language parser language)
488 (make-music 'Music 'void #t))
490 languageSaveAndChange =
491 #(define-music-function (parser location language) (string?)
492 (_i "Store the previous pitchnames alist, and set a new one.")
493 (set! previous-pitchnames pitchnames)
494 (note-names-language parser language)
495 (make-music 'Music 'void #t))
498 #(define-music-function (parser location) ()
499 (_i "Restore a previously-saved pitchnames alist.")
500 (if previous-pitchnames
502 (set! pitchnames previous-pitchnames)
503 (ly:parser-set-note-names parser pitchnames))
504 (ly:input-warning location (_ "No other language was defined previously. Ignoring.")))
505 (make-music 'Music 'void #t))
509 #(define-music-function (parser location arg) (ly:music?)
510 (_i "Display chords in @var{arg} as clusters.")
511 (music-map note-to-cluster arg))
514 #(define-music-function (parser location around to scale music)
515 (ly:music? ly:music? ly:music? ly:music?)
516 (_i "Invert @var{music} about @var{around} using @var{scale} and
517 transpose from @var{around} to @var{to}.")
518 (let ((inverter (make-modal-inverter around to scale)))
519 (change-pitches music inverter)
523 #(define-music-function (parser location from to scale music)
524 (ly:music? ly:music? ly:music? ly:music?)
525 (_i "Transpose @var{music} from pitch @var{from} to pitch @var{to}
527 (let ((transposer (make-modal-transposer from to scale)))
528 (change-pitches music transposer)
532 #(define-music-function
533 (parser location around to music) (ly:music? ly:music? ly:music?)
534 (_i "Invert @var{music} about @var{around} and
535 transpose from @var{around} to @var{to}.")
536 (music-invert around to music))
539 #(define-music-function (parser location proc mus) (procedure? ly:music?)
540 (_i "Apply @var{proc} to @var{mus} and all of the music it contains.")
541 (music-map proc mus))
543 %% noPageBreak and noPageTurn are music functions (not music indentifiers),
544 %% because music identifiers are not allowed at top-level.
546 #(define-music-function (location parser) ()
547 (_i "Forbid a page break. May be used at toplevel (i.e., between scores or
548 markups), or inside a score.")
549 (make-music 'EventChord
551 'page-break-permission 'forbid
552 'elements (list (make-music 'PageBreakEvent
553 'break-permission '()))))
556 #(define-music-function (location parser) ()
557 (_i "Forbid a page turn. May be used at toplevel (i.e., between scores or
558 markups), or inside a score.")
559 (make-music 'EventChord
561 'page-turn-permission 'forbid
562 'elements (list (make-music 'PageTurnEvent
563 'break-permission '()))))
568 #(define-music-function (parser location pitch-note) (ly:music?)
570 (make-music 'RelativeOctaveCheck
571 'pitch (pitch-of-note pitch-note)))
574 #(define-music-function (parser location octave) (integer?)
575 (_i "Set the octavation.")
576 (make-music 'OttavaMusic
577 'ottava-number octave))
579 overrideTimeSignatureSettings =
580 #(define-music-function
581 (parser location time-signature base-moment beat-structure beam-exceptions)
582 (pair? pair? cheap-list? cheap-list?)
584 (_i "Override @code{timeSignatureSettings}
585 for time signatures of @var{time-signature} to have settings
586 of @var{base-moment}, @var{beat-structure}, and @var{beam-exceptions}.")
588 ;; TODO -- add warning if largest value of grouping is
589 ;; greater than time-signature.
590 (let ((setting (make-setting base-moment beat-structure beam-exceptions)))
591 (override-time-signature-setting time-signature setting)))
594 #(define-music-function (parser location name property value)
595 (string? symbol? scheme?)
597 (_i "Set @var{property} to @var{value} in all grobs named @var{name}.
598 The @var{name} argument is a string of the form @code{\"Context.GrobName\"}
599 or @code{\"GrobName\"}.")
601 (let ((name-components (string-split name #\.))
602 (context-name 'Bottom)
605 (if (> 2 (length name-components))
606 (set! grob-name (string->symbol (car name-components)))
608 (set! grob-name (string->symbol (list-ref name-components 1)))
609 (set! context-name (string->symbol (list-ref name-components 0)))))
611 (make-music 'ApplyOutputEvent
612 'context-type context-name
614 (lambda (grob orig-context context)
616 (cdr (assoc 'name (ly:grob-property grob 'meta)))
618 (set! (ly:grob-property grob property) value))))))
622 %% pageBreak and pageTurn are music functions (iso music indentifiers),
623 %% because music identifiers are not allowed at top-level.
625 #(define-music-function (location parser) ()
626 (_i "Force a page break. May be used at toplevel (i.e., between scores or
627 markups), or inside a score.")
628 (make-music 'EventChord
630 'line-break-permission 'force
631 'page-break-permission 'force
632 'elements (list (make-music 'LineBreakEvent
633 'break-permission 'force)
634 (make-music 'PageBreakEvent
635 'break-permission 'force))))
638 #(define-music-function (location parser) ()
639 (_i "Force a page turn between two scores or top-level markups.")
640 (make-music 'EventChord
642 'line-break-permission 'force
643 'page-break-permission 'force
644 'page-turn-permission 'force
645 'elements (list (make-music 'LineBreakEvent
646 'break-permission 'force)
647 (make-music 'PageBreakEvent
648 'break-permission 'force)
649 (make-music 'PageTurnEvent
650 'break-permission 'force))))
653 #(define-music-function (parser location voice-ids music) (list? ly:music?)
654 (_i "Define parallel music sequences, separated by '|' (bar check signs),
655 and assign them to the identifiers provided in @var{voice-ids}.
657 @var{voice-ids}: a list of music identifiers (symbols containing only letters)
659 @var{music}: a music sequence, containing BarChecks as limiting expressions.
664 \\parallelMusic #'(A B C) {
674 (let* ((voices (apply circular-list (make-list (length voice-ids) (list))))
675 (current-voices voices)
676 (current-sequence (list)))
679 (define (push-music m)
680 "Push the music expression into the current sequence"
681 (set! current-sequence (cons m current-sequence)))
682 (define (change-voice)
683 "Stores the previously built sequence into the current voice and
684 change to the following voice."
685 (list-set! current-voices 0 (cons (make-music 'SequentialMusic
686 'elements (reverse! current-sequence))
687 (car current-voices)))
688 (set! current-sequence (list))
689 (set! current-voices (cdr current-voices)))
690 (define (bar-check? m)
691 "Checks whether m is a bar check."
692 (eq? (ly:music-property m 'name) 'BarCheck))
693 (define (music-origin music)
694 "Recursively search an origin location stored in music."
695 (cond ((null? music) #f)
696 ((not (null? (ly:music-property music 'origin)))
697 (ly:music-property music 'origin))
698 (else (or (music-origin (ly:music-property music 'element))
699 (let ((origins (remove not (map music-origin
700 (ly:music-property music 'elements)))))
701 (and (not (null? origins)) (car origins)))))))
703 ;; first, split the music and fill in voices
704 (map-in-order (lambda (m)
706 (if (bar-check? m) (change-voice)))
707 (ly:music-property music 'elements))
708 (if (not (null? current-sequence)) (change-voice))
709 ;; un-circularize `voices' and reorder the voices
710 (set! voices (map-in-order (lambda (dummy seqs)
714 ;; set origin location of each sequence in each voice
715 ;; for better type error tracking
716 (for-each (lambda (voice)
717 (for-each (lambda (seq)
718 (set! (ly:music-property seq 'origin)
719 (or (music-origin seq) location)))
723 ;; check sequence length
724 (apply for-each (lambda* (#:rest seqs)
725 (let ((moment-reference (ly:music-length (car seqs))))
726 (for-each (lambda (seq moment)
727 (if (not (equal? moment moment-reference))
728 (ly:music-warning seq
729 "Bars in parallel music don't have the same length")))
730 seqs (map-in-order ly:music-length seqs))))
733 ;; bind voice identifiers to the voices
734 (map (lambda (voice-id voice)
735 (ly:parser-define! parser voice-id
736 (make-music 'SequentialMusic
740 ;; Return an empty sequence. This function is actually a "void" function.
741 (make-music 'SequentialMusic 'void #t))
744 #(define-music-function (parser loc arg) (ly:music?)
745 (_i "Tag @var{arg} to be parenthesized.")
747 (if (memq 'event-chord (ly:music-property arg 'types))
748 ;; arg is an EventChord -> set the parenthesize property
749 ;; on all child notes and rests
752 (if (or (memq 'note-event (ly:music-property ev 'types))
753 (memq 'rest-event (ly:music-property ev 'types)))
754 (set! (ly:music-property ev 'parenthesize) #t)))
755 (ly:music-property arg 'elements))
756 ;; No chord, simply set property for this expression:
757 (set! (ly:music-property arg 'parenthesize) #t))
761 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
762 (_i "Take the music in @var{part1} and @var{part2} and typeset so
763 that they share a staff.")
764 (make-part-combine-music parser
768 #(define-music-function (location parser type once) (symbol-or-boolean? boolean?)
769 (_i "Override the part-combiner.")
770 (make-music 'EventChord
771 'elements (list (make-music 'PartCombineForceEvent
774 partcombineApart = \partcombineForce #'apart ##f
775 partcombineApartOnce = \partcombineForce #'apart ##t
776 partcombineChords = \partcombineForce #'chords ##f
777 partcombineChordsOnce = \partcombineForce #'chords ##t
778 partcombineUnisono = \partcombineForce #'unisono ##f
779 partcombineUnisonoOnce = \partcombineForce #'unisono ##t
780 partcombineSoloI = \partcombineForce #'solo1 ##f
781 partcombineSoloIOnce = \partcombineForce #'solo1 ##t
782 partcombineSoloII = \partcombineForce #'solo2 ##f
783 partcombineSoloIIOnce = \partcombineForce #'solo2 ##t
784 partcombineAutomatic = \partcombineForce ##f ##f
785 partcombineAutomaticOnce = \partcombineForce ##f ##t
789 #(define-music-function
790 (parser location main-note secondary-note)
791 (ly:music? ly:music?)
792 (_i "Print a trill with @var{main-note} as the main note of the trill and
793 print @var{secondary-note} as a stemless note head in parentheses.")
794 (let* ((get-notes (lambda (ev-chord)
796 (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name)))
797 (ly:music-property ev-chord 'elements))))
798 (sec-note-events (get-notes secondary-note))
799 (trill-events (filter (lambda (m) (music-has-type m 'trill-span-event))
800 (ly:music-property main-note 'elements))))
802 (if (pair? sec-note-events)
804 (let* ((trill-pitch (ly:music-property (car sec-note-events) 'pitch))
805 (forced (ly:music-property (car sec-note-events) 'force-accidental)))
807 (if (ly:pitch? trill-pitch)
808 (for-each (lambda (m)
809 (ly:music-set-property! m 'pitch trill-pitch)) trill-events)
811 (ly:input-warning location (_ "Second argument of \\pitchedTrill should be single note: "))
812 (display sec-note-events)))
815 (for-each (lambda (m)
816 (ly:music-set-property! m 'force-accidental forced))
821 #(define-music-function (parser location what main-music) (string? ly:music?)
822 (_i "Indicate a section of music to be quoted. @var{what} indicates the name
823 of the quoted voice, as specified in an @code{\\addQuote} command.
824 @var{main-music} is used to indicate the length of music to be quoted;
825 usually contains spacers or multi-measure rests.")
826 (make-music 'QuoteMusic
828 'quoted-music-name what))
831 #(define-music-function (parser location tag music) (symbol? ly:music?)
832 (_i "Remove elements of @var{music} that are tagged with @var{tag}.")
835 (let* ((tags (ly:music-property m 'tags))
836 (res (memq tag tags)))
840 resetRelativeOctave =
841 #(define-music-function (parser location reference-note) (ly:music?)
842 (_i "Set the octave inside a \\relative section.")
844 (let* ((notes (ly:music-property reference-note 'elements))
845 (pitch (ly:music-property (car notes) 'pitch)))
847 (set! (ly:music-property reference-note 'elements) '())
848 (set! (ly:music-property reference-note 'to-relative-callback)
849 (lambda (music last-pitch)
855 #(define-music-function (parser location music)
857 (_i "Return @var{music} in reverse order.")
858 (retrograde-music music))
860 revertTimeSignatureSettings =
861 #(define-music-function
862 (parser location time-signature)
865 (_i "Revert @code{timeSignatureSettings}
866 for time signatures of @var{time-signature}.")
867 (revert-time-signature-setting time-signature))
870 #(define-music-function (parser location finger) (number-or-string?)
871 (_i "Apply @var{finger} as a fingering indication.")
880 (list 'digit finger)))))
885 #(define-music-function (parser location fraction music)
886 (number-pair? ly:music?)
887 (_i "Multiply the duration of events in @var{music} by @var{fraction}.")
888 (ly:music-compress music
889 (ly:make-moment (car fraction) (cdr fraction))))
892 #(define-music-function (parser location dur dots arg)
893 (integer? integer? ly:music?)
894 (_i "Scale @var{arg} up by a factor of 2^@var{dur}*(2-(1/2)^@var{dots}).")
898 (shift-one-duration-log x dur dots)) arg))
901 #(def-grace-function startSlashedGraceMusic stopSlashedGraceMusic
902 (_i "Create slashed graces (slashes through stems, but no slur) from
903 the following music expression"))
906 #(define-music-function (parser location parameters) (list?)
907 (_i "Set the system stretch, by reading the 'system-stretch property of
908 the `parameters' assoc list.")
910 \overrideProperty #"Score.NonMusicalPaperColumn"
911 #'line-break-system-details
912 #$(list (cons 'alignment-extra-space (cdr (assoc 'system-stretch parameters)))
913 (cons 'system-Y-extent (cdr (assoc 'system-Y-extent parameters))))
917 #(define-music-function (parser location style heads music)
918 (symbol? list-or-symbol? ly:music?)
919 (_i "Set @var{heads} in @var{music} to @var{style}.")
920 (style-note-heads heads style music))
925 #(define-music-function (parser location) ()
926 (_i "Include the string information in a chord repetition.")
927 (ly:parser-set-repetition-function parser tab-repeat-chord)
928 (make-music 'SequentialMusic 'void #t))
931 #(define-music-function (parser location tag arg) (symbol? ly:music?)
933 (_i "Add @var{tag} to the @code{tags} property of @var{arg}.")
936 (ly:music-property arg 'tags)
938 (ly:music-property arg 'tags)))
941 transposedCueDuring =
942 #(define-music-function
943 (parser location what dir pitch-note main-music)
944 (string? ly:dir? ly:music? ly:music?)
946 (_i "Insert notes from the part @var{what} into a voice called @code{cue},
947 using the transposition defined by @var{pitch-note}. This happens
948 simultaneously with @var{main-music}, which is usually a rest. The
949 argument @var{dir} determines whether the cue notes should be notated
950 as a first or second voice.")
952 (make-music 'QuoteMusic
954 'quoted-context-type 'Voice
955 'quoted-context-id "cue"
956 'quoted-music-name what
957 'quoted-voice-direction dir
958 'quoted-transposition (pitch-of-note pitch-note)))
961 #(define-music-function (parser location pitch-note) (ly:music?)
962 (_i "Set instrument transposition")
965 (make-property-set 'instrumentTransposition
966 (ly:pitch-negate (pitch-of-note pitch-note)))
970 #(define-music-function (parser location sym val arg)
971 (symbol? scheme? ly:music?)
972 (_i "Add @code{sym . val} to the @code{tweaks} property of @var{arg}.")
974 (if (equal? (object-property sym 'backend-type?) #f)
976 (ly:input-warning location (_ "cannot find property type-check for ~a") sym)
977 (ly:warning (_ "doing assignment anyway"))))
979 (ly:music-property arg 'tweaks)
981 (ly:music-property arg 'tweaks)))
987 #(define-music-function (parser location music) (ly:music?)
988 (_i "Force any @code{\\repeat volta}, @code{\\repeat tremolo} or
989 @code{\\repeat percent} commands in @var{music} to be interpreted
990 as @code{\\repeat unfold}.")
991 (unfold-repeats music))
996 #(define-music-function (parser location sym val music)
997 (symbol? scheme? ly:music?)
998 (_i "Set @var{sym} to @var{val} in @var{music}.")
1000 (set! (ly:music-property music sym) val)