]> git.donarmstrong.com Git - lilypond.git/blob - ly/music-functions-init.ly
Merge branch 'lilypond/translation' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond
[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  the LilyPond input representation of @var{music}
178 to the console.")
179    (newline)
180    (display-lily-music music parser)
181    music)
182
183 displayMusic =
184 #(define-music-function (parser location music) (ly:music?)
185   (_i "Display the internal representation of @var{music} to the console.")
186    (newline)
187    (display-scheme-music music)
188    music)
189
190
191 endSpanners =
192 #(define-music-function (parser location music) (ly:music?)
193   (_i "Terminate the next spanner prematurely after exactly one note without the need of a specific end spanner.")
194    (if (eq? (ly:music-property music 'name) 'EventChord)
195        (let*
196            ((elts (ly:music-property music 'elements))
197             (start-span-evs (filter (lambda (ev)
198                                 (and (music-has-type ev 'span-event)
199                                      (equal? (ly:music-property ev 'span-direction)
200                                              START)))
201                               elts))
202             (stop-span-evs
203              (map (lambda (m)
204                     (let* ((c (music-clone m)))
205                       (set! (ly:music-property c 'span-direction) STOP)
206                       c))
207                   start-span-evs))
208             (end-ev-chord (make-music 'EventChord
209                                       'elements stop-span-evs))
210             (total (make-music 'SequentialMusic
211                                'elements (list music
212                                                end-ev-chord))))
213          total)
214        
215        (ly:input-message location (_ "argument endSpanners is not an EventChord: ~a" music))))
216
217 featherDurations=
218 #(define-music-function (parser location factor argument) (ly:moment? ly:music?)
219  (_i "Adjust durations of music in @var{argument} by rational @var{factor}. ")
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 #(def-grace-function startGraceMusic stopGraceMusic
243    (_i "Insert @var{music} as grace notes."))
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 #(define-music-function
258    (parser location name) (string?)
259    (_i "Switch instrument to @var{name}, which must be predefined with 
260 @var{\addInstrumentDefinition}.")
261    (let*
262        ((handle  (assoc name instrument-definitions))
263         (instrument-def (if handle (cdr handle) '()))
264         )
265
266      (if (not handle)
267          (ly:input-message "No such instrument: ~a" name))
268      (context-spec-music
269       (make-music 'SimultaneousMusic
270                   'elements
271                   (map (lambda (kv)
272                          (make-property-set
273                           (car kv)
274                           (cdr kv)))
275                        instrument-def))
276       'Staff)))
277
278
279 %% Parser used to read page-layout file, and then retreive score tweaks.
280 #(define page-layout-parser #f)
281
282 includePageLayoutFile = 
283 #(define-music-function (parser location) ()
284    (_i "Include the file @var{<basename>-page-layout.ly}. Deprecated as
285 part of two-pass spacing.")
286    (if (not (ly:get-option 'dump-tweaks))
287        (let ((tweak-filename (format #f "~a-page-layout.ly"
288                                      (ly:parser-output-name parser))))
289          (if (access? tweak-filename R_OK)
290              (begin
291                (ly:message "Including tweak file ~a" tweak-filename)
292                (set! page-layout-parser (ly:parser-clone parser))
293                (ly:parser-parse-string page-layout-parser
294                                        (format #f "\\include \"~a\""
295                                                tweak-filename))))))
296    (make-music 'SequentialMusic 'void #t))
297
298 keepWithTag =
299 #(define-music-function
300   (parser location tag music) (symbol? ly:music?)
301   (_i "Include only elements of @var{music} that are tagged with @var{tag}.")
302   (music-filter
303    (lambda (m)
304     (let* ((tags (ly:music-property m 'tags))
305            (res (memq tag tags)))
306      (or
307       (eq? tags '())
308       res)))
309    music))
310
311 removeWithTag = 
312 #(define-music-function
313   (parser location tag music) (symbol? ly:music?)
314   (_i "Remove elements of @var{music} that are tagged with @var{tag}.")
315   (music-filter
316    (lambda (m)
317     (let* ((tags (ly:music-property m 'tags))
318            (res (memq tag tags)))
319      (not res)))
320  music))
321
322 killCues =
323 #(define-music-function
324    (parser location music)
325    (ly:music?)
326    (_i "Remove cue notes from @var{music}.")
327    (music-map
328     (lambda (mus)
329       (if (string? (ly:music-property mus 'quoted-music-name))
330           (ly:music-property mus 'element)
331           mus)) music))
332
333 label = 
334 #(define-music-function (parser location label) (symbol?)
335    (_i "Create @var{label} as a bookmarking label")
336    (make-music 'EventChord
337                'page-marker #t
338                'page-label label
339                'elements (list (make-music 'LabelEvent
340                                            'page-label label)))) 
341
342 makeClusters =
343 #(define-music-function
344                 (parser location arg) (ly:music?)
345    (_i "Display chords in @var{arg} as clusters")
346                 (music-map note-to-cluster arg))
347
348 musicMap =
349 #(define-music-function (parser location proc mus) (procedure? ly:music?)
350              (music-map proc mus))
351
352
353
354 oldaddlyrics =
355 #(define-music-function (parser location music lyrics) (ly:music? ly:music?)
356
357               (make-music 'OldLyricCombineMusic 
358                           'origin location
359                           'elements (list music lyrics)))
360
361
362 overrideProperty =
363 #(define-music-function (parser location name property value)
364    (string? symbol? scheme?)
365
366
367    (_i "Set @var{property} to @var{value} in all grobs named @var{name}.
368 The @var{name} argument is a string of the form @code{\"Context.GrobName\"}
369 or @code{\"GrobName\"}")
370
371    (let*
372        ((name-components (string-split name #\.))
373         (context-name 'Bottom)
374         (grob-name #f))
375
376      (if (> 2 (length name-components))
377          (set! grob-name (string->symbol (car name-components)))
378          (begin
379            (set! grob-name (string->symbol (list-ref name-components 1)))
380            (set! context-name (string->symbol (list-ref name-components 0)))))
381
382      (make-music 'ApplyOutputEvent
383                  'origin location
384                  'context-type context-name
385                  'procedure
386                  (lambda (grob orig-context context)
387                    (if (equal?
388                         (cdr (assoc 'name (ly:grob-property grob 'meta)))
389                         grob-name)
390                        (set! (ly:grob-property grob property) value))))))
391
392 %% These are music functions (iso music indentifiers), because music identifiers
393 %% are not allowed at top-level.
394 pageBreak =
395 #(define-music-function (location parser) ()
396    (_i "Force a page break. May be used at toplevel (ie between scores or
397 markups), or inside a score.")
398    (make-music 'EventChord
399                'page-marker #t
400                'line-break-permission 'force
401                'page-break-permission 'force
402                'elements (list (make-music 'LineBreakEvent
403                                            'break-permission 'force)
404                                (make-music 'PageBreakEvent
405                                            'break-permission 'force))))
406
407 noPageBreak =
408 #(define-music-function (location parser) ()
409    (_i "Forbid a page break. May be used at toplevel (ie between scores or
410 markups), or inside a score.")
411    (make-music 'EventChord
412                'page-marker #t
413                'page-break-permission 'forbid
414                'elements (list (make-music 'PageBreakEvent
415                                            'break-permission '()))))
416
417 pageTurn =
418 #(define-music-function (location parser) ()
419    (_i "Force a page turn between two scores or top-level markups.")
420    (make-music 'EventChord 
421                'page-marker #t
422                'line-break-permission 'force
423                'page-break-permission 'force
424                'page-turn-permission 'force
425                'elements (list (make-music 'LineBreakEvent
426                                            'break-permission 'force)
427                                (make-music 'PageBreakEvent
428                                            'break-permission 'force)
429                                (make-music 'PageTurnEvent
430                                            'break-permission 'force))))
431
432 noPageTurn =
433 #(define-music-function (location parser) ()
434    (_i "Forbid a page turn. May be used at toplevel (ie between scores or
435 markups), or inside a score.")
436    (make-music 'EventChord
437                'page-marker #t
438                'page-turn-permission 'forbid
439                'elements (list (make-music 'PageTurnEvent
440                                            'break-permission '()))))
441
442 allowPageTurn =
443 #(define-music-function (location parser) ()
444    (_i "Allow a page turn. May be used at toplevel (ie between scores or
445 markups), or inside a score.")
446    (make-music 'EventChord
447                'page-marker #t
448                'page-turn-permission 'allow
449                'elements (list (make-music 'PageTurnEvent
450                                            'break-permission 'allow))))
451
452 %% Todo:
453 %% doing
454 %% define-music-function in a .scm causes crash.
455
456 octaveCheck =
457 #(define-music-function (parser location pitch-note) (ly:music?)
458    (_i "octave check")
459
460    (make-music 'RelativeOctaveCheck
461                'origin location
462                'pitch (pitch-of-note pitch-note) 
463            ))
464
465 ottava = #(define-music-function (parser location octave) (number?)
466   (_i "set the octavation ")
467   (make-ottava-set octave))
468
469 partcombine =
470 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
471                 (make-part-combine-music parser
472                                          (list part1 part2)))
473
474               
475 pitchedTrill =
476 #(define-music-function
477    (parser location main-note secondary-note)
478    (ly:music? ly:music?)
479    (let*
480        ((get-notes (lambda (ev-chord)
481                      (filter
482                       (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name)))
483                       (ly:music-property ev-chord 'elements))))
484         (sec-note-events (get-notes secondary-note))
485         (trill-events (filter (lambda (m) (music-has-type m 'trill-span-event))
486                               (ly:music-property main-note 'elements))))
487
488      (if (pair? sec-note-events)
489          (begin
490            (let*
491                ((trill-pitch (ly:music-property (car sec-note-events) 'pitch))
492                 (forced (ly:music-property (car sec-note-events ) 'force-accidental)))
493              
494              (if (ly:pitch? trill-pitch)
495                  (for-each (lambda (m) (ly:music-set-property! m 'pitch trill-pitch))
496                            trill-events)
497                  (begin
498                    (ly:warning (_ "Second argument of \\pitchedTrill should be single note: "))
499                    (display sec-note-events)))
500
501              (if (eq? forced #t)
502                  (for-each (lambda (m) (ly:music-set-property! m 'force-accidental forced))
503                            trill-events)))))
504      main-note))
505
506
507
508 %% for lambda*
509 #(use-modules (ice-9 optargs))
510
511 parallelMusic =
512 #(define-music-function (parser location voice-ids music) (list? ly:music?)
513   (_i "Define parallel music sequences, separated by '|' (bar check signs),
514 and assign them to the identifiers provided in @var{voice-ids}.
515
516 @var{voice-ids}: a list of music identifiers (symbols containing only letters)
517
518 @var{music}: a music sequence, containing BarChecks as limiting expressions.
519
520 Example:
521
522 @verbatim
523   \\parallelMusic #'(A B C) {
524     c c | d d | e e |
525     d d | e e | f f |
526   }
527 <==>
528   A = { c c | d d | }
529   B = { d d | e e | }
530   C = { e e | f f | }
531 @end verbatim
532 ")
533   (let* ((voices (apply circular-list (make-list (length voice-ids) (list))))
534          (current-voices voices)
535          (current-sequence (list)))
536     ;;
537     ;; utilities
538     (define (push-music m)
539       "Push the music expression into the current sequence"
540       (set! current-sequence (cons m current-sequence)))
541     (define (change-voice)
542       "Stores the previously built sequence into the current voice and
543        change to the following voice."
544       (list-set! current-voices 0 (cons (make-music 'SequentialMusic 
545                                          'elements (reverse! current-sequence))
546                                         (car current-voices)))
547       (set! current-sequence (list))
548       (set! current-voices (cdr current-voices)))
549     (define (bar-check? m)
550       "Checks whether m is a bar check."
551       (eq? (ly:music-property m 'name) 'BarCheck))
552     (define (music-origin music)
553       "Recursively search an origin location stored in music."
554       (cond ((null? music) #f)
555             ((not (null? (ly:music-property music 'origin)))
556              (ly:music-property music 'origin))
557             (else (or (music-origin (ly:music-property music 'element))
558                       (let ((origins (remove not (map music-origin 
559                                                       (ly:music-property music 'elements)))))
560                         (and (not (null? origins)) (car origins)))))))
561     ;;
562     ;; first, split the music and fill in voices
563     (map-in-order (lambda (m)
564                     (push-music m)
565                     (if (bar-check? m) (change-voice)))
566                   (ly:music-property music 'elements))
567     (if (not (null? current-sequence)) (change-voice))
568     ;; un-circularize `voices' and reorder the voices
569     (set! voices (map-in-order (lambda (dummy seqs)
570                                  (reverse! seqs))
571                                voice-ids voices))
572     ;;
573     ;; set origin location of each sequence in each voice
574     ;; for better type error tracking
575     (for-each (lambda (voice)
576                 (for-each (lambda (seq)
577                             (set! (ly:music-property seq 'origin)
578                                   (or (music-origin seq) location)))
579                           voice))
580               voices)
581     ;;
582     ;; check sequence length
583     (apply for-each (lambda* (#:rest seqs)
584                       (let ((moment-reference (ly:music-length (car seqs))))
585                         (for-each (lambda (seq moment)
586                                     (if (not (equal? moment moment-reference))
587                                         (ly:music-message seq 
588                                          "Bars in parallel music don't have the same length")))
589                           seqs (map-in-order ly:music-length seqs))))
590            voices)
591    ;;
592    ;; bind voice identifiers to the voices
593    (map (lambda (voice-id voice)
594           (ly:parser-define! parser voice-id 
595                              (make-music 'SequentialMusic 
596                                'origin location
597                                'elements voice)))
598         voice-ids voices))
599  ;; Return an empty sequence. this function is actually a "void" function.
600  (make-music 'SequentialMusic 'void #t))
601
602
603
604 parenthesize =
605 #(define-music-function (parser loc arg) (ly:music?)
606    (_i "Tag @var{arg} to be parenthesized.")
607
608    (if (memq 'event-chord (ly:music-property arg 'types))
609      ; arg is an EventChord -> set the parenthesize property on all child notes and rests
610      (map
611        (lambda (ev)
612          (if (or (memq 'note-event (ly:music-property ev 'types))
613                  (memq 'rest-event (ly:music-property ev 'types)))
614            (set! (ly:music-property ev 'parenthesize) #t)))
615        (ly:music-property arg 'elements))
616      ; No chord, simply set property for this expression:
617      (set! (ly:music-property arg 'parenthesize) #t))
618    arg)
619
620
621 quoteDuring = #
622 (define-music-function
623   (parser location what main-music)
624   (string? ly:music?)
625   (make-music 'QuoteMusic
626               'element main-music
627               'quoted-music-name what
628               'origin location))
629
630
631
632 resetRelativeOctave  =
633 #(define-music-function
634     (parser location reference-note)
635     (ly:music?)
636     (_i "Set the octave inside a \\relative section.")
637
638    (let*
639     ((notes (ly:music-property reference-note 'elements))
640      (pitch (ly:music-property (car notes) 'pitch)))
641
642     (set! (ly:music-property reference-note 'elements) '())
643     (set! (ly:music-property reference-note
644        'to-relative-callback)
645        (lambda (music last-pitch)
646         pitch))
647
648     reference-note))
649
650
651 scaleDurations =
652 #(define-music-function
653                   (parser location fraction music) (number-pair? ly:music?)
654                   (ly:music-compress music (ly:make-moment (car fraction) (cdr fraction))))
655
656
657
658 shiftDurations =
659 #(define-music-function (parser location dur dots arg) (integer? integer? ly:music?)
660    (_i "")
661    
662    (music-map
663     (lambda (x)
664       (shift-one-duration-log x dur dots)) arg))
665
666 spacingTweaks =
667 #(define-music-function (parser location parameters) (list?)
668    (_i "Set the system stretch, by reading the 'system-stretch property of
669 the `parameters' assoc list.")
670    #{
671       \overrideProperty #"Score.NonMusicalPaperColumn"
672         #'line-break-system-details
673         #$(list (cons 'alignment-extra-space (cdr (assoc 'system-stretch parameters)))
674                 (cons 'system-Y-extent (cdr (assoc 'system-Y-extent parameters))))
675    #})
676
677
678 rightHandFinger =
679 #(define-music-function (parser location finger) (number-or-string?)
680    (_i "Define a StrokeFingerEvent")
681    
682    (apply make-music
683           (append
684            (list 
685             'StrokeFingerEvent
686             'origin location)
687            (if  (string? finger)
688                 (list 'text finger)
689                 (list 'digit finger)))))
690
691 scoreTweak =
692 #(define-music-function (parser location name) (string?)
693    (_i "Include the score tweak, if exists.")
694    (if (and page-layout-parser (not (ly:get-option 'dump-tweaks)))
695        (let ((tweak-music (ly:parser-lookup page-layout-parser
696                                             (string->symbol name))))
697          (if (ly:music? tweak-music)
698              tweak-music
699              (make-music 'SequentialMusic)))
700        (make-music 'SequentialMusic)))
701
702
703 tag = #(define-music-function (parser location tag arg)
704    (symbol? ly:music?)
705
706    (_i "Add @var{tag} to the @code{tags} property of @var{arg}.")
707
708    (set!
709     (ly:music-property arg 'tags)
710     (cons tag
711           (ly:music-property arg 'tags)))
712    arg)
713
714
715
716 transposedCueDuring =
717 #(define-music-function
718   (parser location what dir pitch-note main-music)
719   (string? ly:dir? ly:music? ly:music?)
720
721   (_i "Insert notes from the part @var{what} into a voice called @code{cue},
722 using the transposition defined by @var{pitch-note}.  This happens
723 simultaneously with @var{main-music}, which is usually a rest.  The
724 argument @var{dir} determines whether the cue notes should be notated
725 as a first or second voice.")
726
727   (make-music 'QuoteMusic
728               'element main-music
729               'quoted-context-type 'Voice
730               'quoted-context-id "cue"
731               'quoted-music-name what
732               'quoted-voice-direction dir
733               'quoted-transposition (pitch-of-note pitch-note)
734               'origin location))
735
736
737
738 transposition =
739 #(define-music-function (parser location pitch-note) (ly:music?)
740    (_i "Set instrument transposition")
741
742    (context-spec-music
743     (make-property-set 'instrumentTransposition
744                        (ly:pitch-negate (pitch-of-note pitch-note)))
745         'Staff))
746
747 tweak = #(define-music-function (parser location sym val arg)
748            (symbol? scheme? ly:music?)
749
750            (_i "Add @code{sym . val} to the @code{tweaks} property of @var{arg}.")
751            
752            (set!
753             (ly:music-property arg 'tweaks)
754             (acons sym val
755                    (ly:music-property arg 'tweaks)))
756            arg)
757
758
759
760 unfoldRepeats =
761 #(define-music-function (parser location music) (ly:music?)
762                   (unfold-repeats music))
763
764
765
766 withMusicProperty =
767 #(define-music-function (parser location sym val music) (symbol? scheme? ly:music?)
768    (_i "Set @var{sym} to @var{val} in @var{music}.")
769
770    (set! (ly:music-property music sym) val)
771    music)