\version "2.18.2" affect-LaissezVibrerTies = #(define-music-function (parser location x-start amount) ((list? (circular-list #f)) number?) #{ \once \override LaissezVibrerTieColumn #'before-line-breaking = #(lambda (grob) (let* ((ties (ly:grob-array->list (ly:grob-object grob 'ties))) (c-ps (map (lambda (tie) (ly:grob-property tie 'control-points)) ties)) (directions (map (lambda (tie) (ly:grob-property tie 'direction)) ties)) (first-cps (map (lambda (c-p) (first c-p)) c-ps)) (second-cps (map (lambda (c-p) (second c-p)) c-ps)) (third-cps (map (lambda (c-p) (third c-p)) c-ps)) (fourth-cps (map (lambda (c-p) (fourth c-p)) c-ps)) (new-first-cps (for-each (lambda (first-cp x) (if (number? x) (set-car! first-cp (+ (car first-cp) x)))) first-cps x-start)) ;; TODO: ;; Several hardcoded values following here. ;; Find better dependencies!! (new-second-cps (for-each (lambda (second-cp x dir) (let ((val (if (number? x) x 0.4))) (set-car! second-cp (+ (car second-cp) (* val 1.2))) (set-cdr! second-cp (+ (cdr second-cp) (min (* dir (/ amount 10)) 0.3))))) second-cps x-start directions)) (new-third-cps (for-each (lambda (third-cp x dir) (let ((val (if (number? x) 0.2 0.4))) (set-car! third-cp (+ (car third-cp) (- amount val))) (set-cdr! third-cp (+ (cdr third-cp) (min (* dir (/ amount 10)) 0.3))))) third-cps x-start directions)) (new-fourth-cps (for-each (lambda (fourth-cp) (set-car! fourth-cp (+ (car fourth-cp) amount))) fourth-cps))) (for-each (lambda (tie first-cp second-cp third-cp fourth-cp) (ly:grob-set-property! tie 'control-points (list first-cp second-cp third-cp fourth-cp))) ties first-cps second-cps third-cps fourth-cps))) #}) \relative c'{ \key c \minor r2 r4 d ~ \repeat volta 2 { d8 ees16 f g4 ~ g8 f16 ees f4 ~ } \alternative { { f8 ees16 d ees4 ~ ees8 f16 ees \affect-LaissezVibrerTies #4 d4\laissezVibrer } { f8\repeatTie e16 d e f e f g4 ~ g16 bes aes g } } g8 f16 e f g f g aes4 ~ aes16 c bes aes }