Re: issues with "afterGrace" since 2.20
Thanks, everyone, for the detailed explanations and the proposed solution! -Ahanu On Sat, May 28, 2022 at 7:28 AM David Kastrup wrote: > Lukas-Fabian Moser 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 > 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 > 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 >
Re: issues with "afterGrace" since 2.20
Hi, The reason is that for some weeks now, I've been having issues with mail delays on the LilyPond mailing lists: I routinely receive e-mails 1-2 days late, and most of the time, I see replies to messages that haven't arrived yet. While I'm sure no information gets lost in the long run, this nevertheless has taken the fun out of following the lists a bit for me. It's not just you. I am also regularly receiving emails with a delay of 3 or 4 hours, although not as much as 2 days. See also https://lists.gnu.org/archive/html/lilypond-user/2022-05/msg00397.html https://lists.gnu.org/archive/html/lilypond-user/2022-05/msg00183.html https://lists.gnu.org/archive/html/lilypond-user/2022-02/msg00031.html Does anyone know whom we could write to at GNU? This is getting annoying. Well, in my case, the delay seems to have been occurring between gnu.org and gmx.net: 5 8 hour lists.gnu.org 209.51.188.17 mx-ha.gmx.net 212.227.17 I had delays in the range up to 18 hours in the mail headers I looked into. Since I changed my subscription from my gmx adress to my gmail address, everything seems to be fine. So it seems to depend on which e-mail provider the mailing list contents are being sent to. But I know next to nothing about e-mail routing. Lukas
Re: issues with "afterGrace" since 2.20
Lukas-Fabian Moser writes: >>> 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. >> Correction: a duration (as opposed to a music-length) is _not_ permitted >> by scale? but a non-negative exact rational number is (which 4 qualifies >> as). >> >> duration-or-scale? would be possible in theory but would create too much >> ambiguity for things like 2 . > > But is it really desirable to make it easy to use afterGrace factors > >= 1? (We warn about them, but only if the factor is > 1. To be > honest, I'm wary about the factor = 1 case...) It's not really a matter of "easy to use" rather than to create syntactic distinctions based on a value rather than a lexical identity. For example, it would seem crazy to interpret 16 as a duration and 15 as a number. Because anywhere where 15 is acceptable as a number it would seem like a mistake to interpret 16 differently. So LilyPond will _syntactically_ treat 15 and 16 the same but then complain about 15 as non-suitable for a duration. Because it's more likely than not that this is a typo. There are very few exceptions from that concept. One that I can think of is that (ly:make-moment 1 1) and (ly:make-moment 1 -1) are treated entirely differently due to compatibility considerations. > Obviously it's impossible to allow both i) the OP's syntax (use a > naked duration as main note) _and_ ii) durations as afterGrace > offsets. > > At the moment we have neither. But one of them should be possible: > > For i), limit afterGraceFractions to proper fractions (< 1) > For ii), distinguish factors from durations (offsets) by being < 1 or > integers >= 1. (In the latter case, warn if the length of the duration > exceeds the length of the main note.) There would be some weak argument for a different form of ii: interpret numbers as durations where they have the proper form. However, at the current point of time LilyPond interprets numbers preferably as numbers because it seems undesirable to think of durations in contexts like var = 4 or \tweak xxx.value 4 ... and you can always revert to var = ##{ 4 #} when you really really want a duration in those contexts. In short: this seems like a can of worms that is hard to open without the tab tearing off. -- David Kastrup
Re: issues with "afterGrace" since 2.20
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. Correction: a duration (as opposed to a music-length) is _not_ permitted by scale? but a non-negative exact rational number is (which 4 qualifies as). duration-or-scale? would be possible in theory but would create too much ambiguity for things like 2 . But is it really desirable to make it easy to use afterGrace factors >= 1? (We warn about them, but only if the factor is > 1. To be honest, I'm wary about the factor = 1 case...) Obviously it's impossible to allow both i) the OP's syntax (use a naked duration as main note) _and_ ii) durations as afterGrace offsets. At the moment we have neither. But one of them should be possible: For i), limit afterGraceFractions to proper fractions (< 1) For ii), distinguish factors from durations (offsets) by being < 1 or integers >= 1. (In the latter case, warn if the length of the duration exceeds the length of the main note.) Lukas
Re: issues with "afterGrace" since 2.20
David Kastrup writes: > Lukas-Fabian Moser writes: > >> 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 > > 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. Correction: a duration (as opposed to a music-length) is _not_ permitted by scale? but a non-negative exact rational number is (which 4 qualifies as). duration-or-scale? would be possible in theory but would create too much ambiguity for things like 2 . As in: > In short, a maze of conflicting considerations in the context of > creating versatile and uniform behavior leading to a so-so outcome. -- David Kastrup
Re: issues with "afterGrace" since 2.20
Lukas-Fabian Moser 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 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 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
Re: issues with "afterGrace" since 2.20
Le 28/05/2022 à 13:12, Lukas-Fabian Moser a écrit : Hi Jean, If you don't want to fix your files manually, you could add a redefinition of \afterGrace that doesn't have this optional argument, like this: \version "2.22.2" afterGrace = \afterGrace \afterGraceFraction \etc \language "english" \relative c' { d2 \afterGrace 4 { cs16 d } } Sorry for duplicating your reply (although it's kind of funny we gave exactly the same half-ideal remedy). I was amused too :-) The reason is that for some weeks now, I've been having issues with mail delays on the LilyPond mailing lists: I routinely receive e-mails 1-2 days late, and most of the time, I see replies to messages that haven't arrived yet. While I'm sure no information gets lost in the long run, this nevertheless has taken the fun out of following the lists a bit for me. It's not just you. I am also regularly receiving emails with a delay of 3 or 4 hours, although not as much as 2 days. See also https://lists.gnu.org/archive/html/lilypond-user/2022-05/msg00397.html https://lists.gnu.org/archive/html/lilypond-user/2022-05/msg00183.html https://lists.gnu.org/archive/html/lilypond-user/2022-02/msg00031.html Does anyone know whom we could write to at GNU? This is getting annoying. Jean
Re: issues with "afterGrace" since 2.20
Hi Jean, If you don't want to fix your files manually, you could add a redefinition of \afterGrace that doesn't have this optional argument, like this: \version "2.22.2" afterGrace = \afterGrace \afterGraceFraction \etc \language "english" \relative c' { d2 \afterGrace 4 { cs16 d } } Sorry for duplicating your reply (although it's kind of funny we gave exactly the same half-ideal remedy). The reason is that for some weeks now, I've been having issues with mail delays on the LilyPond mailing lists: I routinely receive e-mails 1-2 days late, and most of the time, I see replies to messages that haven't arrived yet. While I'm sure no information gets lost in the long run, this nevertheless has taken the fun out of following the lists a bit for me. I changed my subscription now to using a different e-mail address, maybe this will improve things: It just might, as I received the "welcome" message immediately on the address I've switched to, while the unsubscribe confirmation hasn't arrived yet on the old address. Lukas
Re: issues with "afterGrace" since 2.20
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 If you never use the optional fraction argument to afterGrace, a quick and easy fix would be to state afterGrace = \afterGrace \afterGraceFraction \etc in the top-level part of your file: This re-defines afterGrace by always adding an explicit (default) afterGraceFraction. But this is really dirty since it makes it impossible to change afterGraceFraction afterwards OR to use the explicit afterGrace factors. A slightly more verbose and robust version would be to manually restore the fraction? predicate in the definition of afterGrace while retaining new functionality: #(define factoryAfterGrace afterGrace) afterGrace = #(define-music-function (fraction main grace) ((fraction?) ly:music? ly:music?) (pretty-print fraction) #{ \factoryAfterGrace #(or fraction (ly:parser-lookup 'afterGraceFraction)) #main #grace #}) Lukas
Re: issues with "afterGrace" since 2.20
Le 28/05/2022 à 03:19, Ahanu Banerjee a écrit : Hello, 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. What version did you upgrade to? For me, this throws a different error in 2.22 and 2.23.9: /tmp/frescobaldi-y8ru8zd4/tmppz87jisz/document.ly:4:44: error: syntax error, unexpected '}', expecting \header \relative c' { d2 \afterGrace 4 { cs16 d } } /tmp/frescobaldi-y8ru8zd4/tmppz87jisz/document.ly:4:1: error: errors found, ignoring music expression \relative c' { d2 \afterGrace 4 { cs16 d } } fatal error: failed files: "/tmp/frescobaldi-y8ru8zd4/tmppz87jisz/document.ly" 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? My understanding is that this broke with this change in the LilyPond sources: commit 027538606b016afb643555d654cefaee94dfb424 Author: David Kastrup 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. The problem is that the naked '4' is now being taken as an optional argument to \afterGrace, which is a customized value for afterGraceFraction. If you don't want to fix your files manually, you could add a redefinition of \afterGrace that doesn't have this optional argument, like this: \version "2.22.2" afterGrace = \afterGrace \afterGraceFraction \etc \language "english" \relative c' { d2 \afterGrace 4 { cs16 d } } Best, Jean
issues with "afterGrace" since 2.20
Hello, 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? Thanks, -Ahanu