lilypondmusic-notation

LilyPond: acciaccaturas and slashed stems not showing when beamed together


I have a question related to acciaccaturas and slashed stems. So the first one is: why when more than one note is input as acciaccaturas or slashed grace notes they are not automatically beamed? And why when I beam them I lose the slash?

\version "2.17.26"
{
  \relative c''{
    \time 3/4 {
      \acciaccatura e8 c4 \acciaccatura { e8 d } c4 \acciaccatura { e8[ d] } c4 |
      \slashedGrace e8 c4 \slashedGrace { e8 d } c4 \slashedGrace { e8[ d] } c4
    }
  }
}

In my opinion, the last note of each bar should be as:

enter image description here


Something similar (related to the slashed stem), but now on regular notes. When I compile the code below, I get what I want: 4 unbeamed notes, and the first has a slash on its stem.

\version "2.17.26"
{
\autoBeamOff
\relative c''{
    \once \override Flag #'stroke-style = #"grace" c8
    c c c r4 r2 |
  }
}

Now if I remove the line \autoBeamOff, the notes will be beamed but without the slash on the first!

I would be very thankful if someone could help me out with these problems.


Solution

  • As of version 2.17.26, unfortunately my questions have no simple answer.

    Regarding the automatic beam, this function has not been implemented, thus the user must set the beaming manually for all grace notes (using [ and ]). An enhancement was requested under the reference Issue 3566 on LilyPond's project website. Possible developments can be followed on this link: https://code.google.com/p/lilypond/issues/detail?id=3566


    Regarding the slashes, here is what the official LilyPond's documentation says (under 1.2.6 Special rhythmic concerns):

    A multi-note beamed acciaccatura is printed without a slash, and looks exactly the same as a multi-note beamed appoggiatura.

    Apparently, the same behavior is true to regular beamed notes generated by using the command \override Flag #'stroke-style = #"grace".

    This bug has also been reported (as Issue 1333), and any development can be followed at the following link: https://code.google.com/p/lilypond/issues/detail?id=1333

    As a solution, one can also add the following snippet in the beginning of the file, and then use the command \slash to generate the slash on grace notes or on regular notes as well:

    \version "2.17.26"
    % Slash snippet:
    slash = {
      #(remove-grace-property 'Voice 'Stem 'direction)
      \once \override Stem #'stencil =
      #(lambda (grob)
        (let* ((x-parent (ly:grob-parent grob X))
               (is-rest? (ly:grob? (ly:grob-object x-parent 'rest))))
         (if is-rest?
          empty-stencil
          (let* ((dir (ly:grob-property grob 'direction))
                 (stem (ly:stem::print grob))
                 (stem-y (ly:grob-extent grob grob Y))
                 (stem-length (- (cdr stem-y) (car stem-y))))
           (ly:stencil-add
            stem
            (grob-interpret-markup grob
             (markup #:translate (cons -1 (* dir (1- (/ stem-length 2)))) 
              #:draw-line (cons 2 (* dir 2)))) 
          )))))
    }
    
    % some music as example:
    { 
      \relative c'' {
        \grace{\slash g8[a g] } a1 |
        \slash g8 a g a r2
      }
    }
    

    The problems with this snippet are: