Hi,
ich will ziemlich viele Noten in Akkorden einklammern und ein wenig kleiner machen.
\parenthesize \tweak font-size #-2 bläht den Code ziemlich auf, daher habe ich nach eine Kombinationsmöglichkeit gesucht und bin auf folgendes gekommen:
twpa=
#(define-music-function (music)
(ly:music?)
(let* ((prop 'font-size)
(value -2)
(p (check-grob-path prop (*location*)
#:start 1
#:default #t
#:min 2)))
(cond ((not p))
;; p now contains at least two elements. The first
;; element is #t when no grob has been explicitly
;; specified, otherwise it is a grob name.
(else
(set! (ly:music-property music 'tweaks)
(acons (cond ((pair? (cddr p)) p)
((symbol? (car p))
(cons (car p) (cadr p)))
(else (cadr p)))
value
(ly:music-property music 'tweaks)))))
(if (memq 'event-chord (ly:music-property music 'types))
;; music is an EventChord -> set the parenthesize property
;; on all child notes and rests
(for-each
(lambda (ev)
(if (or (memq 'note-event (ly:music-property ev 'types))
(memq 'rest-event (ly:music-property ev 'types)))
(set! (ly:music-property ev 'parenthesize) #t)))
(ly:music-property arg 'elements))
;; No chord, simply set property for this expression:
(set! (ly:music-property music 'parenthesize) #t))
music))
Einfach beide Funktionen aneinander gehängt und noch music angehängt. Außerdem habe ich die Fontsize fest eingestellt, da ich natürlich überall im Score die selbe Verkleinerung haben möchte. Das geht sicher eleganter und einfacher, aber wie?