4 texidoc = "In chords, ties keep closer to the note head vertically,
5 but never collide with heads or stems. Seconds are formatted up/down;
6 the rest of the ties are positioned according to their vertical
9 The code does not handle all cases. Sometimes ties will printed on top
10 of or very close to each other. This happens in the last chords of
26 = #(define-music-function (parser location is-long chords) (boolean? ly:music?)
30 translate x y z to x~x y~y z~z
34 (define (chord->tied-chord chord)
36 ((ch1 (ly:music-deep-copy chord))
37 (ch2 (ly:music-deep-copy chord))
38 (dur1 (ly:make-duration
41 (dur2 (ly:make-duration
46 (ly:music-set-property! e 'duration dur1))
47 (ly:music-property ch1 'elements))
50 (ly:music-set-property! e 'duration dur2))
51 (ly:music-property ch2 'elements))
53 (set! (ly:music-property ch1 'elements)
55 (make-music 'TieEvent)
56 (ly:music-property ch1 'elements)))
60 (make-music 'SequentialMusic 'elements (apply append
61 (map chord->tied-chord (ly:music-property chords 'elements)))))
64 \applyMusic #(lambda (mus)
65 (ly:music-property mus 'element))
83 \generateTiePattern ##f \baseChords
89 \generateTiePattern ##t \baseChords
97 \transpose c d \testShort \break
100 \transpose c d \testLong \break