lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] Fix mordents and pralltriller in articulate.ly


From: Peter Chubb
Subject: [patch] Fix mordents and pralltriller in articulate.ly
Date: Wed, 14 Mar 2012 12:42:01 +1100
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Mordents should be on-beat, not grace notes.  And pralltrillers
(half-shakes) are always either 4 alternating notes, or an inverted
mordent.

There is of course a general problem here in that the way ornaments
are realised has changed through the centuries.  Even Bach and
Clementi disagree! I'm following CPE Bach's `True art of Keyboard
Playing' in the interpretation here.  To do the job properly we'd have
two articulations: \prall and \inverted_mordent and treat them
separately for MIDI, but typeset the same glyph.

Reported-by: Christopher Maden <address@hidden>
Signed-off-by: Peter Chubb <address@hidden>

diff --git a/ly/articulate.ly b/ly/articulate.ly
index 3cd98f4..d2d3b18 100644
--- a/ly/articulate.ly
+++ b/ly/articulate.ly
@@ -394,7 +394,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")
@@ -516,27 +516,78 @@
        ((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 
+                  (ly:moment-main-numerator newlen) 
+                  (ly:moment-main-denominator newlen)
+                1
+                1))
          (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

--
Dr Peter Chubb                                  peter.chubb AT nicta.com.au
http://www.ssrg.nicta.com.au          Software Systems Research Group/NICTA



reply via email to

[Prev in Thread] Current Thread [Next in Thread]