3 texidoc = "In chords, ties keep closer to the note head vertically,
4 but never collide with heads or stems. Seconds are formatted up/@/down;
5 the rest of the ties are positioned according to their vertical
8 The code does not handle all cases. Sometimes ties will printed on top
9 of or very close to each other. This happens in the last chords of
24 = #(define-music-function (parser location is-long chords) (boolean? ly:music?)
28 translate x y z to x~x y~y z~z
32 (define (chord->tied-chord chord)
34 ((ch1 (ly:music-deep-copy chord))
35 (ch2 (ly:music-deep-copy chord))
36 (dur1 (ly:make-duration
39 (dur2 (ly:make-duration
44 (ly:music-set-property! e 'duration dur1))
45 (ly:music-property ch1 'elements))
48 (ly:music-set-property! e 'duration dur2))
49 (ly:music-property ch2 'elements))
51 (set! (ly:music-property ch1 'elements)
53 (make-music 'TieEvent)
54 (ly:music-property ch1 'elements)))
58 (make-music 'SequentialMusic 'elements (apply append
59 (map chord->tied-chord (ly:music-property chords 'elements)))))
62 \applyMusic #(lambda (mus)
63 (ly:music-property mus 'element))
81 \generateTiePattern ##f \baseChords
87 \generateTiePattern ##t \baseChords
95 \transpose c d \testShort \break
98 \transpose c d \testLong \break