Hello list,
I made a quick fix for the makeOctaves function from
http://lsr.dsi.unimi.it/LSR/Item?id=445
Since 2.15.x notes may appear as single NoteEvents *not* wrapped in an
EventChord, I added a check for 'NoteEvent and did a map on EventChord
elements.
This is an ugly solution, because EventChords are octaved twice.
But it works for the moment.
If my googling was wrong and there is a better solution around, a hint
is appreciated.
Cheers, Jan-Peter
--snip--
\version "2.15.31"
#(define (octave-up m octave)
(let* ((old-pitch (ly:music-property m 'pitch))
(new-note (ly:music-deep-copy m))
(new-pitch (ly:make-pitch
(+ octave (ly:pitch-octave old-pitch))
(ly:pitch-notename old-pitch)
(ly:pitch-alteration old-pitch))))
(set! (ly:music-property new-note 'pitch) new-pitch)
new-note))
#(define (octavize-chord elements t)
(cond ((null? elements) elements)
((eq? (ly:music-property (car elements) 'name) 'NoteEvent)
(cons (car elements)
(cons (octave-up (car elements) t)
(octavize-chord (cdr elements) t))))
(else (cons (car elements) (octavize-chord (cdr elements
) t)))))
#(define (octavize music t)
(cond ((eq? (ly:music-property music 'name) 'EventChord)
(ly:music-set-property! music 'elements (octavize-chord
(map (lambda (e) (if (eq? (ly:music-property music
'name) 'EventChord)
(car (ly:music-property e
'elements)) e)) (ly:music-property music 'elements)) t)))
((eq? (ly:music-property music 'name) 'NoteEvent)
(set! music (make-music 'EventChord 'elements (list
music (octave-up music t) ))))
)
music)
#(define-public makeOctaves (define-music-function (parser location arg
mus) (integer? ly:music?)
(music-map (lambda (x) (octavize x arg)) mus)))
\makeOctaves #1 \relative c' { <c e>4 c }
--snip--
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user