lilypond-user
[Top][All Lists]
Advanced

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

Re: issues with "afterGrace" since 2.20


From: David Kastrup
Subject: Re: issues with "afterGrace" since 2.20
Date: Sat, 28 May 2022 13:27:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Lukas-Fabian Moser <lfm@gmx.de> writes:

> Hi Ahanu,
>
>> In lilypond 2.20.0, I was able to use "afterGrace" like this:
>>
>>     \version "2.20.0"
>>     \language "english"
>>     \relative c' { d2 \afterGrace 4 { cs16 d } }
>>
>> However, this now presents an error: "warning: \afterGrace exceeds
>> duration of main argument". Running ly-convert does not fix it.
>>
>> If I change "\aftergrace 4" to "\aftergrace d4", it works
>> fine. However, I have multiple documents written with the
>> aforementioned syntax, and it would take a long time to fix them
>> manually. Any suggestions?
>
> Actually, the example you posted gives a different warning because you
> reduced it "too much".
>
> Here's what happens: \afterGrace accepts an optional argument
> indicating the amount of time (as a fraction of the main note) after
> which the grace should appear.
>
> In 2.20, this was defined via:
>
> #(define-music-function (fraction main grace) ((fraction?) ly:music?
>  ly:music?) ...
>
> LilyPond now sees that 4 is not a fraction?, hence assumes no
> "fraction" was given, and interprets 4 as ly:music? yielding the
> "main" note. Then, { cs16 d } becomes the "grace" part, as intended by
> you.
>
> In 2.22, the definition was changed to:
>
> #(define-music-function (fraction main grace) ((scale?) ly:music?
>  ly:music?) ...
>
> Now scale? is defined (in c++.scm) as
>
> (define-public (scale? x)
>   (or (and (rational? x) (exact? x) (not (negative? x)))
>       (fraction? x)
>       (and (ly:moment? x) (scale? (ly:moment-main x)))))
>
> meaning: A scale? can be
> - a fraction?
> - an non-negative exact rational number
> - a LilyPond moment whose main part is in turn a scale?.
>
> This is fulfilled by 4, hence in your call to \afterGrace 4  { cs16 d },
> ... 4 is taken to be the afterGrace "fraction" (and in recent
> versions, there is the warning, added by me, that this fraction is
> larger than 1)
> ... { cs16 d } is taken to be the "main" note
> ... whatever comes after is taken to be the "main" note (since in your
> minimal example, nothing comes after this, compilation fails
> completely).
>
> I'm not sure about David Kastrup's rationale for allowing a scale? as
> an afterGraceFraction, but if anybody is aware about the implications
> his changes might have for LilyPond's syntax, it's him.
> https://gitlab.com/lilypond/lilypond/-/issues/5327
> https://gitlab.com/lilypond/lilypond/-/commit/027538606b016afb643555d654cefaee94dfb424

The respective commit is

commit 027538606b016afb643555d654cefaee94dfb424
Author: David Kastrup <dak@gnu.org>
Date:   Wed May 23 19:08:31 2018 +0200

    Issue 5327/4: Let \afterGrace and \scaleDurations take a scale
    
    That's more versatile than allowing just a fraction as a pair
    as previously.

"More versatile" means that you previously could use 3/4 but could not
use #3/4 or the equivalent ##e.75 .  Those are acceptable as scale
factors for durations like 1 * ##e.75 (and naturally also 1 * 4) so it
seemed like it would make for a more natural specification of the
(optional) scale factor to allow the predicate scale? here as well.

It does have semantic conflict with the 2.20(?) feature of having
isolated durations register as notes.

Which was accepted as a music function argument only with

commit 1d9fc4b1512eb69a28677890dc26658c3552c6cd
Author: David Kastrup <dak@gnu.org>
Date:   Thu Feb 25 19:36:20 2016 +0100

    Issue 4779: Accept isolated durations as music function arguments

(later than the original feature) because I was queasy about the
implications but it appeared that it was more confusing when this did
not work.

So it's a case of an emergent ambiguity that seemed like the lesser
drawback and compatibility/coherence headache compared to not going
ahead.

For the optional argument of \afterGrace, there would be some incentive
in case of a duration to interpret it as a duration rather than as a
scale factor.  That would, however, make this different from either what
\afterGraceFraction accepts, or what its name insinuates.  Also it would
make the predicate scale? be an inadequate description of what the
argument's type is which would functionally be
non-duration-scale-or-duration? which of course has the exact same
implementation.

In short, a maze of conflicting considerations in the context of
creating versatile and uniform behavior leading to a so-so outcome.

-- 
David Kastrup



reply via email to

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