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