3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4 ;; autochange - fairly related to part combining.
6 (define-public (make-autochange-music music)
7 (define (generate-split-list change-moment event-list acc)
10 (let* ((now-tun (caar event-list))
11 (evs (map car (cdar event-list)))
13 (notes (filter (lambda (x)
14 (equal? (ly:music-property x 'name) 'NoteEvent))
16 (pitch (if (pair? notes)
17 (ly:music-property (car notes) 'pitch)
20 (if (and pitch (not (= (ly:pitch-steps pitch) 0)))
21 (generate-split-list #f
28 (sign (ly:pitch-steps pitch))) acc))
31 (cdr event-list) acc)))))
34 (let* ((m (make-music 'AutoChangeMusic))
35 (context (ly:run-translator (make-non-relative-music music) part-combine-listener))
36 (evs (last-pair noticed))
37 (split (reverse! (generate-split-list
40 (reverse! (cdar evs) '()) '())
43 (set! (ly:music-property m 'element) music)
44 (set! (ly:music-property m 'split-list) split)