X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ly%2Farticulate.ly;h=1397766d51a6ef452f2ea77d2a0cec30d14d67b4;hb=512d405d07aba8742658902b105a94ebbd40c2dc;hp=3cd98f4436da19cf8d096a8fb9dfc30e7318770c;hpb=ebe492ca408fb0d9abf80b94c56197eef8dc2f09;p=lilypond.git diff --git a/ly/articulate.ly b/ly/articulate.ly index 3cd98f4436..1397766d51 100644 --- a/ly/articulate.ly +++ b/ly/articulate.ly @@ -341,8 +341,18 @@ ; (ac:accel trillMusic factor)) ))) - - +% +% Generate a tempoChangeEvent and its associated property setting. +% +#(define (ac:tempoChange tempo) + (make-sequential-music + (list (make-music 'TempoChangeEvent + 'metronome-count + tempo + 'tempo-unit + (ly:make-duration 0 0 1 1)) + (context-spec-music + (make-property-set 'tempoWholesPerMinute tempo) 'Score)))) % If there's an articulation, use it. % If in a slur, use (1 . 1) instead. @@ -394,7 +404,7 @@ ((string= articname "mordent") (loop (cons 1 1) newelements tail (cons 'mordent actions))) ((string= articname "prall") - (loop (cons 1 1) newelements tail (cons 'trill actions))) + (loop (cons 1 1) newelements tail (cons 'prall actions))) ((string= articname "trill") (loop (cons 1 1) newelements tail (cons 'trill actions))) ((string= articname "turn") @@ -413,6 +423,14 @@ (string= t "rit.") (string= t "rall.")) (loop factor (cons e newelements) tail (cons 'rall actions))) + ((or + (string= t "accelerando") + (string= t "accel") + (string= t "accel.")) + (loop factor (cons e newelements) tail (cons 'accel actions))) + ((or + (string= t "poco accel.")) + (loop factor (cons e newelements) tail (cons 'pocoAccel actions))) ((or (string= t "poco rall.") (string= t "poco rit.")) @@ -477,25 +495,37 @@ (make-music 'RestEvent 'duration (ly:make-duration len dots newnum newdenom)))))) music))) + ((accel) + (set! ac:lastTempo ac:currentTempo) + (set! ac:currentTempo (ly:moment-div ac:currentTempo ac:rallFactor)) + (let ((pset (ac:tempoChange ac:currentTempo))) + (if (null? (cdr actions)) + (make-sequential-music (list pset music)) + (make-sequential-music + (list pset (loop (cdr actions))))))) + + ((pocoAccel) + (set! ac:lastTempo ac:currentTempo) + (set! ac:currentTempo (ly:moment-div ac:currentTempo ac:pocoRallFactor)) + (let ((pset (ac:tempoChange ac:currentTempo))) + (if (null? (cdr actions)) + (make-sequential-music (list pset music)) + (make-sequential-music + (list pset (loop (cdr actions))))))) + ((rall) + (set! ac:lastTempo ac:currentTempo) (set! ac:currentTempo (ly:moment-mul ac:currentTempo ac:rallFactor)) - (let ((pset (make-music 'PropertySet - 'value - ac:currentTempo - 'symbol - 'tempoWholesPerMinute))) + (let ((pset (ac:tempoChange ac:currentTempo))) (if (null? (cdr actions)) (make-sequential-music (list pset music)) (make-sequential-music (list pset (loop (cdr actions))))))) ((pocoRall) + (set! ac:lastTempo ac:currentTempo) (set! ac:currentTempo (ly:moment-mul ac:currentTempo ac:pocoRallFactor)) - (let ((pset (make-music 'PropertySet - 'value - ac:currentTempo - 'symbol - 'tempoWholesPerMinute))) + (let ((pset (ac:tempoChange ac:currentTempo))) (if (null? (cdr actions)) (make-sequential-music (list pset music)) (make-sequential-music @@ -503,11 +533,8 @@ ((aTempo) (set! ac:currentTempo ac:lastTempo) - (let ((pset (make-music 'PropertySet - 'value - ac:currentTempo - 'symbol - 'tempoWholesPerMinute))) + + (let ((pset (ac:tempoChange ac:currentTempo))) (if (null? (cdr actions)) (make-sequential-music (list pset music)) (make-sequential-music @@ -516,27 +543,77 @@ ((trill) (ac:trill music)) + ((prall) + ; A pralltriller symbol can either mean an inverted mordent + ; 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))) + (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)))) + ((mordent) (let* - ((dur (ly:music-property + ((totaldur (ly:music-property (car (ly:music-property music 'elements)) 'duration)) - (factor (ly:duration-factor dur)) + (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)) - (mainnote (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 3 0 1 1))) + (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 (make-grace-music mordent) mainnote))))) + (make-sequential-music (list mordent mainnote))))) ((turn) (let* ((dur (ly:music-property @@ -571,12 +648,12 @@ (ac:adjust-props (ly:music-property music 'symbol) music) music) - (else music)) + (else music)) )) -% At last ... here's the music function that aplies all the above to a +% At last ... here's the music function that applies all the above to a % score. articulate = #(define-music-function (parser location music) (ly:music?)