lilypond-user
[Top][All Lists]
Advanced

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

[midi] [articulate] \stopTrillSpan, \staccatissimo, and \appoggiatura


From: Iain Nicol
Subject: [midi] [articulate] \stopTrillSpan, \staccatissimo, and \appoggiatura
Date: Thu, 01 Oct 2009 00:33:47 +0100

Hi,

I've playing about with Peter Chubb's `Articulate' for improved MIDI
output.  (Thanks, Peter: I wrote a less ambitious file a bit back---and
then accidentally deleted it.)

Anyway, I've got a few suggested changes, with patches.  The patches are
against the copy of articulate linked to from
<http://www.nicta.com.au/people/chubbp/articulate>; the patches should
apply with `patch < file.diff' in the same directory as articulate.ly.

1. Trills.  I'm not sure about this(!), but my interpretation of the
fragment
    c\startTrillSpan d e\stopTrillSpan
is that it's similar to
    c\trill d\trill e  
In contrast, articulate thinks it's similar to
    c\trill d\trill e\trill

One reason why I think this is that TrillSpanner supports the to-barline
property. Look at the output of:
    {
      \override TrillSpanner #'to-barline = ##t
      c1\startTrillSpan | e | g\stopTrillSpan g |
    }
Still, I'm not certain, because where the wiggly lines are meant to end
does sometimes seem a bit ambiguous.  In case I am right, though,
there's a patch which changes articulate's behaviour. 

2. Staccatissimo.  I've got a simple patch to add \staccatissimo.
Nothing fancy: it's implemented just like the \staccato, only it takes a
quarter of the note's value by default, not a half.

3. Appoggiatura.  Unfortunately, articulate's \appoggiatura doesn't
quite work.  For example,
    \include "articulate.ly"
    \articulate {\appoggiatura d8 c4}
doesn't give quaver to both the d and the c.  Instead, it halves the
written length of each of the two notes; it's like you'd written 
    d16 c8.

To test this, look at or listen to the output of the following file.  We
want the crotchets of both voices to sound together, but they don't.
    \include "articulate.ly"
    \score {
      <<
        \articulate \relative c' {\appoggiatura d8 c4 c c c}
        \relative e' {e4 e e e }
      >>
      \midi{}
      \layout{}
    }
The attached patch fixes this.

(Finally, I noticed there's been a heated discussion on -devel recently
about licensing.  I know my patches are really small,
possibly---probably?---not big enough to be copyrightable.  I also know
that articulate.ly is licensed as GPL v2 only...  However, for the sake
of being unambiguous: I consider my patches to be GPL v2 or later.)

Cheers,
-- 
Iain Nicol
<http://www.iainnicol.com./>
--- articulate.ly       2008-08-06 04:03:12.000000000 +0100
+++ articulate.trill.ly 2009-09-30 17:30:11.000000000 +0100
@@ -434,7 +434,9 @@
       ((TrillSpanEvent)
        (let ((direction (ly:music-property e 'span-direction)))
        (set! ac:inTrill (eq? direction -1))
-       (loop factor newelements tail (cons 'trill actions))))
+        (if ac:inTrill
+         (loop factor newelements tail (cons 'trill actions))
+         (loop factor (cons e newelements) tail actions))))
 
       ((PhrasingSlurEvent)
        (let ((direction (ly:music-property e 'span-direction)))
--- articulate.ly       2008-08-06 04:03:12.000000000 +0100
+++ articulate.staccatissimo.ly 2009-09-30 19:08:35.000000000 +0100
@@ -15,7 +15,7 @@
 %  http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 %
 % This script tries to make MIDI output from LilyPond a little more realistic.
-% It tries to take articulations (slurs, staccato) into account, by 
+% It tries to take articulations (slurs, staccato, etc.) into account, by 
 % replacing notes  with sequential music of suitably time-scaled note plus 
 % skip.
 %
@@ -61,7 +61,7 @@
 % * Cope with more ornaments/articulations.
 %    mordents, inverted-turns, etc.
 %   -- accent needs better control of dynamics.
-%   -- Articulations: mezzo-staccato, staccatissimo, portato.
+%   -- Articulations: mezzo-staccato, portato.
 %   -- Handling of generic ornaments (in lily, `\stopped'; in 
 %              most early music:  ornament this note (trill, turn 
 %              or mordent as the player wishes))
@@ -83,6 +83,9 @@
 % Most modern sources say 1/2 the notated length of a note.
 #(define ac:staccatoFactor '(1 . 2)) 
 
+% How much to compress notes marked staccatissimo.
+#(define ac:staccatissimoFactor '(1 . 4))
+
 % And tenuto (if we ever implement time stealing, this should be >1.0)
 #(define ac:tenutoFactor '(1 . 1))
 
@@ -393,6 +396,8 @@
        (cond
         ((string= articname "staccato")
          (loop ac:staccatoFactor newelements tail actions))
+         ((string= articname "staccatissimo")
+          (loop ac:staccatissimoFactor newelements tail actions))
         ((string= articname "tenuto")
          (loop ac:tenutoFactor newelements tail actions))
         ((string= articname "mordent")
--- articulate.ly       2008-08-06 04:03:12.000000000 +0100
+++ articulate.appoggiatura.ly  2009-09-30 19:00:37.000000000 +0100
@@ -600,10 +600,14 @@
   (ly:music? ly:music?)
   (let* ((maindur (ly:music-length main))
         (grace-orig-len (ly:music-length grace))
+         (main-orig-len (ly:music-length main))
         (numerator (ly:moment-main-numerator maindur))
         (factor (if (eq? (remainder numerator 3) 0)
                  (ly:make-moment 1 3) (ly:make-moment 1 2))))
-   (ly:music-compress grace factor)
+
+   (ly:music-compress grace
+    (ly:moment-mul factor
+     (ly:moment-div main-orig-len grace-orig-len)))
    (ly:music-compress main (ly:moment-sub (ly:make-moment 1 1) factor))
    
     (set! (ly:music-property grace 'elements)

reply via email to

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