Am Di., 31. Dez. 2024 um 20:02 Uhr schrieb H. S. Teoh via LilyPond
user discussion <lilypond-user@gnu.org>:
>
> On Tue, Dec 31, 2024 at 01:55:28PM -0500, Saul Tobin wrote:
> >    Did you run convert-ly from HEAD?
>
> I just tried it, the only difference in the output is the \version
> number.
>
>
> >    On Tue, Dec 31, 2024, 1:53 PM H. S. Teoh via LilyPond user discussion
> >    <[1]lilypond-user@gnu.org> wrote:
> [...]
> >    > The last good version AFAIK is commit f1ad21caa. The following
> >    > commit, 6c1081a82, appears to be the change that broke this,
> >    > though I've no idea why it should, and what my score has to do
> >    > with it (nowhere in my score do I reference ly:duration-length
> >    > directly).
>
> Actually, I take that back.  I'm using a helper Scheme function I got
> from somewhere, that does reference ly:duration-length:
>
> #(define (add-durations dur1 dur2)
>          (let* ((len1 (ly:duration-length dur1))
>                 (len2 (ly:duration-length dur2))
>                 (mult (ly:moment-div (ly:moment-add len1 len2) len1)))
>                (ly:make-duration (ly:duration-log dur1)
>                                  (ly:duration-dot-count dur1)
>                                  (* (ly:duration-scale dur1) (ly:moment-main 
> mult)))))
>
> How do I update this function to work with the new version of lilypond?
> I tried to change duration-length to duration->number but it still gave
> me this error:
>
>         Parsing...ice-9/eval.scm:159:9: Throw to key `numerical-overflow' 
> with args `("divide" "Numerical overflow" #f #f)'.
>
>
> --T
>

The original code by Shevek:
https://lists.gnu.org/archive/html/lilypond-user/2013-04/msg00615.html

Did you try to run convert-ly from HEAD over the file containing
`add-durations`?
For me it works and I get:

#(define (add-durations dur1 dur2)
  (let* ((len1 (ly:duration->moment dur1))
         (len2 (ly:duration->moment dur2))
         (mult (ly:moment-div (ly:moment-add len1 len2) len1)))
    (ly:make-duration (ly:duration-log dur1)
                      (ly:duration-dot-count dur1)
                      (* (ly:duration-scale dur1) (ly:moment-main mult)))))

HTH,
  Harm

Reply via email to