>>>>> "pkx166h" == pkx166h <pkx1...@gmail.com> writes:
pkx166h> Peter this patch has been counted down - if you don't have pkx166h> push permissions, then send me a git-formatted patch and I pkx166h> can push it for you. I don't have push permissions. Attached is the patch. Note it relies on a previous patch, the `Fix Trill Timing' patch by Tristan which I've also included.
>From 8dc7131ff574bfdd041144681fe9b3f2c61219fd Mon Sep 17 00:00:00 2001 From: Tristan Jelacic <tristanjela...@gmail.com> Date: Fri, 2 Jan 2015 14:31:44 +1100 Subject: [PATCH 1/2] Fix trill timing in articulate.ly Used a fixed duration for the twiddletime instead of the broken heuristic that was used before. This improves trill sound for slow music, and doesn't interfere with fast music. --- ly/articulate.ly | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ly/articulate.ly b/ly/articulate.ly index 6992c87..e3056b4 100644 --- a/ly/articulate.ly +++ b/ly/articulate.ly @@ -347,13 +347,11 @@ (ly:music-property music 'elements))) (pre-t (if (pair? tr) (ly:music-property (car tr) 'twiddle) '())) + (hemisemidur (ly:make-duration 5 0 1/1)) (t (ac:targetTwiddleTime))) (if (ly:moment? pre-t) pre-t - (let loop ((len (ly:music-length music))) - (if (ly:moment<? t len) - (loop (ly:moment-mul len (ly:make-moment 1/2))) - len))))) + hemisemidur))) @@ -367,7 +365,7 @@ (t (ac:twiddletime music)) (uppernote '()) (note_moment (ly:moment-mul t (ly:make-moment 1/2))) - (c1 (ly:moment-div orig-len note_moment)) + (c1 (ly:moment-div orig-len t)) (c2 (inexact->exact (round (/ (ly:moment-main-numerator c1) (* 2 (ly:moment-main-denominator c1)))))) -- 2.1.4
>From 9e29201422d3d80aa416164dbe86ef875e4dd117 Mon Sep 17 00:00:00 2001 From: Peter Chubb <peter.ch...@nicta.com.au> Date: Tue, 6 Jan 2015 09:49:19 +1100 Subject: [PATCH 2/2] Articulate.ly: Fix mordent and prall timing for short notes When a prall or mordent was on a note shorter than a semiquaver, the calculation of timing for the main note after stealing the time for the ornament used to generate a negative duration. Instead of a subtracting ornament time from the main note, generate the ornament using a fixed timing, tack it on the beginning, and then compress the resulting music to be the same length as the original. --- ly/articulate.ly | 118 ++++++++++++++++++++++++++----------------------------- 1 file changed, 56 insertions(+), 62 deletions(-) diff --git a/ly/articulate.ly b/ly/articulate.ly index e3056b4..c309169 100644 --- a/ly/articulate.ly +++ b/ly/articulate.ly @@ -400,6 +400,18 @@ ; (ac:accel trillMusic factor)) ))) + +% Copy music and strip articulations, ties, etc., for generating +% mordents etc. +#(define (ac:note-copy music) + "return a copy of music that is only notes, no articulations, ties, slurs etc" + (let ((new-music (ly:music-deep-copy music))) + (set! (ly:music-property new-music 'articulations) '()) + (set! (ly:music-property new-music 'elements) + (filter (lambda (y) (eq? 'NoteEvent (ly:music-property y 'name))) + (ly:music-property new-music 'elements))) + new-music)) + % % Generate a tempoChangeEvent and its associated property setting. % @@ -685,72 +697,54 @@ ; or a half-shake -- a short, two twiddle trill. ; We implement as a half-shake. (let* - ((totallength (ly:music-length music)) - (newlen (ly:moment-sub totallength (ly:make-moment 3/32))) - (newdur (ly:make-duration - 0 0 - (ly:moment-main-numerator newlen) - (ly:moment-main-denominator newlen))) + ((origlength (ly:music-length music)) (gracedur (ly:make-duration 5 0 1/1)) - (gracenote (ly:music-deep-copy music)) - (abovenote (ly:music-deep-copy music)) - (mainnote (ly:music-deep-copy music)) - (prall (make-sequential-music (list gracenote abovenote))) - ) - (music-map (lambda (n) - (if (eq? 'NoteEvent (ly:music-property n 'name)) - (set! (ly:music-property n 'duration) gracedur)) - n) - abovenote) - (music-map (lambda (n) - (if (eq? 'NoteEvent (ly:music-property n 'name)) - (set! (ly:music-property n 'duration) gracedur)) - n) - gracenote) - (music-map (lambda (n) - (if (eq? 'NoteEvent (ly:music-property n 'name)) - (set! (ly:music-property n 'duration) newdur)) - n) - mainnote) - - (map (lambda (y) (ac:up y)) - (filter - (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name))) - (ly:music-property abovenote 'elements))) - (make-sequential-music (list abovenote gracenote abovenote mainnote)))) + (gracenote (ac:note-copy music)) + (abovenote (ac:note-copy music)) + (abovenoteTwo (ac:note-copy music)) + (mainnote (ly:music-deep-copy music))) + + (map (lambda (y) (ac:setduration y gracedur)) + (ly:music-property gracenote 'elements)) + (map (lambda (y) (ac:setduration y gracedur)) + (ly:music-property abovenote 'elements)) + (map (lambda (y) (ac:setduration y gracedur)) + (ly:music-property abovenoteTwo 'elements)) + (map (lambda (y) (ac:up y)) + (filter + (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name))) + (ly:music-property abovenote 'elements))) + (map (lambda (y) (ac:up y)) + (filter + (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name))) + (ly:music-property abovenoteTwo 'elements))) + (let* ((prallMusic (make-sequential-music + (list abovenote gracenote abovenoteTwo mainnote))) + (newlen (ly:music-length prallMusic)) + (factor (ly:moment-div origlength newlen))) + (ly:music-compress prallMusic factor)))) ((mordent) (let* - ((totaldur (ly:music-property - (car (ly:music-property music 'elements)) 'duration)) - (dur (ly:duration-length totaldur)) - (newlen (ly:moment-sub dur (ly:make-moment 2/32))) - (newdur (ly:make-duration - 0 0 - (ly:moment-main-numerator newlen) - (ly:moment-main-denominator newlen))) - (gracenote (ly:music-deep-copy music)) - (belownote (ly:music-deep-copy music)) - (mainnote (ly:music-deep-copy music)) - (mordent (make-sequential-music (list gracenote belownote))) - ) - (begin - (music-map (lambda (n) - (if (eq? 'NoteEvent (ly:music-property n 'name)) - (set! (ly:music-property n 'duration) - (ly:make-duration 5 0 1/1))) - n) - mordent) - (music-map (lambda (n) - (if (eq? 'NoteEvent (ly:music-property n 'name)) - (set! (ly:music-property n 'duration) newdur)) - n) - mainnote) - (map (lambda (y) (ac:down y)) - (filter - (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name))) - (ly:music-property belownote 'elements))) - (make-sequential-music (list mordent mainnote))))) + ((origlength (ly:music-length music)) + (gracedur (ly:make-duration 5 0 1/1)) + (gracenote (ac:note-copy music)) + (belownote (ac:note-copy music))) + (map (lambda (y) (ac:setduration y gracedur)) + (ly:music-property gracenote 'elements)) + (map (lambda (y) (ac:setduration y gracedur)) + (ly:music-property belownote 'elements)) + (map (lambda (y) (ac:down y)) + (filter + (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name))) + (ly:music-property belownote 'elements))) + (display belownote) + + (let* ((mordentMusic (make-sequential-music (list gracenote belownote music))) + (newlen (ly:music-length mordentMusic)) + (factor (ly:moment-div origlength newlen))) + (ly:music-compress mordentMusic factor)))) + ((turn) (let* ((dur (ly:music-property -- 2.1.4
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel