]> git.donarmstrong.com Git - lilypond.git/blob - ly/music-functions-init.ly
I changed the comments on several funtions.
[lilypond.git] / ly / music-functions-init.ly
1 % -*-Scheme-*-
2
3 \version "2.12.0"
4
5
6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 %% this file is alphabetically sorted.
8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9
10 %% need SRFI-1 filter 
11
12 #(use-modules (srfi srfi-1))
13
14 acciaccatura =
15 #(def-grace-function startAcciaccaturaMusic stopAcciaccaturaMusic)
16
17 addQuote =
18 #(define-music-function (parser location name music) (string? ly:music?)
19    (_i "Add a piece of music to be quoted ")
20    (add-quotable parser name music)
21    (make-music 'SequentialMusic 'void #t))
22
23 afterGraceFraction =
24 #(cons 6 8)
25
26 afterGrace =
27 #(define-music-function
28   (parser location main grace)
29   (ly:music? ly:music?)
30
31   (let*
32       ((main-length (ly:music-length main))
33        (fraction  (ly:parser-lookup parser 'afterGraceFraction)))
34     
35     (make-simultaneous-music
36      (list
37       main
38       (make-sequential-music
39        (list
40
41         (make-music 'SkipMusic
42                     'duration (ly:make-duration
43                                0 0
44                                (* (ly:moment-main-numerator main-length)
45                                   (car fraction))
46                                (* (ly:moment-main-denominator main-length)
47                                   (cdr fraction)) ))
48         (make-music 'GraceMusic
49                     'element grace)))))))
50
51 applyMusic =
52 #(define-music-function (parser location func music) (procedure? ly:music?)
53                (func music))
54
55
56 applyOutput =
57 #(define-music-function (parser location ctx proc) (symbol? procedure?)
58                 (make-music 'ApplyOutputEvent
59                   'origin location
60                   'procedure proc
61                   'context-type ctx))
62
63 appoggiatura =
64 #(def-grace-function startAppoggiaturaMusic stopAppoggiaturaMusic)
65
66
67
68 % for regression testing purposes.
69 assertBeamQuant =
70 #(define-music-function (parser location l r) (pair? pair?)
71   (make-grob-property-override 'Beam 'positions
72    (ly:make-simple-closure
73     (ly:make-simple-closure
74      (append
75       (list chain-grob-member-functions `(,cons 0 0))
76       (check-quant-callbacks l r))))))
77     
78 % for regression testing purposes.
79 assertBeamSlope =
80 #(define-music-function (parser location comp) (procedure?)
81   (make-grob-property-override 'Beam 'positions
82    (ly:make-simple-closure
83     (ly:make-simple-closure
84      (append
85       (list chain-grob-member-functions `(,cons 0 0))
86       (check-slope-callbacks comp))))))
87
88
89
90 autochange =
91 #(define-music-function (parser location music) (ly:music?)
92                (make-autochange-music parser music))
93
94 applyContext =
95 #(define-music-function (parser location proc) (procedure?)
96                  (make-music 'ApplyContext 
97                    'origin location
98                    'procedure proc))
99
100
101 balloonGrobText =
102 #(define-music-function (parser location grob-name offset text) (symbol? number-pair? markup?)
103    
104     (make-music 'AnnotateOutputEvent
105                 'symbol grob-name
106                 'X-offset (car offset)
107                 'Y-offset (cdr offset)
108                 'text text))
109
110 balloonText =
111 #(define-music-function (parser location offset text) (number-pair? markup?)
112    
113     (make-music 'AnnotateOutputEvent
114                 'X-offset (car offset)
115                 'Y-offset (cdr offset)
116                 'text text))
117
118
119 bar =
120 #(define-music-function (parser location type)
121    (string?)
122    (context-spec-music
123     (make-property-set 'whichBar type)
124     'Timing))
125
126
127 barNumberCheck =
128 #(define-music-function (parser location n) (integer?)
129   (_i "Print a warning if the current bar number is not @var{n}.")
130    (make-music 'ApplyContext 
131                'origin location
132                'procedure 
133                (lambda (c)
134                  (let*
135                      ((cbn (ly:context-property c 'currentBarNumber)))
136                    (if (and  (number? cbn) (not (= cbn n)))
137                        (ly:input-message location "Barcheck failed got ~a expect ~a"
138                                          cbn n))))))
139
140
141 bendAfter =
142 #(define-music-function (parser location delta) (real?)
143   (_i "Create a fall or doit of pitch interval @var{delta}.")
144   (make-music 'BendAfterEvent
145    'delta-step delta))
146
147 %% why a function?
148 breathe =
149 #(define-music-function (parser location) ()
150   (_i "Insert a breath mark.")
151             (make-music 'EventChord 
152               'origin location
153               'elements (list (make-music 'BreathingEvent))))
154
155
156 clef =
157 #(define-music-function (parser location type) (string?)
158   (_i "Set the current clef to @var{type}.")
159    (make-clef-set type))
160
161
162 cueDuring = 
163 #(define-music-function
164   (parser location what dir main-music) (string? ly:dir? ly:music?)
165   (_i "Insert contents of quote @var{what} corresponding to @var{main-music},
166 in a CueVoice oriented by @var{dir}.")
167   (make-music 'QuoteMusic
168               'element main-music 
169               'quoted-context-type 'Voice
170               'quoted-context-id "cue"
171               'quoted-music-name what
172               'quoted-voice-direction dir
173               'origin location))
174
175 displayLilyMusic =
176 #(define-music-function (parser location music) (ly:music?)
177   (_i "Display  @var{music} to the console in LilyPond input notation.")
178    (newline)
179    (display-lily-music music parser)
180    music)
181
182 displayMusic =
183 #(define-music-function (parser location music) (ly:music?)
184   (_i "Display the internal representation of @var{music} to the console.")
185    (newline)
186    (display-scheme-music music)
187    music)
188
189
190 endSpanners =
191 #(define-music-function (parser location music) (ly:music?)
192   (_i "Terminate the next spanner prematurely after exactly one note without the need of a specific end spanner.")
193    (if (eq? (ly:music-property music 'name) 'EventChord)
194        (let*
195            ((elts (ly:music-property music 'elements))
196             (start-span-evs (filter (lambda (ev)
197                                 (and (music-has-type ev 'span-event)
198                                      (equal? (ly:music-property ev 'span-direction)
199                                              START)))
200                               elts))
201             (stop-span-evs
202              (map (lambda (m)
203                     (let* ((c (music-clone m)))
204                       (set! (ly:music-property c 'span-direction) STOP)
205                       c))
206                   start-span-evs))
207             (end-ev-chord (make-music 'EventChord
208                                       'elements stop-span-evs))
209             (total (make-music 'SequentialMusic
210                                'elements (list music
211                                                end-ev-chord))))
212          total)
213        
214        (ly:input-message location (_ "argument endSpanners is not an EventChord: ~a" music))))
215
216 featherDurations=
217  (_i "Adjust durations of @var{music} in @var{argument}. Argument is a fraction 
218    (numerator denominator) which controlls acceleration/deceleration. ")
219 #(define-music-function (parser location factor argument) (ly:moment? ly:music?)
220    (let*
221        ((orig-duration (ly:music-length argument))
222         (multiplier (ly:make-moment 1 1)))
223
224      (music-map 
225       (lambda (mus)
226         (if (and (eq? (ly:music-property mus 'name) 'EventChord)
227                  (< 0 (ly:moment-main-denominator (ly:music-length mus))))
228             (begin
229               (ly:music-compress mus multiplier)
230               (set! multiplier (ly:moment-mul factor multiplier)))
231             )
232         mus)
233       argument)
234
235      (ly:music-compress
236       argument
237       (ly:moment-div orig-duration (ly:music-length argument)))
238
239      argument))
240
241 grace =
242    (_i "Insert @var{music} as grace notes.")
243 #(def-grace-function startGraceMusic stopGraceMusic)
244
245 "instrument-definitions" = #'()
246
247 addInstrumentDefinition =
248 #(define-music-function
249    (parser location name lst) (string? list?)
250
251    (set! instrument-definitions (acons name lst instrument-definitions))
252
253    (make-music 'SequentialMusic 'void #t))
254
255
256 instrumentSwitch =
257    (_i "Switch instrument to @var{name}, which must be predefined with @var{\addInstrumentDefinition}.")
258 #(define-music-function
259    (parser location name) (string?)
260    (let*
261        ((handle  (assoc name instrument-definitions))
262         (instrument-def (if handle (cdr handle) '()))
263         )
264
265      (if (not handle)
266          (ly:input-message "No such instrument: ~a" name))
267      (context-spec-music
268       (make-music 'SimultaneousMusic
269                   'elements
270                   (map (lambda (kv)
271                          (make-property-set
272                           (car kv)
273                           (cdr kv)))
274                        instrument-def))
275       'Staff)))
276
277
278 %% Parser used to read page-layout file, and then retreive score tweaks.
279 #(define page-layout-parser #f)
280
281 includePageLayoutFile = 
282    (_i "Include the file @var{<basename>-page-layout.ly}.")
283 #(define-music-function (parser location) ()
284    (if (not (ly:get-option 'dump-tweaks))
285        (let ((tweak-filename (format #f "~a-page-layout.ly"
286                                      (ly:parser-output-name parser))))
287          (if (access? tweak-filename R_OK)
288              (begin
289                (ly:message "Including tweak file ~a" tweak-filename)
290                (set! page-layout-parser (ly:parser-clone parser))
291                (ly:parser-parse-string page-layout-parser
292                                        (format #f "\\include \"~a\""
293                                                tweak-filename))))))
294    (make-music 'SequentialMusic 'void #t))
295
296 keepWithTag =
297   (_i "Include only elements of @var{music} that are tagged with @var{tag}.")
298 #(define-music-function
299   (parser location tag music) (symbol? ly:music?)
300   (music-filter
301    (lambda (m)
302     (let* ((tags (ly:music-property m 'tags))
303            (res (memq tag tags)))
304      (or
305       (eq? tags '())
306       res)))
307    music))
308
309 removeWithTag = 
310  (_i "Remove elements of @var{music} that are tagged with @var{tag}.")
311 #(define-music-function
312   (parser location tag music) (symbol? ly:music?)
313   (music-filter
314    (lambda (m)
315     (let* ((tags (ly:music-property m 'tags))
316            (res (memq tag tags)))
317      (not res)))
318  music))
319
320 killCues =
321    (_i "Remove cue notes from @var{music}.")
322 #(define-music-function
323    (parser location music)
324    (ly:music?)
325    (music-map
326     (lambda (mus)
327       (if (string? (ly:music-property mus 'quoted-music-name))
328           (ly:music-property mus 'element)
329           mus)) music))
330
331 label = 
332    (_i "Create @var{label} as a bookmarking label")
333 #(define-music-function (parser location label) (symbol?)
334    (make-music 'EventChord
335                'page-marker #t
336                'page-label label
337                'elements (list (make-music 'LabelEvent
338                                            'page-label label)))) 
339
340 makeClusters =
341    (_i "Display chords in @var{arg} as clusters")
342 #(define-music-function
343                 (parser location arg) (ly:music?)
344                 (music-map note-to-cluster arg))
345
346 musicMap =
347 #(define-music-function (parser location proc mus) (procedure? ly:music?)
348              (music-map proc mus))
349
350
351
352 oldaddlyrics =
353 #(define-music-function (parser location music lyrics) (ly:music? ly:music?)
354
355               (make-music 'OldLyricCombineMusic 
356                           'origin location
357                           'elements (list music lyrics)))
358
359
360 overrideProperty =
361 #(define-music-function (parser location name property value)
362    (string? symbol? scheme?)
363
364
365    (_i "Set @var{property} to @var{value} in all grobs named @var{name}.
366 The @var{name} argument is a string of the form @code{\"Context.GrobName\"}
367 or @code{\"GrobName\"}")
368
369    (let*
370        ((name-components (string-split name #\.))
371         (context-name 'Bottom)
372         (grob-name #f))
373
374      (if (> 2 (length name-components))
375          (set! grob-name (string->symbol (car name-components)))
376          (begin
377            (set! grob-name (string->symbol (list-ref name-components 1)))
378            (set! context-name (string->symbol (list-ref name-components 0)))))
379
380      (make-music 'ApplyOutputEvent
381                  'origin location
382                  'context-type context-name
383                  'procedure
384                  (lambda (grob orig-context context)
385                    (if (equal?
386                         (cdr (assoc 'name (ly:grob-property grob 'meta)))
387                         grob-name)
388                        (set! (ly:grob-property grob property) value))))))
389
390 %% These are music functions (iso music indentifiers), because music identifiers
391 %% are not allowed at top-level.
392 pageBreak =
393 #(define-music-function (location parser) ()
394    (_i "Force a page break. May be used at toplevel (ie between scores or
395 markups), or inside a score.")
396    (make-music 'EventChord
397                'page-marker #t
398                'line-break-permission 'force
399                'page-break-permission 'force
400                'elements (list (make-music 'LineBreakEvent
401                                            'break-permission 'force)
402                                (make-music 'PageBreakEvent
403                                            'break-permission 'force))))
404
405 noPageBreak =
406 #(define-music-function (location parser) ()
407    (_i "Forbid a page break. May be used at toplevel (ie between scores or
408 markups), or inside a score.")
409    (make-music 'EventChord
410                'page-marker #t
411                'page-break-permission 'forbid
412                'elements (list (make-music 'PageBreakEvent
413                                            'break-permission '()))))
414
415 pageTurn =
416 #(define-music-function (location parser) ()
417    (_i "Force a page turn between two scores or top-level markups.")
418    (make-music 'EventChord 
419                'page-marker #t
420                'line-break-permission 'force
421                'page-break-permission 'force
422                'page-turn-permission 'force
423                'elements (list (make-music 'LineBreakEvent
424                                            'break-permission 'force)
425                                (make-music 'PageBreakEvent
426                                            'break-permission 'force)
427                                (make-music 'PageTurnEvent
428                                            'break-permission 'force))))
429
430 noPageTurn =
431 #(define-music-function (location parser) ()
432    (_i "Forbid a page turn. May be used at toplevel (ie between scores or
433 markups), or inside a score.")
434    (make-music 'EventChord
435                'page-marker #t
436                'page-turn-permission 'forbid
437                'elements (list (make-music 'PageTurnEvent
438                                            'break-permission '()))))
439
440 allowPageTurn =
441 #(define-music-function (location parser) ()
442    (_i "Allow a page turn. May be used at toplevel (ie between scores or
443 markups), or inside a score.")
444    (make-music 'EventChord
445                'page-marker #t
446                'page-turn-permission 'allow
447                'elements (list (make-music 'PageTurnEvent
448                                            'break-permission 'allow))))
449
450 %% Todo:
451 %% doing
452 %% define-music-function in a .scm causes crash.
453
454 octaveCheck =
455 #(define-music-function (parser location pitch-note) (ly:music?)
456    (_i "octave check")
457
458    (make-music 'RelativeOctaveCheck
459                'origin location
460                'pitch (pitch-of-note pitch-note) 
461            ))
462
463 ottava = #(define-music-function (parser location octave) (number?)
464   (_i "set the octavation ")
465   (make-ottava-set octave))
466
467 partcombine =
468 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
469                 (make-part-combine-music parser
470                                          (list part1 part2)))
471
472               
473 pitchedTrill =
474 #(define-music-function
475    (parser location main-note secondary-note)
476    (ly:music? ly:music?)
477    (let*
478        ((get-notes (lambda (ev-chord)
479                      (filter
480                       (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name)))
481                       (ly:music-property ev-chord 'elements))))
482         (sec-note-events (get-notes secondary-note))
483         (trill-events (filter (lambda (m) (music-has-type m 'trill-span-event))
484                               (ly:music-property main-note 'elements))))
485
486      (if (pair? sec-note-events)
487          (begin
488            (let*
489                ((trill-pitch (ly:music-property (car sec-note-events) 'pitch))
490                 (forced (ly:music-property (car sec-note-events ) 'force-accidental)))
491              
492              (if (ly:pitch? trill-pitch)
493                  (for-each (lambda (m) (ly:music-set-property! m 'pitch trill-pitch))
494                            trill-events)
495                  (begin
496                    (ly:warning (_ "Second argument of \\pitchedTrill should be single note: "))
497                    (display sec-note-events)))
498
499              (if (eq? forced #t)
500                  (for-each (lambda (m) (ly:music-set-property! m 'force-accidental forced))
501                            trill-events)))))
502      main-note))
503
504
505
506 %% for lambda*
507 #(use-modules (ice-9 optargs))
508
509 parallelMusic =
510 #(define-music-function (parser location voice-ids music) (list? ly:music?)
511   (_i "Define parallel music sequences, separated by '|' (bar check signs),
512 and assign them to the identifiers provided in @var{voice-ids}.
513
514 @var{voice-ids}: a list of music identifiers (symbols containing only letters)
515
516 @var{music}: a music sequence, containing BarChecks as limiting expressions.
517
518 Example:
519
520 @verbatim
521   \\parallelMusic #'(A B C) {
522     c c | d d | e e |
523     d d | e e | f f |
524   }
525 <==>
526   A = { c c | d d | }
527   B = { d d | e e | }
528   C = { e e | f f | }
529 @end verbatim
530 ")
531   (let* ((voices (apply circular-list (make-list (length voice-ids) (list))))
532          (current-voices voices)
533          (current-sequence (list)))
534     ;;
535     ;; utilities
536     (define (push-music m)
537       "Push the music expression into the current sequence"
538       (set! current-sequence (cons m current-sequence)))
539     (define (change-voice)
540       "Stores the previously built sequence into the current voice and
541        change to the following voice."
542       (list-set! current-voices 0 (cons (make-music 'SequentialMusic 
543                                          'elements (reverse! current-sequence))
544                                         (car current-voices)))
545       (set! current-sequence (list))
546       (set! current-voices (cdr current-voices)))
547     (define (bar-check? m)
548       "Checks whether m is a bar check."
549       (eq? (ly:music-property m 'name) 'BarCheck))
550     (define (music-origin music)
551       "Recursively search an origin location stored in music."
552       (cond ((null? music) #f)
553             ((not (null? (ly:music-property music 'origin)))
554              (ly:music-property music 'origin))
555             (else (or (music-origin (ly:music-property music 'element))
556                       (let ((origins (remove not (map music-origin 
557                                                       (ly:music-property music 'elements)))))
558                         (and (not (null? origins)) (car origins)))))))
559     ;;
560     ;; first, split the music and fill in voices
561     (map-in-order (lambda (m)
562                     (push-music m)
563                     (if (bar-check? m) (change-voice)))
564                   (ly:music-property music 'elements))
565     (if (not (null? current-sequence)) (change-voice))
566     ;; un-circularize `voices' and reorder the voices
567     (set! voices (map-in-order (lambda (dummy seqs)
568                                  (reverse! seqs))
569                                voice-ids voices))
570     ;;
571     ;; set origin location of each sequence in each voice
572     ;; for better type error tracking
573     (for-each (lambda (voice)
574                 (for-each (lambda (seq)
575                             (set! (ly:music-property seq 'origin)
576                                   (or (music-origin seq) location)))
577                           voice))
578               voices)
579     ;;
580     ;; check sequence length
581     (apply for-each (lambda* (#:rest seqs)
582                       (let ((moment-reference (ly:music-length (car seqs))))
583                         (for-each (lambda (seq moment)
584                                     (if (not (equal? moment moment-reference))
585                                         (ly:music-message seq 
586                                          "Bars in parallel music don't have the same length")))
587                           seqs (map-in-order ly:music-length seqs))))
588            voices)
589    ;;
590    ;; bind voice identifiers to the voices
591    (map (lambda (voice-id voice)
592           (ly:parser-define! parser voice-id 
593                              (make-music 'SequentialMusic 
594                                'origin location
595                                'elements voice)))
596         voice-ids voices))
597  ;; Return an empty sequence. this function is actually a "void" function.
598  (make-music 'SequentialMusic 'void #t))
599
600
601
602 parenthesize =
603 #(define-music-function (parser loc arg) (ly:music?)
604    (_i "Tag @var{arg} to be parenthesized.")
605
606    (if (memq 'event-chord (ly:music-property arg 'types))
607      ; arg is an EventChord -> set the parenthesize property on all child notes and rests
608      (map
609        (lambda (ev)
610          (if (or (memq 'note-event (ly:music-property ev 'types))
611                  (memq 'rest-event (ly:music-property ev 'types)))
612            (set! (ly:music-property ev 'parenthesize) #t)))
613        (ly:music-property arg 'elements))
614      ; No chord, simply set property for this expression:
615      (set! (ly:music-property arg 'parenthesize) #t))
616    arg)
617
618
619 quoteDuring = #
620 (define-music-function
621   (parser location what main-music)
622   (string? ly:music?)
623   (make-music 'QuoteMusic
624               'element main-music
625               'quoted-music-name what
626               'origin location))
627
628
629
630 resetRelativeOctave  =
631 #(define-music-function
632     (parser location reference-note)
633     (ly:music?)
634     (_i "Set the octave inside a \\relative section.")
635
636    (let*
637     ((notes (ly:music-property reference-note 'elements))
638      (pitch (ly:music-property (car notes) 'pitch)))
639
640     (set! (ly:music-property reference-note 'elements) '())
641     (set! (ly:music-property reference-note
642        'to-relative-callback)
643        (lambda (music last-pitch)
644         pitch))
645
646     reference-note))
647
648
649 scaleDurations =
650 #(define-music-function
651                   (parser location fraction music) (number-pair? ly:music?)
652                   (ly:music-compress music (ly:make-moment (car fraction) (cdr fraction))))
653
654
655
656 shiftDurations =
657 #(define-music-function (parser location dur dots arg) (integer? integer? ly:music?)
658    (_i "")
659    
660    (music-map
661     (lambda (x)
662       (shift-one-duration-log x dur dots)) arg))
663
664 spacingTweaks =
665 #(define-music-function (parser location parameters) (list?)
666    (_i "Set the system stretch, by reading the 'system-stretch property of
667 the `parameters' assoc list.")
668    #{
669       \overrideProperty #"Score.NonMusicalPaperColumn"
670         #'line-break-system-details
671         #$(list (cons 'alignment-extra-space (cdr (assoc 'system-stretch parameters)))
672                 (cons 'system-Y-extent (cdr (assoc 'system-Y-extent parameters))))
673    #})
674
675
676 rightHandFinger =
677 #(define-music-function (parser location finger) (number-or-string?)
678    (_i "Define a StrokeFingerEvent")
679    
680    (apply make-music
681           (append
682            (list 
683             'StrokeFingerEvent
684             'origin location)
685            (if  (string? finger)
686                 (list 'text finger)
687                 (list 'digit finger)))))
688
689 scoreTweak =
690 #(define-music-function (parser location name) (string?)
691    (_i "Include the score tweak, if exists.")
692    (if (and page-layout-parser (not (ly:get-option 'dump-tweaks)))
693        (let ((tweak-music (ly:parser-lookup page-layout-parser
694                                             (string->symbol name))))
695          (if (ly:music? tweak-music)
696              tweak-music
697              (make-music 'SequentialMusic)))
698        (make-music 'SequentialMusic)))
699
700
701 tag = #(define-music-function (parser location tag arg)
702    (symbol? ly:music?)
703
704    (_i "Add @var{tag} to the @code{tags} property of @var{arg}.")
705
706    (set!
707     (ly:music-property arg 'tags)
708     (cons tag
709           (ly:music-property arg 'tags)))
710    arg)
711
712
713
714 transposedCueDuring =
715 #(define-music-function
716   (parser location what dir pitch-note main-music)
717   (string? ly:dir? ly:music? ly:music?)
718
719   (_i "Insert notes from the part @var{what} into a voice called @code{cue},
720 using the transposition defined by @var{pitch-note}.  This happens
721 simultaneously with @var{main-music}, which is usually a rest.  The
722 argument @var{dir} determines whether the cue notes should be notated
723 as a first or second voice.")
724
725   (make-music 'QuoteMusic
726               'element main-music
727               'quoted-context-type 'Voice
728               'quoted-context-id "cue"
729               'quoted-music-name what
730               'quoted-voice-direction dir
731               'quoted-transposition (pitch-of-note pitch-note)
732               'origin location))
733
734
735
736 transposition =
737 #(define-music-function (parser location pitch-note) (ly:music?)
738    (_i "Set instrument transposition")
739
740    (context-spec-music
741     (make-property-set 'instrumentTransposition
742                        (ly:pitch-negate (pitch-of-note pitch-note)))
743         'Staff))
744
745 tweak = #(define-music-function (parser location sym val arg)
746            (symbol? scheme? ly:music?)
747
748            (_i "Add @code{sym . val} to the @code{tweaks} property of @var{arg}.")
749            
750            (set!
751             (ly:music-property arg 'tweaks)
752             (acons sym val
753                    (ly:music-property arg 'tweaks)))
754            arg)
755
756
757
758 unfoldRepeats =
759 #(define-music-function (parser location music) (ly:music?)
760                   (unfold-repeats music))
761
762
763
764 withMusicProperty =
765 #(define-music-function (parser location sym val music) (symbol? scheme? ly:music?)
766    (_i "Set @var{sym} to @var{val} in @var{music}.")
767
768    (set! (ly:music-property music sym) val)
769    music)