[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
improvement(s) on LSR 445
From: |
-Eluze |
Subject: |
improvement(s) on LSR 445 |
Date: |
Fri, 25 Mar 2011 08:45:21 -0700 (PDT) |
hi
tried to use the snippet http://lsr.dsi.unimi.it/LSR/Snippet?id=445
http://lsr.dsi.unimi.it/LSR/Snippet?id=445
and found it did not work as expected when using absolute pitch mode.
i suggest to replace the 2 marked lines (;--) by the new code in lines
marked with (;++).
please test before applying (i'm not a scheme programmer)!
#(define (octave-up m t)
;-- (let* ((octave (1- t))
;--
(let* (
;++
(new-note (ly:music-deep-copy m))
(new-pitch (ly:make-pitch
;-- octave
;--
(+ (ly:pitch-octave (ly:music-property m 'pitch)) t)
;++
(ly:pitch-notename (ly:music-property m 'pitch))
(ly:pitch-alteration (ly:music-property m '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)
(if (eq? (ly:music-property music 'name) 'EventChord)
(ly:music-set-property! music 'elements (octavize-chord
(ly:music-property music 'elements) t)))
music)
makeOctaves = #(define-music-function (parser location arg mus) (integer?
ly:music?)
(music-map (lambda (x) (octavize x arg)) mus))
another issue:
this snippet copies all attributes of a note to the new octavized note -
this does not make sense when you deal with fingerings, stroke-fingers or
string-numbers (maybe others, too).
could this be fixed?
thanks
Eluze
--
View this message in context:
http://old.nabble.com/improvement%28s%29-on-LSR-445-tp31239262p31239262.html
Sent from the Gnu - Lilypond - Dev mailing list archive at Nabble.com.
- improvement(s) on LSR 445,
-Eluze <=