]> git.donarmstrong.com Git - lilypond.git/blob - ly/music-functions-init.ly
Merge remote-tracking branch 'origin/stable/2.16' into translation
[lilypond.git] / ly / music-functions-init.ly
1 %%%% -*- Mode: Scheme -*-
2
3 %%%% This file is part of LilyPond, the GNU music typesetter.
4 %%%%
5 %%%% Copyright (C) 2003--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 %%%%                          Jan Nieuwenhuizen <janneke@gnu.org>
7 %%%%
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.
12 %%%%
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.
17 %%%%
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/>.
20
21 \version "2.16.0"
22
23
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 %% this file is alphabetically sorted.
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27
28 %% need SRFI-1 for filter; optargs for lambda*
29 #(use-modules (srfi srfi-1)
30               (ice-9 optargs))
31
32 %% TODO: using define-music-function in a .scm causes crash.
33
34 acciaccatura =
35 #(def-grace-function startAcciaccaturaMusic stopAcciaccaturaMusic
36    (_i "Create an acciaccatura from the following music expression"))
37
38 %% keep these two together
39 instrument-definitions = #'()
40 addInstrumentDefinition =
41 #(define-void-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
46 addQuote =
47 #(define-void-function (parser location name music) (string? ly:music?)
48    (_i "Define @var{music} as a quotable music expression named
49 @var{name}")
50    (add-quotable parser name music))
51
52 %% keep these two together
53 afterGraceFraction = #(cons 6 8)
54 afterGrace =
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
60       (list
61        main
62        (make-sequential-music
63         (list
64
65          (make-music 'SkipMusic
66                      'duration (ly:make-duration
67                                 0 0
68                                 (* (ly:moment-main-numerator main-length)
69                                    (car fraction))
70                                 (* (ly:moment-main-denominator main-length)
71                                    (cdr fraction))))
72          (make-music 'GraceMusic
73                      'element grace)))))))
74
75
76 %% music identifiers not allowed at top-level,
77 %% so this is a music-function instead.
78 allowPageTurn =
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
83                'page-marker #t
84                'page-turn-permission 'allow
85                'elements (list (make-music 'PageTurnEvent
86                                            'break-permission 'allow))))
87
88 alterBroken =
89 #(define-music-function (parser location name property arg)
90   (string? scheme? list?)
91   (_i "Override @var{property} for pieces of broken spanner @var{name} with
92 values @var{arg}.")
93   (let* ((name (string-delete name char-set:blank)) ; remove any spaces
94          (name-components (string-split name #\.))
95          (context-name "Bottom")
96          (grob-name #f))
97
98     (if (> 2 (length name-components))
99         (set! grob-name (car name-components))
100         (begin
101           (set! grob-name (cadr name-components))
102           (set! context-name (car name-components))))
103
104     ;; only apply override if grob is a spanner
105     (let ((description
106             (assoc-get (string->symbol grob-name) all-grob-descriptions)))
107       (if (and description
108                (member 'spanner-interface
109                        (assoc-get 'interfaces
110                                   (assoc-get 'meta description))))
111           #{
112             \override $context-name . $grob-name $property =
113               #(value-for-spanner-piece arg)
114           #}
115           (begin
116             (ly:input-warning location (_ "not a spanner name, `~a'") grob-name)
117             (make-music 'SequentialMusic 'void #t))))))
118
119 appendToTag =
120 #(define-music-function (parser location tag more music)
121    (symbol? ly:music? ly:music?)
122    (_i "Append @var{more} to the @code{elements} of all music
123 expressions in @var{music} that are tagged with @var{tag}.")
124    (music-map (lambda (m)
125                 (if (memq tag (ly:music-property m 'tags))
126                     (set! (ly:music-property m 'elements)
127                           (append (ly:music-property m 'elements)
128                                   (list more))))
129                 m)
130               music))
131
132 applyContext =
133 #(define-music-function (parser location proc) (procedure?)
134    (_i "Modify context properties with Scheme procedure @var{proc}.")
135    (make-music 'ApplyContext
136                'procedure proc))
137
138 applyMusic =
139 #(define-music-function (parser location func music) (procedure? ly:music?)
140    (_i"Apply procedure @var{func} to @var{music}.")
141    (func music))
142
143 applyOutput =
144 #(define-music-function (parser location ctx proc) (symbol? procedure?)
145    (_i "Apply function @code{proc} to every layout object in context @code{ctx}")
146    (make-music 'ApplyOutputEvent
147                'procedure proc
148                'context-type ctx))
149
150 appoggiatura =
151 #(def-grace-function startAppoggiaturaMusic stopAppoggiaturaMusic
152    (_i "Create an appoggiatura from @var{music}"))
153
154 % for regression testing purposes.
155 assertBeamQuant =
156 #(define-music-function (parser location l r) (pair? pair?)
157    (_i "Testing function: check whether the beam quants @var{l} and @var{r} are correct")
158    (make-grob-property-override 'Beam 'positions (check-quant-callbacks l r)))
159
160 % for regression testing purposes.
161 assertBeamSlope =
162 #(define-music-function (parser location comp) (procedure?)
163    (_i "Testing function: check whether the slope of the beam is the same as @code{comp}")
164    (make-grob-property-override 'Beam 'positions (check-slope-callbacks comp)))
165
166 autochange =
167 #(define-music-function (parser location music) (ly:music?)
168    (_i "Make voices that switch between staves automatically")
169    (make-autochange-music parser music))
170
171
172
173 balloonGrobText =
174 #(define-music-function (parser location grob-name offset text)
175    (symbol? number-pair? markup?)
176    (_i "Attach @var{text} to @var{grob-name} at offset @var{offset}
177  (use like @code{\\once})")
178    (make-music 'AnnotateOutputEvent
179                'symbol grob-name
180                'X-offset (car offset)
181                'Y-offset (cdr offset)
182                'text text))
183
184 balloonText =
185 #(define-music-function (parser location offset text) (number-pair? markup?)
186    (_i "Attach @var{text} at @var{offset} (use like @code{\\tweak})")
187    (make-music 'AnnotateOutputEvent
188                'X-offset (car offset)
189                'Y-offset (cdr offset)
190                'text text))
191
192 bar =
193 #(define-music-function (parser location type) (string?)
194    (_i "Insert a bar line of type @var{type}")
195    (context-spec-music
196     (make-property-set 'whichBar type)
197     'Timing))
198
199 barNumberCheck =
200 #(define-music-function (parser location n) (integer?)
201    (_i "Print a warning if the current bar number is not @var{n}.")
202    (make-music 'ApplyContext
203                'procedure
204                (lambda (c)
205                  (let ((cbn (ly:context-property c 'currentBarNumber)))
206                    (if (and  (number? cbn) (not (= cbn n)))
207                        (ly:input-warning location
208                                          "Barcheck failed got ~a expect ~a"
209                                          cbn n))))))
210
211 bendAfter =
212 #(define-event-function (parser location delta) (real?)
213    (_i "Create a fall or doit of pitch interval @var{delta}.")
214    (make-music 'BendAfterEvent
215                'delta-step delta))
216
217 bookOutputName =
218 #(define-void-function (parser location newfilename) (string?)
219    (_i "Direct output for the current book block to @var{newfilename}.")
220    (set! (paper-variable parser #f 'output-filename) newfilename))
221
222 bookOutputSuffix =
223 #(define-void-function (parser location newsuffix) (string?)
224    (_i "Set the output filename suffix for the current book block to
225 @var{newsuffix}.")
226    (set! (paper-variable parser #f 'output-suffix) newsuffix))
227
228 %% \breathe is defined as a music function rather than an event identifier to
229 %% ensure it gets useful input location information: as an event identifier,
230 %% it would have to be wrapped in an EventChord to prevent it from being
231 %% treated as a post_event by the parser
232 breathe =
233 #(define-music-function (parser location) ()
234    (_i "Insert a breath mark.")
235    (make-music 'BreathingEvent))
236
237 clef =
238 #(define-music-function (parser location type) (string?)
239    (_i "Set the current clef to @var{type}.")
240    (make-clef-set type))
241
242
243 compoundMeter =
244 #(define-music-function (parser location args) (pair?)
245   (_i "Create compound time signatures. The argument is a Scheme list of
246 lists. Each list describes one fraction, with the last entry being the
247 denominator, while the first entries describe the summands in the
248 enumerator. If the time signature consists of just one fraction,
249 the list can be given directly, i.e. not as a list containing a single list.
250 For example, a time signature of (3+1)/8 + 2/4 would be created as
251 @code{\\compoundMeter #'((3 1 8) (2 4))}, and a time signature of (3+2)/8
252 as @code{\\compoundMeter #'((3 2 8))} or shorter
253 @code{\\compoundMeter #'(3 2 8)}.")
254   (let* ((mlen (calculate-compound-measure-length args))
255          (beat (calculate-compound-base-beat args))
256          (beatGrouping (calculate-compound-beat-grouping args))
257          (timesig (cons (ly:moment-main-numerator mlen)
258                         (ly:moment-main-denominator mlen))))
259   #{
260     \once \override Staff.TimeSignature #'stencil = #(lambda (grob)
261       (grob-interpret-markup grob (format-compound-time args)))
262     \set Timing.timeSignatureFraction = $timesig
263     \set Timing.baseMoment = $beat
264     \set Timing.beatStructure = $beatGrouping
265     \set Timing.beamExceptions = #'()
266     \set Timing.measureLength = $mlen
267   #} ))
268
269 crossStaff =
270 #(define-music-function (parser location notes) (ly:music?)
271   (_i "Create cross-staff stems")
272   #{
273   \override Stem #'cross-staff = #cross-staff-connect
274   \override Flag #'style = #'no-flag
275   $notes
276   \revert Stem #'cross-staff
277   \revert Flag #'style
278 #})
279
280 cueClef =
281 #(define-music-function (parser location type) (string?)
282   (_i "Set the current cue clef to @var{type}.")
283   (make-cue-clef-set type))
284
285 cueClefUnset =
286 #(define-music-function (parser location) ()
287   (_i "Unset the current cue clef.")
288   (make-cue-clef-unset))
289
290 cueDuring =
291 #(define-music-function
292    (parser location what dir main-music) (string? ly:dir? ly:music?)
293    (_i "Insert contents of quote @var{what} corresponding to @var{main-music},
294 in a CueVoice oriented by @var{dir}.")
295    (make-music 'QuoteMusic
296                'element main-music
297                'quoted-context-type 'Voice
298                'quoted-context-id "cue"
299                'quoted-music-name what
300                'quoted-voice-direction dir))
301
302 cueDuringWithClef =
303 #(define-music-function
304    (parser location what dir clef main-music) (string? ly:dir? string? ly:music?)
305    (_i "Insert contents of quote @var{what} corresponding to @var{main-music},
306 in a CueVoice oriented by @var{dir}.")
307    (make-music 'QuoteMusic
308                'element main-music
309                'quoted-context-type 'Voice
310                'quoted-context-id "cue"
311                'quoted-music-name what
312                'quoted-music-clef clef
313                'quoted-voice-direction dir))
314
315
316
317 displayLilyMusic =
318 #(define-music-function (parser location music) (ly:music?)
319    (_i "Display the LilyPond input representation of @var{music}
320 to the console.")
321    (newline)
322    (display-lily-music music parser)
323    music)
324
325 displayMusic =
326 #(define-music-function (parser location music) (ly:music?)
327    (_i "Display the internal representation of @var{music} to the console.")
328    (newline)
329    (display-scheme-music music)
330    music)
331
332
333
334 endSpanners =
335 #(define-music-function (parser location music) (ly:music?)
336    (_i "Terminate the next spanner prematurely after exactly one note
337 without the need of a specific end spanner.")
338    (let* ((start-span-evs (filter (lambda (ev)
339                                     (equal? (ly:music-property ev 'span-direction)
340                                             START))
341                                   (extract-typed-music music 'span-event)))
342           (stop-span-evs
343            (map (lambda (m)
344                   (let ((c (music-clone m)))
345                     (set! (ly:music-property c 'span-direction) STOP)
346                     c))
347                 start-span-evs))
348           (end-ev-chord (make-music 'EventChord
349                                     'elements stop-span-evs))
350           (total (make-music 'SequentialMusic
351                              'elements (list music
352                                              end-ev-chord))))
353      total))
354
355 eventChords =
356 #(define-music-function (parser location music) (ly:music?)
357    (_i "Compatibility function wrapping @code{EventChord} around
358 isolated rhythmic events occuring since version 2.15.28, after
359 expanding repeat chords @samp{q}.")
360    (event-chord-wrap! music parser))
361
362 featherDurations=
363 #(define-music-function (parser location factor argument) (ly:moment? ly:music?)
364    (_i "Adjust durations of music in @var{argument} by rational @var{factor}.")
365    (let ((orig-duration (ly:music-length argument))
366          (multiplier (ly:make-moment 1 1)))
367
368      (for-each
369       (lambda (mus)
370         (if (< 0 (ly:moment-main-denominator (ly:music-length mus)))
371             (begin
372               (ly:music-compress mus multiplier)
373               (set! multiplier (ly:moment-mul factor multiplier)))))
374       (extract-named-music argument '(EventChord NoteEvent RestEvent SkipEvent)))
375      (ly:music-compress
376       argument
377       (ly:moment-div orig-duration (ly:music-length argument)))
378
379      argument))
380
381 footnote =
382 #(define-music-function (parser location mark offset grob-name footnote music)
383    ((markup?) number-pair? (symbol?) markup? (ly:music?))
384    (_i "Make the markup @var{footnote} a footnote on @var{music}.  The
385 footnote is marked with a markup @var{mark} moved by @var{offset} with
386 respect to the marked music.
387
388 If @var{mark} is not given or specified as @var{\\default}, it is
389 replaced by an automatically generated sequence number.  If a symbol
390 @var{grob-name} is specified, then grobs of that type will be marked
391 if they have @var{music} as their ultimate cause; by default all grobs
392 having @var{music} as their @emph{direct} cause will be marked,
393 similar to the way @code{\\tweak} works.
394
395 If @var{music} is given as @code{\\default}, a footnote event
396 affecting @emph{all} grobs matching @var{grob-name} at a given time
397 step is generated.  This may be required for creating footnotes on
398 time signatures, clefs, and other items not cooperating with
399 @code{\\tweak}.
400
401 Like with @code{\\tweak}, if you use a footnote on a following
402 post-event, the @code{\\footnote} command itself needs to be attached
403 to the preceding note or rest as a post-event with @code{-}.")
404    (let ((mus (make-music
405                'FootnoteEvent
406                'X-offset (car offset)
407                'Y-offset (cdr offset)
408                'automatically-numbered (not mark)
409                'text (or mark (make-null-markup))
410                'footnote-text footnote
411                'symbol (or grob-name '()))))
412      (cond (music
413             (set! (ly:music-property music 'tweaks)
414                   (acons (if grob-name
415                              (cons grob-name 'footnote-music)
416                              'footnote-music)
417                          mus
418                          (ly:music-property music 'tweaks)))
419             music)
420            (grob-name mus)
421            (else
422             (ly:input-warning location
423                               (_ "\\footnote requires music or grob-name"))
424             (make-music 'Music)))))
425
426 grace =
427 #(def-grace-function startGraceMusic stopGraceMusic
428    (_i "Insert @var{music} as grace notes."))
429
430 grobdescriptions =
431 #(define-scheme-function (parser location descriptions) (list?)
432    (_i "Create a context modification from @var{descriptions}, a list
433 in the format of @code{all-grob-descriptions}.")
434    (ly:make-context-mod
435     (map (lambda (p)
436            (list 'assign (car p) (list (cdr p))))
437          descriptions)))
438
439 harmonicByFret = #(define-music-function (parser location fret music) (number? ly:music?)
440   (_i "Convert @var{music} into mixed harmonics; the resulting notes resemble
441 harmonics played on a fretted instrument by touching the strings at @var{fret}.")
442   #{
443     \set harmonicDots = ##t
444     \override TabNoteHead #'stencil = #(tab-note-head::print-custom-fret-label (number->string fret))
445     \override NoteHead #'Y-extent = #(ly:make-unpure-pure-container ly:grob::stencil-height
446                                        (lambda (grob start end)
447                                                (ly:grob::stencil-height grob)))
448     \override NoteHead #'stencil = #(lambda (grob) (ly:grob-set-property! grob 'style 'harmonic-mixed)
449                                             (ly:note-head::print grob))
450     $(make-harmonic
451        (calc-harmonic-pitch (fret->pitch (number->string fret)) music))
452     \unset harmonicDots
453     \revert TabNoteHead #'stencil
454     \revert NoteHead #'Y-extent
455     \revert NoteHead #'stencil
456   #})
457
458 harmonicByRatio = #(define-music-function (parser location ratio music) (number? ly:music?)
459     (_i "Convert @var{music} into mixed harmonics; the resulting notes resemble
460 harmonics played on a fretted instrument by touching the strings at the point
461 given through @var{ratio}.")
462   #{
463     \set harmonicDots = ##t
464     \override TabNoteHead #'stencil = #(tab-note-head::print-custom-fret-label (ratio->fret ratio))
465     \override NoteHead #'Y-extent = #(ly:make-unpure-pure-container ly:grob::stencil-height
466                                        (lambda (grob start end)
467                                                (ly:grob::stencil-height grob)))
468     \override NoteHead #'stencil = #(lambda (grob) (ly:grob-set-property! grob 'style 'harmonic-mixed)
469                                             (ly:note-head::print grob))
470     $(make-harmonic
471       (calc-harmonic-pitch (ratio->pitch ratio) music))
472     \unset harmonicDots
473     \revert TabNoteHead #'stencil
474     \revert NoteHead #'Y-extent
475     \revert NoteHead #'stencil
476   #})
477
478 inStaffSegno =
479 #(define-music-function (parser location) ()
480    (_i "Put the segno variant 'varsegno' at this position into the staff,
481 compatible with the repeat command.")
482    (make-music 'ApplyContext
483                'procedure
484                (lambda (ctx)
485                  (let ((score-ctx (ly:context-find ctx 'Score)))
486                    (if (ly:context? score-ctx)
487                      (let ((old-rc (ly:context-property score-ctx 'repeatCommands '())))
488                        (if (eq? (memq 'segno-display old-rc) #f)
489                          (ly:context-set-property! score-ctx 'repeatCommands (cons 'segno-display old-rc)))))))))
490
491 instrumentSwitch =
492 #(define-music-function
493    (parser location name) (string?)
494    (_i "Switch instrument to @var{name}, which must be predefined with
495 @code{\\addInstrumentDefinition}.")
496    (let* ((handle (assoc name instrument-definitions))
497           (instrument-def (if handle (cdr handle) '())))
498
499      (if (not handle)
500          (ly:input-warning location "No such instrument: ~a" name))
501      (context-spec-music
502       (make-music 'SimultaneousMusic
503                   'elements
504                   (map (lambda (kv)
505                          (make-property-set
506                           (car kv)
507                           (cdr kv)))
508                        instrument-def))
509       'Staff)))
510
511
512
513 keepWithTag =
514 #(define-music-function (parser location tag music) (symbol? ly:music?)
515    (_i "Include only elements of @var{music} that are tagged with @var{tag}.")
516    (music-filter
517     (lambda (m)
518       (let* ((tags (ly:music-property m 'tags))
519              (res (memq tag tags)))
520         (or
521          (eq? tags '())
522          res)))
523     music))
524
525 key =
526 #(define-music-function (parser location tonic pitch-alist)
527    ((ly:pitch? '()) (list? '()))
528    (_i "Set key to @var{tonic} and scale @var{pitch-alist}.
529 If both are null, just generate @code{KeyChangeEvent}.")
530    (cond ((null? tonic) (make-music 'KeyChangeEvent))
531          ((null? pitch-alist)
532           (ly:parser-error parser (_ "second argument must be pitch list")
533                            location)
534           (make-music 'SequentialMusic 'void #t))
535          (else
536           (ly:music-transpose
537            (make-music 'KeyChangeEvent
538                 'tonic (ly:make-pitch 0 0 0)
539                 'pitch-alist pitch-alist)
540            tonic))))
541
542 killCues =
543 #(define-music-function (parser location music) (ly:music?)
544    (_i "Remove cue notes from @var{music}.")
545    (music-map
546     (lambda (mus)
547       (if (and (string? (ly:music-property mus 'quoted-music-name))
548                (string=? (ly:music-property mus 'quoted-context-id "") "cue"))
549           (ly:music-property mus 'element)
550           mus))
551     music))
552
553
554
555 label =
556 #(define-music-function (parser location label) (symbol?)
557    (_i "Create @var{label} as a bookmarking label.")
558    (make-music 'EventChord
559                'page-marker #t
560                'page-label label
561                'elements (list (make-music 'LabelEvent
562                                            'page-label label))))
563
564
565 language =
566 #(define-void-function (parser location language) (string?)
567    (_i "Set note names for language @var{language}.")
568    (note-names-language parser language))
569
570 languageSaveAndChange =
571 #(define-void-function (parser location language) (string?)
572   (_i "Store the previous pitchnames alist, and set a new one.")
573   (set! previous-pitchnames pitchnames)
574   (note-names-language parser language))
575
576 languageRestore =
577 #(define-void-function (parser location) ()
578    (_i "Restore a previously-saved pitchnames alist.")
579    (if previous-pitchnames
580        (begin
581         (set! pitchnames previous-pitchnames)
582         (ly:parser-set-note-names parser pitchnames))
583       (ly:input-warning location (_ "No other language was defined previously. Ignoring."))))
584
585
586 makeClusters =
587 #(define-music-function (parser location arg) (ly:music?)
588    (_i "Display chords in @var{arg} as clusters.")
589    (music-map note-to-cluster arg))
590
591 modalInversion =
592 #(define-music-function (parser location around to scale music)
593     (ly:pitch? ly:pitch? ly:music? ly:music?)
594     (_i "Invert @var{music} about @var{around} using @var{scale} and
595 transpose from @var{around} to @var{to}.")
596     (let ((inverter (make-modal-inverter around to scale)))
597       (change-pitches music inverter)
598       music))
599
600 modalTranspose =
601 #(define-music-function (parser location from to scale music)
602     (ly:pitch? ly:pitch? ly:music? ly:music?)
603     (_i "Transpose @var{music} from pitch @var{from} to pitch @var{to}
604 using @var{scale}.")
605     (let ((transposer (make-modal-transposer from to scale)))
606       (change-pitches music transposer)
607       music))
608
609 inversion =
610 #(define-music-function
611    (parser location around to music) (ly:pitch? ly:pitch? ly:music?)
612    (_i "Invert @var{music} about @var{around} and
613 transpose from @var{around} to @var{to}.")
614    (music-invert around to music))
615
616 mark =
617 #(define-music-function
618    (parser location label) ((scheme? '()))
619   "Make the music for the \\mark command."
620   (let* ((set (and (integer? label)
621                    (context-spec-music (make-property-set 'rehearsalMark label)
622                                       'Score)))
623          (ev (make-music 'MarkEvent
624                          'origin location)))
625
626     (if set
627         (make-sequential-music (list set ev))
628         (begin
629           (set! (ly:music-property ev 'label) label)
630           ev))))
631
632 musicMap =
633 #(define-music-function (parser location proc mus) (procedure? ly:music?)
634    (_i "Apply @var{proc} to @var{mus} and all of the music it contains.")
635    (music-map proc mus))
636
637 %% noPageBreak and noPageTurn are music functions (not music indentifiers),
638 %% because music identifiers are not allowed at top-level.
639 noPageBreak =
640 #(define-music-function (location parser) ()
641    (_i "Forbid a page break.  May be used at toplevel (i.e., between scores or
642 markups), or inside a score.")
643    (make-music 'EventChord
644                'page-marker #t
645                'page-break-permission 'forbid
646                'elements (list (make-music 'PageBreakEvent
647                                            'break-permission '()))))
648
649 noPageTurn =
650 #(define-music-function (location parser) ()
651    (_i "Forbid a page turn.  May be used at toplevel (i.e., between scores or
652 markups), or inside a score.")
653    (make-music 'EventChord
654                'page-marker #t
655                'page-turn-permission 'forbid
656                'elements (list (make-music 'PageTurnEvent
657                                            'break-permission '()))))
658
659
660
661 octaveCheck =
662 #(define-music-function (parser location pitch) (ly:pitch?)
663    (_i "Octave check.")
664    (make-music 'RelativeOctaveCheck
665                'pitch pitch))
666
667 once =
668 #(define-music-function (parser location music) (ly:music?)
669    (_i "Set @code{once} to @code{#t} on all layout instruction events in @var{music}.")
670    (music-map
671     (lambda (m)
672       (cond ((music-is-of-type? m 'layout-instruction-event)
673              (set! (ly:music-property m 'once) #t))
674             ((ly:duration? (ly:music-property m 'duration))
675              (ly:music-warning m (_ "Cannot apply \\once to timed music"))))
676       m)
677     music))
678
679 ottava =
680 #(define-music-function (parser location octave) (integer?)
681    (_i "Set the octavation.")
682    (make-music 'OttavaMusic
683                'ottava-number octave))
684
685 overrideTimeSignatureSettings =
686 #(define-music-function
687    (parser location time-signature base-moment beat-structure beam-exceptions)
688    (pair? pair? cheap-list? cheap-list?)
689
690    (_i "Override @code{timeSignatureSettings}
691 for time signatures of @var{time-signature} to have settings
692 of @var{base-moment}, @var{beat-structure}, and @var{beam-exceptions}.")
693
694    ;; TODO -- add warning if largest value of grouping is
695    ;;       greater than time-signature.
696   (let ((setting (make-setting base-moment beat-structure beam-exceptions)))
697     (override-time-signature-setting time-signature setting)))
698
699 overrideProperty =
700 #(define-music-function (parser location name property value)
701    (string? symbol? scheme?)
702
703    (_i "Set @var{property} to @var{value} in all grobs named @var{name}.
704 The @var{name} argument is a string of the form @code{\"Context.GrobName\"}
705 or @code{\"GrobName\"}.")
706
707    (let ((name-components (string-split name #\.))
708          (context-name 'Bottom)
709          (grob-name #f))
710
711      (if (> 2 (length name-components))
712          (set! grob-name (string->symbol (car name-components)))
713          (begin
714            (set! grob-name (string->symbol (list-ref name-components 1)))
715            (set! context-name (string->symbol (list-ref name-components 0)))))
716
717      (make-music 'ApplyOutputEvent
718                  'context-type context-name
719                  'procedure
720                  (lambda (grob orig-context context)
721                    (if (equal?
722                         (cdr (assoc 'name (ly:grob-property grob 'meta)))
723                         grob-name)
724                        (set! (ly:grob-property grob property) value))))))
725
726
727
728 %% pageBreak and pageTurn are music functions (iso music indentifiers),
729 %% because music identifiers are not allowed at top-level.
730 pageBreak =
731 #(define-music-function (location parser) ()
732    (_i "Force a page break.  May be used at toplevel (i.e., between scores or
733 markups), or inside a score.")
734    (make-music 'EventChord
735                'page-marker #t
736                'line-break-permission 'force
737                'page-break-permission 'force
738                'elements (list (make-music 'LineBreakEvent
739                                            'break-permission 'force)
740                                (make-music 'PageBreakEvent
741                                            'break-permission 'force))))
742
743 pageTurn =
744 #(define-music-function (location parser) ()
745    (_i "Force a page turn between two scores or top-level markups.")
746    (make-music 'EventChord
747                'page-marker #t
748                'line-break-permission 'force
749                'page-break-permission 'force
750                'page-turn-permission 'force
751                'elements (list (make-music 'LineBreakEvent
752                                            'break-permission 'force)
753                                (make-music 'PageBreakEvent
754                                            'break-permission 'force)
755                                (make-music 'PageTurnEvent
756                                            'break-permission 'force))))
757
758 parallelMusic =
759 #(define-void-function (parser location voice-ids music) (list? ly:music?)
760    (_i "Define parallel music sequences, separated by '|' (bar check signs),
761 and assign them to the identifiers provided in @var{voice-ids}.
762
763 @var{voice-ids}: a list of music identifiers (symbols containing only letters)
764
765 @var{music}: a music sequence, containing BarChecks as limiting expressions.
766
767 Example:
768
769 @verbatim
770   \\parallelMusic #'(A B C) {
771     c c | d d | e e |
772     d d | e e | f f |
773   }
774 <==>
775   A = { c c | d d | }
776   B = { d d | e e | }
777   C = { e e | f f | }
778 @end verbatim
779 ")
780    (let* ((voices (apply circular-list (make-list (length voice-ids) (list))))
781           (current-voices voices)
782           (current-sequence (list))
783           (original music)
784           (wrapper #f))
785      ;;
786      ;; utilities
787      (define (push-music m)
788        "Push the music expression into the current sequence"
789        (set! current-sequence (cons m current-sequence)))
790      (define (change-voice)
791        "Stores the previously built sequence into the current voice and
792        change to the following voice."
793        (list-set! current-voices 0 (cons (make-music 'SequentialMusic
794                                                      'elements (reverse! current-sequence))
795                                          (car current-voices)))
796        (set! current-sequence (list))
797        (set! current-voices (cdr current-voices)))
798      (define (bar-check? m)
799        "Checks whether m is a bar check."
800        (eq? (ly:music-property m 'name) 'BarCheck))
801      (define (music-origin music)
802        "Recursively search an origin location stored in music."
803        (cond ((null? music) #f)
804              ((not (null? (ly:music-property music 'origin)))
805               (ly:music-property music 'origin))
806              (else (or (music-origin (ly:music-property music 'element))
807                        (let ((origins (remove not (map music-origin
808                                                        (ly:music-property music 'elements)))))
809                          (and (not (null? origins)) (car origins)))))))
810      (while (music-is-of-type? music 'music-wrapper-music)
811             (set! wrapper music)
812             (set! music (ly:music-property wrapper 'element)))
813      (if wrapper
814          (set! (ly:music-property wrapper 'element)
815                                   (make-music 'SequentialMusic
816                                               'origin location))
817          (set! original
818                (make-music 'SequentialMusic
819                            'origin location)))
820      ;;
821      ;; first, split the music and fill in voices
822      ;; We flatten direct layers of SequentialMusic since they are
823      ;; pretty much impossible to avoid when writing music functions.
824      (let rec ((music music))
825        (for-each (lambda (m)
826                    (if (eq? (ly:music-property m 'name) 'SequentialMusic)
827                        (rec m)
828                        (begin
829                          (push-music m)
830                          (if (bar-check? m) (change-voice)))))
831                  (ly:music-property music 'elements)))
832      (if (not (null? current-sequence)) (change-voice))
833      ;; un-circularize `voices' and reorder the voices
834      (set! voices (map-in-order (lambda (dummy seqs)
835                                   (reverse! seqs))
836                                 voice-ids voices))
837      ;;
838      ;; set origin location of each sequence in each voice
839      ;; for better type error tracking
840      (for-each (lambda (voice)
841                  (for-each (lambda (seq)
842                              (set! (ly:music-property seq 'origin)
843                                    (or (music-origin seq) location)))
844                            voice))
845                voices)
846      ;;
847      ;; check sequence length
848      (apply for-each (lambda* (#:rest seqs)
849                               (let ((moment-reference (ly:music-length (car seqs))))
850                                 (for-each (lambda (seq moment)
851                                             (if (not (equal? moment moment-reference))
852                                                 (ly:music-warning seq
853                                                                   "Bars in parallel music don't have the same length")))
854                                           seqs (map-in-order ly:music-length seqs))))
855             voices)
856      ;;
857      ;; bind voice identifiers to the voices
858      (for-each (lambda (voice-id voice)
859             (ly:parser-define! parser voice-id
860                                (let ((v (ly:music-deep-copy original)))
861                                  (set! (ly:music-property
862                                         (car (extract-named-music
863                                               v 'SequentialMusic))
864                                         'elements) voice)
865                                  v)))
866           voice-ids voices)))
867
868 parenthesize =
869 #(define-music-function (parser loc arg) (ly:music?)
870    (_i "Tag @var{arg} to be parenthesized.")
871
872    (if (memq 'event-chord (ly:music-property arg 'types))
873        ;; arg is an EventChord -> set the parenthesize property
874        ;; on all child notes and rests
875        (for-each
876         (lambda (ev)
877           (if (or (memq 'note-event (ly:music-property ev 'types))
878                   (memq 'rest-event (ly:music-property ev 'types)))
879               (set! (ly:music-property ev 'parenthesize) #t)))
880         (ly:music-property arg 'elements))
881        ;; No chord, simply set property for this expression:
882        (set! (ly:music-property arg 'parenthesize) #t))
883    arg)
884
885 partcombine =
886 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
887    (_i "Take the music in @var{part1} and @var{part2} and typeset so
888 that they share a staff.")
889    (make-part-combine-music parser
890                             (list part1 part2) #f))
891
892 partcombineUp =
893 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
894    (_i "Take the music in @var{part1} and @var{part2} and typeset so
895 that they share a staff with stems directed upward.")
896    (make-part-combine-music parser
897                             (list part1 part2) UP))
898
899 partcombineDown =
900 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
901    (_i "Take the music in @var{part1} and @var{part2} and typeset so
902 that they share a staff with stems directed downward.")
903    (make-part-combine-music parser
904                             (list part1 part2) DOWN))
905
906 partcombineForce =
907 #(define-music-function (location parser type once) (symbol-or-boolean? boolean?)
908    (_i "Override the part-combiner.")
909    (make-music 'EventChord
910                'elements (list (make-music 'PartCombineForceEvent
911                                            'forced-type type
912                                            'once once))))
913 partcombineApart = \partcombineForce #'apart ##f
914 partcombineApartOnce = \partcombineForce #'apart ##t
915 partcombineChords = \partcombineForce #'chords ##f
916 partcombineChordsOnce = \partcombineForce #'chords ##t
917 partcombineUnisono = \partcombineForce #'unisono ##f
918 partcombineUnisonoOnce = \partcombineForce #'unisono ##t
919 partcombineSoloI = \partcombineForce #'solo1 ##f
920 partcombineSoloIOnce = \partcombineForce #'solo1 ##t
921 partcombineSoloII = \partcombineForce #'solo2 ##f
922 partcombineSoloIIOnce = \partcombineForce #'solo2 ##t
923 partcombineAutomatic = \partcombineForce ##f ##f
924 partcombineAutomaticOnce = \partcombineForce ##f ##t
925
926 partial =
927 #(define-music-function (parser location dur) (ly:duration?)
928   (_i "Make a partial measure.")
929
930   ;; We use `descend-to-context' here instead of `context-spec-music' to
931   ;; ensure \partial still works if the Timing_translator is moved
932     (descend-to-context
933      (context-spec-music (make-music 'PartialSet
934                                      'origin location
935                                      'partial-duration dur)
936                          'Timing)
937      'Score))
938
939 pitchedTrill =
940 #(define-music-function
941    (parser location main-note secondary-note)
942    (ly:music? ly:music?)
943    (_i "Print a trill with @var{main-note} as the main note of the trill and
944 print @var{secondary-note} as a stemless note head in parentheses.")
945    (let* ((get-notes (lambda (ev-chord)
946                        (extract-named-music ev-chord 'NoteEvent)))
947           (sec-note-events (get-notes secondary-note))
948           (trill-events (extract-named-music main-note 'TrillSpanEvent)))
949      (if (pair? sec-note-events)
950          (begin
951            (let* ((trill-pitch (ly:music-property (car sec-note-events) 'pitch))
952                   (forced (ly:music-property (car sec-note-events) 'force-accidental)))
953
954              (if (ly:pitch? trill-pitch)
955                  (for-each (lambda (m)
956                              (ly:music-set-property! m 'pitch trill-pitch)) trill-events)
957                  (begin
958                    (ly:input-warning location (_ "Second argument of \\pitchedTrill should be single note: "))
959                    (display sec-note-events)))
960
961              (if (eq? forced #t)
962                  (for-each (lambda (m)
963                              (ly:music-set-property! m 'force-accidental forced))
964                            trill-events)))))
965      main-note))
966
967 pushToTag =
968 #(define-music-function (parser location tag more music)
969    (symbol? ly:music? ly:music?)
970    (_i "Add @var{more} to the front of @code{elements} of all music
971 expressions in @var{music} that are tagged with @var{tag}.")
972    (music-map (lambda (m)
973                 (if (memq tag (ly:music-property m 'tags))
974                     (set! (ly:music-property m 'elements)
975                           (cons more (ly:music-property m 'elements))))
976                 m)
977               music))
978
979 quoteDuring =
980 #(define-music-function (parser location what main-music) (string? ly:music?)
981    (_i "Indicate a section of music to be quoted.  @var{what} indicates the name
982 of the quoted voice, as specified in an @code{\\addQuote} command.
983 @var{main-music} is used to indicate the length of music to be quoted;
984 usually contains spacers or multi-measure rests.")
985    (make-music 'QuoteMusic
986                'element main-music
987                'quoted-music-name what))
988
989 relative =
990 #(define-music-function (parser location pitch music)
991    ((ly:pitch? (ly:make-pitch 0 0 0)) ly:music?)
992    (_i "Make @var{music} relative to @var{pitch} (default @code{c'}).")
993    (ly:make-music-relative! music pitch)
994    (make-music 'RelativeOctaveMusic
995                'element music))
996
997 removeWithTag =
998 #(define-music-function (parser location tag music) (symbol? ly:music?)
999    (_i "Remove elements of @var{music} that are tagged with @var{tag}.")
1000    (music-filter
1001     (lambda (m)
1002       (let* ((tags (ly:music-property m 'tags))
1003              (res (memq tag tags)))
1004         (not res)))
1005     music))
1006
1007 resetRelativeOctave =
1008 #(define-music-function (parser location pitch) (ly:pitch?)
1009    (_i "Set the octave inside a \\relative section.")
1010
1011    (make-music 'SequentialMusic
1012                'to-relative-callback
1013                (lambda (music last-pitch) pitch)))
1014
1015 retrograde =
1016 #(define-music-function (parser location music)
1017     (ly:music?)
1018     (_i "Return @var{music} in reverse order.")
1019     (retrograde-music music))
1020
1021 revertTimeSignatureSettings =
1022 #(define-music-function
1023    (parser location time-signature)
1024    (pair?)
1025
1026    (_i "Revert @code{timeSignatureSettings}
1027 for time signatures of @var{time-signature}.")
1028    (revert-time-signature-setting time-signature))
1029
1030 rightHandFinger =
1031 #(define-event-function (parser location finger) (number-or-string?)
1032    (_i "Apply @var{finger} as a fingering indication.")
1033
1034    (make-music
1035             'StrokeFingerEvent
1036             'origin location
1037             (if (string? finger) 'text 'digit)
1038             finger))
1039
1040 scaleDurations =
1041 #(define-music-function (parser location fraction music)
1042    (fraction? ly:music?)
1043    (_i "Multiply the duration of events in @var{music} by @var{fraction}.")
1044    (ly:music-compress music
1045                       (ly:make-moment (car fraction) (cdr fraction))))
1046
1047 settingsFrom =
1048 #(define-scheme-function (parser location ctx music)
1049    ((symbol?) ly:music?)
1050    (_i "Take the layout instruction events from @var{music}, optionally
1051 restricted to those applying to context type @var{ctx}, and return
1052 a context modification duplicating their effect.")
1053    (let ((mods (ly:make-context-mod)))
1054      (define (musicop m)
1055        (if (music-is-of-type? m 'layout-instruction-event)
1056            (ly:add-context-mod
1057             mods
1058             (case (ly:music-property m 'name)
1059               ((PropertySet)
1060                (list 'assign
1061                      (ly:music-property m 'symbol)
1062                      (ly:music-property m 'value)))
1063               ((PropertyUnset)
1064                (list 'unset
1065                      (ly:music-property m 'symbol)))
1066               ((OverrideProperty)
1067                (cons* 'push
1068                       (ly:music-property m 'symbol)
1069                       (ly:music-property m 'grob-value)
1070                       (cond
1071                        ((ly:music-property m 'grob-property #f) => list)
1072                        (else
1073                         (ly:music-property m 'grob-property-path)))))
1074               ((RevertProperty)
1075                (cons* 'pop
1076                       (ly:music-property m 'symbol)
1077                       (cond
1078                        ((ly:music-property m 'grob-property #f) => list)
1079                        (else
1080                         (ly:music-property m 'grob-property-path)))))))
1081            (case (ly:music-property m 'name)
1082              ((ApplyContext)
1083               (ly:add-context-mod mods
1084                                   (list 'apply
1085                                         (ly:music-property m 'procedure))))
1086              ((ContextSpeccedMusic)
1087               (if (or (not ctx)
1088                       (eq? ctx (ly:music-property m 'context-type)))
1089                   (musicop (ly:music-property m 'element))))
1090              (else
1091               (let ((callback (ly:music-property m 'elements-callback)))
1092                 (if (procedure? callback)
1093                     (for-each musicop (callback m))))))))
1094      (musicop music)
1095      mods))
1096
1097 shape =
1098 #(define-music-function (parser location grob offsets)
1099    (string? list?)
1100    (_i "Offset control-points of @var{grob} by @var{offsets}.  The argument
1101 is a list of number pairs or list of such lists.  Each element of a pair
1102 represents an offset to one of the coordinates of a control-point.")
1103    (define ((shape-curve offsets) grob)
1104      (let* ((orig (ly:grob-original grob))
1105             (siblings (if (ly:spanner? grob)
1106                           (ly:spanner-broken-into orig) '()))
1107             (total-found (length siblings))
1108             (function (assoc-get 'control-points
1109                                  (reverse (ly:grob-basic-properties grob))))
1110             (coords (function grob)))
1111
1112        (define (offset-control-points offsets)
1113          (if (null? offsets)
1114              coords
1115              (map
1116                (lambda (x y) (coord-translate x y))
1117                coords offsets)))
1118
1119        (define (helper sibs offs)
1120          (if (pair? offs)
1121              (if (eq? (car sibs) grob)
1122                  (offset-control-points (car offs))
1123                  (helper (cdr sibs) (cdr offs)))
1124              coords))
1125
1126        ;; we work with lists of lists
1127        (if (or (null? offsets)
1128                (not (list? (car offsets))))
1129            (set! offsets (list offsets)))
1130
1131        (if (>= total-found 2)
1132            (helper siblings offsets)
1133            (offset-control-points (car offsets)))))
1134
1135    #{
1136      \once \override $grob #'control-points = #(shape-curve offsets)
1137    #})
1138
1139 shiftDurations =
1140 #(define-music-function (parser location dur dots arg)
1141    (integer? integer? ly:music?)
1142    (_i "Change the duration of @var{arg} by adding @var{dur} to the
1143 @code{durlog} of @var{arg} and @var{dots} to the @code{dots} of @var{arg}.")
1144
1145    (music-map
1146     (lambda (x)
1147       (shift-one-duration-log x dur dots)) arg))
1148
1149 skip =
1150 #(define-music-function (parser location dur) (ly:duration?)
1151   (_i "Skip forward by @var{dur}.")
1152   (make-music 'SkipMusic
1153               'duration dur))
1154
1155
1156 slashedGrace =
1157 #(def-grace-function startSlashedGraceMusic stopSlashedGraceMusic
1158    (_i "Create slashed graces (slashes through stems, but no slur) from
1159 the following music expression"))
1160
1161 spacingTweaks =
1162 #(define-music-function (parser location parameters) (list?)
1163    (_i "Set the system stretch, by reading the 'system-stretch property of
1164 the `parameters' assoc list.")
1165    #{
1166      \overrideProperty #"Score.NonMusicalPaperColumn"
1167      #'line-break-system-details
1168      #(list (cons 'alignment-extra-space (cdr (assoc 'system-stretch parameters)))
1169              (cons 'system-Y-extent (cdr (assoc 'system-Y-extent parameters))))
1170    #})
1171
1172 styledNoteHeads =
1173 #(define-music-function (parser location style heads music)
1174    (symbol? list-or-symbol? ly:music?)
1175    (_i "Set @var{heads} in @var{music} to @var{style}.")
1176    (style-note-heads heads style music))
1177
1178 tag =
1179 #(define-music-function (parser location tag arg) (symbol? ly:music?)
1180
1181    (_i "Add @var{tag} to the @code{tags} property of @var{arg}.")
1182
1183    (set!
1184     (ly:music-property arg 'tags)
1185     (cons tag
1186           (ly:music-property arg 'tags)))
1187    arg)
1188
1189 time =
1190 #(define-music-function (parser location beat-structure fraction)
1191    ((number-list? '()) fraction?)
1192    (_i "Set @var{fraction} as time signature, with optional
1193 number list @var{beat-structure} before it.")
1194   (make-music 'TimeSignatureMusic
1195               'numerator (car fraction)
1196               'denominator (cdr fraction)
1197               'beat-structure beat-structure))
1198
1199 times =
1200 #(define-music-function (parser location fraction music)
1201    (fraction? ly:music?)
1202    (_i "Scale @var{music} in time by @var{fraction}.")
1203   (make-music 'TimeScaledMusic
1204               'element (ly:music-compress music (ly:make-moment (car fraction) (cdr fraction)))
1205               'numerator (car fraction)
1206               'denominator (cdr fraction)))
1207
1208 transpose =
1209 #(define-music-function
1210    (parser location from to music)
1211    (ly:pitch? ly:pitch? ly:music?)
1212
1213    (_i "Transpose @var{music} from pitch @var{from} to pitch @var{to}.")
1214    (make-music 'TransposedMusic
1215                'element (ly:music-transpose music (ly:pitch-diff to from))))
1216
1217 transposedCueDuring =
1218 #(define-music-function
1219    (parser location what dir pitch main-music)
1220    (string? ly:dir? ly:pitch? ly:music?)
1221
1222    (_i "Insert notes from the part @var{what} into a voice called @code{cue},
1223 using the transposition defined by @var{pitch}.  This happens
1224 simultaneously with @var{main-music}, which is usually a rest.  The
1225 argument @var{dir} determines whether the cue notes should be notated
1226 as a first or second voice.")
1227
1228    (make-music 'QuoteMusic
1229                'element main-music
1230                'quoted-context-type 'Voice
1231                'quoted-context-id "cue"
1232                'quoted-music-name what
1233                'quoted-voice-direction dir
1234                'quoted-transposition pitch))
1235
1236 transposition =
1237 #(define-music-function (parser location pitch) (ly:pitch?)
1238    (_i "Set instrument transposition")
1239
1240    (context-spec-music
1241     (make-property-set 'instrumentTransposition
1242                        (ly:pitch-negate pitch))
1243     'Staff))
1244
1245 tweak =
1246 #(define-music-function (parser location grob prop value music)
1247    ((string?) symbol? scheme? ly:music?)
1248    (_i "Add a tweak to the following @var{music}.
1249 Layout objects created by @var{music} get their property @var{prop}
1250 set to @var{value}.  If @var{grob} is specified, like with
1251 @example
1252 \\tweak Accidental #'color #red cis'
1253 @end example
1254 an indirectly created grob (@samp{Accidental} is caused by
1255 @samp{NoteHead}) can be tweaked; otherwise only directly created grobs
1256 are affected.")
1257    (if (not (object-property prop 'backend-type?))
1258        (begin
1259          (ly:input-warning location (_ "cannot find property type-check for ~a") prop)
1260          (ly:warning (_ "doing assignment anyway"))))
1261    (set!
1262     (ly:music-property music 'tweaks)
1263     (acons (if grob (cons (string->symbol grob) prop) prop)
1264            value
1265            (ly:music-property music 'tweaks)))
1266    music)
1267
1268 unfoldRepeats =
1269 #(define-music-function (parser location music) (ly:music?)
1270    (_i "Force any @code{\\repeat volta}, @code{\\repeat tremolo} or
1271 @code{\\repeat percent} commands in @var{music} to be interpreted
1272 as @code{\\repeat unfold}.")
1273    (unfold-repeats music))
1274
1275 void =
1276 #(define-void-function (parser location arg) (scheme?)
1277    (_i "Accept a scheme argument, return a void expression.
1278 Use this if you want to have a scheme expression evaluated
1279 because of its side-effects, but its value ignored."))
1280
1281 withMusicProperty =
1282 #(define-music-function (parser location sym val music)
1283    (symbol? scheme? ly:music?)
1284    (_i "Set @var{sym} to @var{val} in @var{music}.")
1285
1286    (set! (ly:music-property music sym) val)
1287    music)