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-scheme-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)))
47 #(define-scheme-function (parser location name music) (string? ly:music?)
48 (_i "Define @var{music} as a quotable music expression named
50 (add-quotable parser name music))
52 %% keep these two together
53 afterGraceFraction = #(cons 6 8)
55 #(define-music-function (parser location main grace) (ly:music? ly:music?)
56 (_i "Create @var{grace} note(s) after a @var{main} music expression.")
57 (let ((main-length (ly:music-length main))
58 (fraction (ly:parser-lookup parser 'afterGraceFraction)))
59 (make-simultaneous-music
62 (make-sequential-music
65 (make-music 'SkipMusic
66 'duration (ly:make-duration
68 (* (ly:moment-main-numerator main-length)
70 (* (ly:moment-main-denominator main-length)
72 (make-music 'GraceMusic
76 %% music identifiers not allowed at top-level,
77 %% so this is a music-function instead.
79 #(define-music-function (location parser) ()
80 (_i "Allow a page turn. May be used at toplevel (ie between scores or
81 markups), or inside a score.")
82 (make-music 'EventChord
84 'page-turn-permission 'allow
85 'elements (list (make-music 'PageTurnEvent
86 'break-permission 'allow))))
89 #(define-music-function (parser location proc) (procedure?)
90 (_i "Modify context properties with Scheme procedure @var{proc}.")
91 (make-music 'ApplyContext
95 #(define-music-function (parser location func music) (procedure? ly:music?)
96 (_i"Apply procedure @var{func} to @var{music}.")
100 #(define-music-function (parser location ctx proc) (symbol? procedure?)
101 (_i "Apply function @code{proc} to every layout object in context @code{ctx}")
102 (make-music 'ApplyOutputEvent
107 #(def-grace-function startAppoggiaturaMusic stopAppoggiaturaMusic
108 (_i "Create an appoggiatura from @var{music}"))
110 % for regression testing purposes.
112 #(define-music-function (parser location l r) (pair? pair?)
113 (_i "Testing function: check whether the beam quants @var{l} and @var{r} are correct")
114 (make-grob-property-override 'Beam 'positions
115 (ly:make-simple-closure
116 (ly:make-simple-closure
118 (list chain-grob-member-functions `(,cons 0 0))
119 (check-quant-callbacks l r))))))
121 % for regression testing purposes.
123 #(define-music-function (parser location comp) (procedure?)
124 (_i "Testing function: check whether the slope of the beam is the same as @code{comp}")
125 (make-grob-property-override 'Beam 'positions
126 (ly:make-simple-closure
127 (ly:make-simple-closure
129 (list chain-grob-member-functions `(,cons 0 0))
130 (check-slope-callbacks comp))))))
133 #(define-music-function (parser location music) (ly:music?)
134 (_i "Make voices that switch between staves automatically")
135 (make-autochange-music parser music))
140 #(define-music-function (parser location grob-name offset text)
141 (symbol? number-pair? markup?)
142 (_i "Attach @var{text} to @var{grob-name} at offset @var{offset}
143 (use like @code{\\once})")
144 (make-music 'AnnotateOutputEvent
146 'X-offset (car offset)
147 'Y-offset (cdr offset)
151 #(define-music-function (parser location offset text) (number-pair? markup?)
152 (_i "Attach @var{text} at @var{offset} (use like @code{\\tweak})")
153 (make-music 'AnnotateOutputEvent
154 'X-offset (car offset)
155 'Y-offset (cdr offset)
159 #(define-music-function (parser location type) (string?)
160 (_i "Insert a bar line of type @var{type}")
162 (make-property-set 'whichBar type)
166 #(define-music-function (parser location n) (integer?)
167 (_i "Print a warning if the current bar number is not @var{n}.")
168 (make-music 'ApplyContext
171 (let ((cbn (ly:context-property c 'currentBarNumber)))
172 (if (and (number? cbn) (not (= cbn n)))
173 (ly:input-warning location
174 "Barcheck failed got ~a expect ~a"
178 #(define-music-function (parser location delta) (real?)
179 (_i "Create a fall or doit of pitch interval @var{delta}.")
180 (make-music 'BendAfterEvent
184 #(define-scheme-function (parser location newfilename) (string?)
185 (_i "Direct output for the current book block to @var{newfilename}.")
186 (set! book-filename newfilename))
189 #(define-scheme-function (parser location newsuffix) (string?)
190 (_i "Set the output filename suffix for the current book block to
192 (set! book-output-suffix newsuffix))
194 %% \breathe is defined as a music function rather than an event identifier to
195 %% ensure it gets useful input location information: as an event identifier,
196 %% it would have to be wrapped in an EventChord to prevent it from being
197 %% treated as a post_event by the parser
199 #(define-music-function (parser location) ()
200 (_i "Insert a breath mark.")
201 (make-music 'BreathingEvent))
204 #(define-music-function (parser location type) (string?)
205 (_i "Set the current clef to @var{type}.")
206 (make-clef-set type))
210 #(define-music-function (parser location args) (pair?)
211 (_i "Create compound time signatures. The argument is a Scheme list of
212 lists. Each list describes one fraction, with the last entry being the
213 denominator, while the first entries describe the summands in the
214 enumerator. If the time signature consists of just one fraction,
215 the list can be given directly, i.e. not as a list containing a single list.
216 For example, a time signature of (3+1)/8 + 2/4 would be created as
217 @code{\\compoundMeter #'((3 1 8) (2 4))}, and a time signature of (3+2)/8
218 as @code{\\compoundMeter #'((3 2 8))} or shorter
219 @code{\\compoundMeter #'(3 2 8)}.")
220 (let* ((mlen (calculate-compound-measure-length args))
221 (beat (calculate-compound-base-beat args))
222 (beatGrouping (calculate-compound-beat-grouping args))
223 (timesig (cons (ly:moment-main-numerator mlen)
224 (ly:moment-main-denominator mlen))))
226 \once \override Staff.TimeSignature #'stencil = #(lambda (grob)
227 (grob-interpret-markup grob (format-compound-time $args)))
228 \set Timing.timeSignatureFraction = $timesig
229 \set Timing.baseMoment = $beat
230 \set Timing.beatStructure = $beatGrouping
231 \set Timing.beamExceptions = #'()
232 \set Timing.measureLength = $mlen
237 #(define-music-function (parser location type) (string?)
238 (_i "Set the current cue clef to @var{type}.")
239 (make-cue-clef-set type))
241 #(define-music-function (parser location) ()
242 (_i "Unset the current cue clef.")
243 (make-cue-clef-unset))
246 #(define-music-function
247 (parser location what dir main-music) (string? ly:dir? ly:music?)
248 (_i "Insert contents of quote @var{what} corresponding to @var{main-music},
249 in a CueVoice oriented by @var{dir}.")
250 (make-music 'QuoteMusic
252 'quoted-context-type 'Voice
253 'quoted-context-id "cue"
254 'quoted-music-name what
255 'quoted-voice-direction dir))
258 #(define-music-function
259 (parser location what dir clef main-music) (string? ly:dir? string? ly:music?)
260 (_i "Insert contents of quote @var{what} corresponding to @var{main-music},
261 in a CueVoice oriented by @var{dir}.")
262 (make-music 'QuoteMusic
264 'quoted-context-type 'Voice
265 'quoted-context-id "cue"
266 'quoted-music-name what
267 'quoted-music-clef clef
268 'quoted-voice-direction dir))
273 #(define-music-function (parser location music) (ly:music?)
274 (_i "Display the LilyPond input representation of @var{music}
277 (display-lily-music music parser)
281 #(define-music-function (parser location music) (ly:music?)
282 (_i "Display the internal representation of @var{music} to the console.")
284 (display-scheme-music music)
290 #(define-music-function (parser location music) (ly:music?)
291 (_i "Terminate the next spanner prematurely after exactly one note
292 without the need of a specific end spanner.")
293 (if (eq? (ly:music-property music 'name) 'EventChord)
294 (let* ((elts (ly:music-property music 'elements))
295 (start-span-evs (filter (lambda (ev)
296 (and (music-has-type ev 'span-event)
297 (equal? (ly:music-property ev 'span-direction)
302 (let ((c (music-clone m)))
303 (set! (ly:music-property c 'span-direction) STOP)
306 (end-ev-chord (make-music 'EventChord
307 'elements stop-span-evs))
308 (total (make-music 'SequentialMusic
309 'elements (list music
313 (ly:input-message location (_ "argument endSpanners is not an EventChord: ~a" music))))
318 #(define-music-function (parser location factor argument) (ly:moment? ly:music?)
319 (_i "Adjust durations of music in @var{argument} by rational @var{factor}.")
320 (let ((orig-duration (ly:music-length argument))
321 (multiplier (ly:make-moment 1 1)))
325 (if (and (eq? (ly:music-property mus 'name) 'EventChord)
326 (< 0 (ly:moment-main-denominator (ly:music-length mus))))
328 (ly:music-compress mus multiplier)
329 (set! multiplier (ly:moment-mul factor multiplier))))
335 (ly:moment-div orig-duration (ly:music-length argument)))
340 #(define-music-function (parser location grob-name offset text footnote)
341 (symbol? number-pair? markup? markup?)
342 (_i "Attach @var{text} to @var{grob-name} at offset @var{offset},
343 with @var{text} referring to @var{footnote} (use like @code{\\once})")
344 (make-music 'FootnoteEvent
345 'automatically-numbered #f
347 'X-offset (car offset)
348 'Y-offset (cdr offset)
350 'footnote-text footnote))
353 #(define-music-function (parser location grob-name offset footnote)
354 (symbol? number-pair? markup?)
355 (_i "Footnote @var{grob-name} with the text in @var{footnote}
356 allowing for the footnote to be automatically numbered such that
357 the number appears at @var{offset}. Note that, for this to take effect,
358 auto-numbering must be turned on in the paper block. Otherwise, no
359 number will appear. Use like @code{\\once})")
360 (make-music 'FootnoteEvent
361 'automatically-numbered #t
363 'X-offset (car offset)
364 'Y-offset (cdr offset)
365 'text (make-null-markup)
366 'footnote-text footnote))
370 #(define-music-function (parser location offset text footnote)
371 (number-pair? markup? markup?)
372 (_i "Attach @var{text} at @var{offset} with @var{text} referring
373 to @var{footnote} (use like @code{\\tweak})")
374 (make-music 'FootnoteEvent
375 'automatically-numbered #f
376 'X-offset (car offset)
377 'Y-offset (cdr offset)
379 'footnote-text footnote))
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 'automatically-numbered #t
391 'X-offset (car offset)
392 'Y-offset (cdr offset)
393 'text (make-null-markup)
394 'footnote-text footnote))
397 #(def-grace-function startGraceMusic stopGraceMusic
398 (_i "Insert @var{music} as grace notes."))
400 harmonicByFret = #(define-music-function (parser location fret music) (number? ly:music?)
401 (_i "Convert @var{music} into harmonics; the resulting notes resemble
402 harmonics played on a fretted instrument by touching the strings above @var{fret}.")
403 (let* ((fret (number->string fret))
404 (pitch (fret->pitch fret)))
405 (make-sequential-music
408 \override TabNoteHead #'stencil = #(tab-note-head::print-custom-fret-label $fret)
411 (calc-harmonic-pitch pitch music))
413 \revert TabNoteHead #'stencil
416 harmonicByRatio = #(define-music-function (parser location ratio music) (number? ly:music?)
417 (_i "Convert @var{music} into harmonics; the resulting notes resemble
418 harmonics played on a fretted instrument by touching the strings above the point
419 given through @var{ratio}.")
420 (let ((pitch (ratio->pitch ratio))
421 (fret (ratio->fret ratio)))
422 (make-sequential-music
425 \override TabNoteHead #'stencil = #(tab-note-head::print-custom-fret-label $fret)
428 (calc-harmonic-pitch pitch music))
430 \revert TabNoteHead #'stencil
434 #(define-music-function
435 (parser location name) (string?)
436 (_i "Switch instrument to @var{name}, which must be predefined with
437 @code{\\addInstrumentDefinition}.")
438 (let* ((handle (assoc name instrument-definitions))
439 (instrument-def (if handle (cdr handle) '())))
442 (ly:input-warning location "No such instrument: ~a" name))
444 (make-music 'SimultaneousMusic
456 #(define-music-function (parser location tag music) (symbol? ly:music?)
457 (_i "Include only elements of @var{music} that are tagged with @var{tag}.")
460 (let* ((tags (ly:music-property m 'tags))
461 (res (memq tag tags)))
468 #(define-music-function (parser location music) (ly:music?)
469 (_i "Remove cue notes from @var{music}.")
472 (if (and (string? (ly:music-property mus 'quoted-music-name))
473 (string=? (ly:music-property mus 'quoted-context-id "") "cue"))
474 (ly:music-property mus 'element)
481 #(define-music-function (parser location label) (symbol?)
482 (_i "Create @var{label} as a bookmarking label.")
483 (make-music 'EventChord
486 'elements (list (make-music 'LabelEvent
487 'page-label label))))
491 #(define-scheme-function (parser location language) (string?)
492 (_i "Set note names for language @var{language}.")
493 (note-names-language parser language))
495 languageSaveAndChange =
496 #(define-scheme-function (parser location language) (string?)
497 (_i "Store the previous pitchnames alist, and set a new one.")
498 (set! previous-pitchnames pitchnames)
499 (note-names-language parser language))
502 #(define-scheme-function (parser location) ()
503 (_i "Restore a previously-saved pitchnames alist.")
504 (if previous-pitchnames
506 (set! pitchnames previous-pitchnames)
507 (ly:parser-set-note-names parser pitchnames))
508 (ly:input-warning location (_ "No other language was defined previously. Ignoring."))))
512 #(define-music-function (parser location arg) (ly:music?)
513 (_i "Display chords in @var{arg} as clusters.")
514 (music-map note-to-cluster arg))
517 #(define-music-function (parser location around to scale music)
518 (ly:pitch? ly:pitch? ly:music? ly:music?)
519 (_i "Invert @var{music} about @var{around} using @var{scale} and
520 transpose from @var{around} to @var{to}.")
521 (let ((inverter (make-modal-inverter around to scale)))
522 (change-pitches music inverter)
526 #(define-music-function (parser location from to scale music)
527 (ly:pitch? ly:pitch? ly:music? ly:music?)
528 (_i "Transpose @var{music} from pitch @var{from} to pitch @var{to}
530 (let ((transposer (make-modal-transposer from to scale)))
531 (change-pitches music transposer)
535 #(define-music-function
536 (parser location around to music) (ly:pitch? ly:pitch? ly:music?)
537 (_i "Invert @var{music} about @var{around} and
538 transpose from @var{around} to @var{to}.")
539 (music-invert around to music))
542 #(define-music-function (parser location proc mus) (procedure? ly:music?)
543 (_i "Apply @var{proc} to @var{mus} and all of the music it contains.")
544 (music-map proc mus))
546 %% noPageBreak and noPageTurn are music functions (not music indentifiers),
547 %% because music identifiers are not allowed at top-level.
549 #(define-music-function (location parser) ()
550 (_i "Forbid a page break. May be used at toplevel (i.e., between scores or
551 markups), or inside a score.")
552 (make-music 'EventChord
554 'page-break-permission 'forbid
555 'elements (list (make-music 'PageBreakEvent
556 'break-permission '()))))
559 #(define-music-function (location parser) ()
560 (_i "Forbid a page turn. May be used at toplevel (i.e., between scores or
561 markups), or inside a score.")
562 (make-music 'EventChord
564 'page-turn-permission 'forbid
565 'elements (list (make-music 'PageTurnEvent
566 'break-permission '()))))
571 #(define-music-function (parser location pitch) (ly:pitch?)
573 (make-music 'RelativeOctaveCheck
577 #(define-music-function (parser location octave) (integer?)
578 (_i "Set the octavation.")
579 (make-music 'OttavaMusic
580 'ottava-number octave))
582 overrideTimeSignatureSettings =
583 #(define-music-function
584 (parser location time-signature base-moment beat-structure beam-exceptions)
585 (pair? pair? cheap-list? cheap-list?)
587 (_i "Override @code{timeSignatureSettings}
588 for time signatures of @var{time-signature} to have settings
589 of @var{base-moment}, @var{beat-structure}, and @var{beam-exceptions}.")
591 ;; TODO -- add warning if largest value of grouping is
592 ;; greater than time-signature.
593 (let ((setting (make-setting base-moment beat-structure beam-exceptions)))
594 (override-time-signature-setting time-signature setting)))
597 #(define-music-function (parser location name property value)
598 (string? symbol? scheme?)
600 (_i "Set @var{property} to @var{value} in all grobs named @var{name}.
601 The @var{name} argument is a string of the form @code{\"Context.GrobName\"}
602 or @code{\"GrobName\"}.")
604 (let ((name-components (string-split name #\.))
605 (context-name 'Bottom)
608 (if (> 2 (length name-components))
609 (set! grob-name (string->symbol (car name-components)))
611 (set! grob-name (string->symbol (list-ref name-components 1)))
612 (set! context-name (string->symbol (list-ref name-components 0)))))
614 (make-music 'ApplyOutputEvent
615 'context-type context-name
617 (lambda (grob orig-context context)
619 (cdr (assoc 'name (ly:grob-property grob 'meta)))
621 (set! (ly:grob-property grob property) value))))))
625 %% pageBreak and pageTurn are music functions (iso music indentifiers),
626 %% because music identifiers are not allowed at top-level.
628 #(define-music-function (location parser) ()
629 (_i "Force a page break. May be used at toplevel (i.e., between scores or
630 markups), or inside a score.")
631 (make-music 'EventChord
633 'line-break-permission 'force
634 'page-break-permission 'force
635 'elements (list (make-music 'LineBreakEvent
636 'break-permission 'force)
637 (make-music 'PageBreakEvent
638 'break-permission 'force))))
641 #(define-music-function (location parser) ()
642 (_i "Force a page turn between two scores or top-level markups.")
643 (make-music 'EventChord
645 'line-break-permission 'force
646 'page-break-permission 'force
647 'page-turn-permission 'force
648 'elements (list (make-music 'LineBreakEvent
649 'break-permission 'force)
650 (make-music 'PageBreakEvent
651 'break-permission 'force)
652 (make-music 'PageTurnEvent
653 'break-permission 'force))))
656 #(define-scheme-function (parser location voice-ids music) (list? ly:music?)
657 (_i "Define parallel music sequences, separated by '|' (bar check signs),
658 and assign them to the identifiers provided in @var{voice-ids}.
660 @var{voice-ids}: a list of music identifiers (symbols containing only letters)
662 @var{music}: a music sequence, containing BarChecks as limiting expressions.
667 \\parallelMusic #'(A B C) {
677 (let* ((voices (apply circular-list (make-list (length voice-ids) (list))))
678 (current-voices voices)
679 (current-sequence (list)))
682 (define (push-music m)
683 "Push the music expression into the current sequence"
684 (set! current-sequence (cons m current-sequence)))
685 (define (change-voice)
686 "Stores the previously built sequence into the current voice and
687 change to the following voice."
688 (list-set! current-voices 0 (cons (make-music 'SequentialMusic
689 'elements (reverse! current-sequence))
690 (car current-voices)))
691 (set! current-sequence (list))
692 (set! current-voices (cdr current-voices)))
693 (define (bar-check? m)
694 "Checks whether m is a bar check."
695 (eq? (ly:music-property m 'name) 'BarCheck))
696 (define (music-origin music)
697 "Recursively search an origin location stored in music."
698 (cond ((null? music) #f)
699 ((not (null? (ly:music-property music 'origin)))
700 (ly:music-property music 'origin))
701 (else (or (music-origin (ly:music-property music 'element))
702 (let ((origins (remove not (map music-origin
703 (ly:music-property music 'elements)))))
704 (and (not (null? origins)) (car origins)))))))
706 ;; first, split the music and fill in voices
707 (for-each (lambda (m)
709 (if (bar-check? m) (change-voice)))
710 (ly:music-property music 'elements))
711 (if (not (null? current-sequence)) (change-voice))
712 ;; un-circularize `voices' and reorder the voices
713 (set! voices (map-in-order (lambda (dummy seqs)
717 ;; set origin location of each sequence in each voice
718 ;; for better type error tracking
719 (for-each (lambda (voice)
720 (for-each (lambda (seq)
721 (set! (ly:music-property seq 'origin)
722 (or (music-origin seq) location)))
726 ;; check sequence length
727 (apply for-each (lambda* (#:rest seqs)
728 (let ((moment-reference (ly:music-length (car seqs))))
729 (for-each (lambda (seq moment)
730 (if (not (equal? moment moment-reference))
731 (ly:music-warning seq
732 "Bars in parallel music don't have the same length")))
733 seqs (map-in-order ly:music-length seqs))))
736 ;; bind voice identifiers to the voices
737 (for-each (lambda (voice-id voice)
738 (ly:parser-define! parser voice-id
739 (make-music 'SequentialMusic
745 #(define-music-function (parser loc arg) (ly:music?)
746 (_i "Tag @var{arg} to be parenthesized.")
748 (if (memq 'event-chord (ly:music-property arg 'types))
749 ;; arg is an EventChord -> set the parenthesize property
750 ;; on all child notes and rests
753 (if (or (memq 'note-event (ly:music-property ev 'types))
754 (memq 'rest-event (ly:music-property ev 'types)))
755 (set! (ly:music-property ev 'parenthesize) #t)))
756 (ly:music-property arg 'elements))
757 ;; No chord, simply set property for this expression:
758 (set! (ly:music-property arg 'parenthesize) #t))
762 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
763 (_i "Take the music in @var{part1} and @var{part2} and typeset so
764 that they share a staff.")
765 (make-part-combine-music parser
769 #(define-music-function (location parser type once) (symbol-or-boolean? boolean?)
770 (_i "Override the part-combiner.")
771 (make-music 'EventChord
772 'elements (list (make-music 'PartCombineForceEvent
775 partcombineApart = \partcombineForce #'apart ##f
776 partcombineApartOnce = \partcombineForce #'apart ##t
777 partcombineChords = \partcombineForce #'chords ##f
778 partcombineChordsOnce = \partcombineForce #'chords ##t
779 partcombineUnisono = \partcombineForce #'unisono ##f
780 partcombineUnisonoOnce = \partcombineForce #'unisono ##t
781 partcombineSoloI = \partcombineForce #'solo1 ##f
782 partcombineSoloIOnce = \partcombineForce #'solo1 ##t
783 partcombineSoloII = \partcombineForce #'solo2 ##f
784 partcombineSoloIIOnce = \partcombineForce #'solo2 ##t
785 partcombineAutomatic = \partcombineForce ##f ##f
786 partcombineAutomaticOnce = \partcombineForce ##f ##t
789 #(define-music-function (parser location dur) (ly:duration?)
790 (_i "Make a partial measure.")
792 ;; We use `descend-to-context' here instead of `context-spec-music' to
793 ;; ensure \partial still works if the Timing_translator is moved
795 (context-spec-music (make-music 'PartialSet
797 'partial-duration dur)
802 #(define-music-function
803 (parser location main-note secondary-note)
804 (ly:music? ly:music?)
805 (_i "Print a trill with @var{main-note} as the main note of the trill and
806 print @var{secondary-note} as a stemless note head in parentheses.")
807 (let* ((get-notes (lambda (ev-chord)
809 (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name)))
810 (ly:music-property ev-chord 'elements))))
811 (sec-note-events (get-notes secondary-note))
812 (trill-events (filter (lambda (m) (music-has-type m 'trill-span-event))
813 (ly:music-property main-note 'elements))))
815 (if (pair? sec-note-events)
817 (let* ((trill-pitch (ly:music-property (car sec-note-events) 'pitch))
818 (forced (ly:music-property (car sec-note-events) 'force-accidental)))
820 (if (ly:pitch? trill-pitch)
821 (for-each (lambda (m)
822 (ly:music-set-property! m 'pitch trill-pitch)) trill-events)
824 (ly:input-warning location (_ "Second argument of \\pitchedTrill should be single note: "))
825 (display sec-note-events)))
828 (for-each (lambda (m)
829 (ly:music-set-property! m 'force-accidental forced))
834 #(define-music-function (parser location what main-music) (string? ly:music?)
835 (_i "Indicate a section of music to be quoted. @var{what} indicates the name
836 of the quoted voice, as specified in an @code{\\addQuote} command.
837 @var{main-music} is used to indicate the length of music to be quoted;
838 usually contains spacers or multi-measure rests.")
839 (make-music 'QuoteMusic
841 'quoted-music-name what))
844 #(define-music-function (parser location tag music) (symbol? ly:music?)
845 (_i "Remove elements of @var{music} that are tagged with @var{tag}.")
848 (let* ((tags (ly:music-property m 'tags))
849 (res (memq tag tags)))
853 resetRelativeOctave =
854 #(define-music-function (parser location pitch) (ly:pitch?)
855 (_i "Set the octave inside a \\relative section.")
857 (make-music 'SequentialMusic
858 'to-relative-callback
859 (lambda (music last-pitch) pitch)))
862 #(define-music-function (parser location music)
864 (_i "Return @var{music} in reverse order.")
865 (retrograde-music music))
867 revertTimeSignatureSettings =
868 #(define-music-function
869 (parser location time-signature)
872 (_i "Revert @code{timeSignatureSettings}
873 for time signatures of @var{time-signature}.")
874 (revert-time-signature-setting time-signature))
877 #(define-music-function (parser location finger) (number-or-string?)
878 (_i "Apply @var{finger} as a fingering indication.")
883 (if (string? finger) 'text 'digit)
887 #(define-music-function (parser location fraction music)
888 (number-pair? ly:music?)
889 (_i "Multiply the duration of events in @var{music} by @var{fraction}.")
890 (ly:music-compress music
891 (ly:make-moment (car fraction) (cdr fraction))))
894 #(define-music-function (parser location dur dots arg)
895 (integer? integer? ly:music?)
896 (_i "Scale @var{arg} up by a factor of 2^@var{dur}*(2-(1/2)^@var{dots}).")
900 (shift-one-duration-log x dur dots)) arg))
903 #(define-music-function (parser location dur) (ly:duration?)
904 (_i "Skip forward by @var{dur}.")
905 (make-music 'SkipMusic
910 #(def-grace-function startSlashedGraceMusic stopSlashedGraceMusic
911 (_i "Create slashed graces (slashes through stems, but no slur) from
912 the following music expression"))
915 #(define-music-function (parser location parameters) (list?)
916 (_i "Set the system stretch, by reading the 'system-stretch property of
917 the `parameters' assoc list.")
919 \overrideProperty #"Score.NonMusicalPaperColumn"
920 #'line-break-system-details
921 #$(list (cons 'alignment-extra-space (cdr (assoc 'system-stretch parameters)))
922 (cons 'system-Y-extent (cdr (assoc 'system-Y-extent parameters))))
926 #(define-music-function (parser location style heads music)
927 (symbol? list-or-symbol? ly:music?)
928 (_i "Set @var{heads} in @var{music} to @var{style}.")
929 (style-note-heads heads style music))
934 #(define-music-function (parser location) ()
935 (_i "Include the string information in a chord repetition.")
936 (ly:parser-set-repetition-function parser tab-repeat-chord)
937 (make-music 'SequentialMusic 'void #t))
940 #(define-music-function (parser location tag arg) (symbol? ly:music?)
942 (_i "Add @var{tag} to the @code{tags} property of @var{arg}.")
945 (ly:music-property arg 'tags)
947 (ly:music-property arg 'tags)))
951 #(define-music-function
952 (parser location from to music)
953 (ly:pitch? ly:pitch? ly:music?)
955 (_i "Transpose @var{music} from pitch @var{from} to pitch @var{to}.")
956 (make-music 'TransposedMusic
957 'element (ly:music-transpose music (ly:pitch-diff to from))))
959 transposedCueDuring =
960 #(define-music-function
961 (parser location what dir pitch main-music)
962 (string? ly:dir? ly:pitch? ly:music?)
964 (_i "Insert notes from the part @var{what} into a voice called @code{cue},
965 using the transposition defined by @var{pitch}. This happens
966 simultaneously with @var{main-music}, which is usually a rest. The
967 argument @var{dir} determines whether the cue notes should be notated
968 as a first or second voice.")
970 (make-music 'QuoteMusic
972 'quoted-context-type 'Voice
973 'quoted-context-id "cue"
974 'quoted-music-name what
975 'quoted-voice-direction dir
976 'quoted-transposition pitch))
979 #(define-music-function (parser location pitch) (ly:pitch?)
980 (_i "Set instrument transposition")
983 (make-property-set 'instrumentTransposition
984 (ly:pitch-negate pitch))
988 #(define-music-function (parser location sym val arg)
989 (symbol? scheme? ly:music?)
990 (_i "Add @code{sym . val} to the @code{tweaks} property of @var{arg}.")
992 (if (equal? (object-property sym 'backend-type?) #f)
994 (ly:input-warning location (_ "cannot find property type-check for ~a") sym)
995 (ly:warning (_ "doing assignment anyway"))))
997 (ly:music-property arg 'tweaks)
999 (ly:music-property arg 'tweaks)))
1005 #(define-music-function (parser location music) (ly:music?)
1006 (_i "Force any @code{\\repeat volta}, @code{\\repeat tremolo} or
1007 @code{\\repeat percent} commands in @var{music} to be interpreted
1008 as @code{\\repeat unfold}.")
1009 (unfold-repeats music))
1014 #(define-music-function (parser location sym val music)
1015 (symbol? scheme? ly:music?)
1016 (_i "Set @var{sym} to @var{val} in @var{music}.")
1018 (set! (ly:music-property music sym) val)