[Top][All Lists]

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

Re: music starting with afterGrace breaks layout

From: Thomas Morley
Subject: Re: music starting with afterGrace breaks layout
Date: Thu, 23 Feb 2017 00:18:11 +0100

2017-02-22 23:08 GMT+01:00 David Kastrup <address@hidden>:

> Easy enough: wrap a (descend-to-context ... 'Bottom) around its
> definition.  However, this breaks \displayLilyMusic in bewildering ways.

Doing so, i.e.:

afterGrace =
#(define-music-function (fraction main grace) ((fraction?) ly:music? ly:music?)
   (_i "Create @var{grace} note(s) after a @var{main} music expression.

The musical position of the grace expression is after a
given fraction of the main note's duration has passed.  If
@var{fraction} is not specified as first argument, it is taken from
@code{afterGraceFraction} which has a default value of @code{3/4}.")
   (let ((main-length (ly:music-length main))
         (fraction (or fraction (ly:parser-lookup 'afterGraceFraction))))

         (make-music 'SkipMusic
                     'duration (ly:make-duration
                                0 0
                                (* (ly:moment-main main-length)
                                   (/ (car fraction) (cdr fraction)))))
         (make-music 'GraceMusic
                     'element grace)))))

\displayLilyMusic \relative { \time 2/4 \afterGrace g'2 { f8[ g] } f2 }


{ \time 2/4
  \context Bottom \afterGrace g'2 { f'8[ g'8] } f'2 }

Is this not correct?


reply via email to

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