\version "2.19.32" % try to avoid collision of ties with staff-lines % This assumes that there only two y-values per tie, as two tied notes are normally on the same y-level % function to use for control-points property in Tie grob optie = #(lambda (grob) (let* ((cp (ly:tie::calc-control-points grob)) ; default control-points (cx (map (lambda (p) (car p)) cp)) ; x-values (cy (map (lambda (p) (cdr p)) cp)) ; y-values (dir (if (> (cadr cy)(car cy)) 1 -1)) ; calc direction (this is also a grob property ...) (ymin (apply min cy)) ; minimum y-value (ymax (apply max cy)) ; maximum y-value (ypad .2) ; pad from lines (xpad .2) ; pad from start/end ) (if (and (> (car cy) -2.5)(< (car cy) 2.5)) ; if first cp is in StaffSymbol (let* ((xmin (apply min cx)) ; minimum x-value (xmax (apply max cx)) ; maximum x-value (yo (if (> dir 0) ymin ymax)) ; outer y-values (yi (if (> dir 0) ; inner y-values (- (/ (ceiling (* ymax 2)) 2) ypad) (+ (/ (floor (* ymin 2)) 2) ypad) )) ) ; create control-points `((,xmin . ,yo) (,(+ xmin xpad) . ,yi) (,(- xmax xpad) . ,yi) (,xmax . ,yo)) ) cp ; if not in StaffSymbol return default values ) )) \layout { \context { \Score % this would just shape the tie %\override Tie.control-points = #optie % show default shape in red and modified in green \override Tie.stencil = #(lambda (grob) (let ((def (apply ly:stencil-in-color (ly:tie::print grob) red))) ; get default stencil (in red) (ly:grob-set-property! grob 'control-points (optie grob)) ; set control-points function (ly:stencil-add def (apply ly:stencil-in-color (ly:tie::print grob) green)) ; combine default stencil (red) with modified (green) )) } } \relative c'' { c1~ c c~ \break c b~ b \break a~ a \break d~ d \break d,~ d \break e4~ e f~ f g~ g a~ a b~ b c~ c d~ d e~ e f~ f g~ g \break }