Hello! Il 15/01/2019 11:46, Davide Bonetti ha scritto:
But I noticed that it doesn't work on the lowest pitch of a chord (drop 4 on a four note chord, drop 3 on a three note chord)
I modified (if (and (music-is-of-type? music 'event-chord) (> l n)) with (if (and (music-is-of-type? music 'event-chord) (>= l n)) and now it works even on the lowest pitch. Here the complete code: %%%%%%%%%%%%%%%%%%%%%%%%%% #(define (drop-n n) (lambda (music) (let* ((elts (ly:music-property music 'elements)) (l (length elts)) ;; The user may not have entered the notes ;; from the lowest to the uppermost; ;; let’s extract the pitches… (pitches (map (lambda (x) (ly:music-property x 'pitch)) (filter (lambda (y) (music-is-of-type? y 'note-event)) elts))) ;; … and put them in order. (sorted (sort pitches ly:pitch<?))) (if (and (music-is-of-type? music 'event-chord) (>= l n)) (begin ;; first apply the sorted pitches ;; to the actual notes. (map (lambda (e p) (ly:music-set-property! e 'pitch p)) elts sorted) ;; then transpose the specified note ;; (strangely, jazzmen tend to ;; count from the top note downward). (list-set! elts (- l n) (ly:music-transpose (list-ref elts (- l n)) (ly:make-pitch -1 0))))) music))) %%%%%%%%%%%%%%%%%%%%%%%%% cheers Davide --- Questa e-mail è stata controllata per individuare virus con Avast antivirus. https://www.avast.com/antivirus _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
