Hi everyone,

I’m trying to update a library function of mine that automatically adds \newSpacingSection and overrides SpacingSpanner for every new time signature in its music argument.

Why is it throwing an error now when it didn’t before? I tried calling ly:music-property on a \time command in the scheme-sandbox and it worked fine.

(General recommendations on coding welcome)

Best, Simon

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.25.28"

#(define (convrter m)
   (cond ((eq? (ly:music-property m 'name) 'TimeSignatureMusic)
          (let ((denom (ly:music-property m 'denominator)))
            #{
              $m
              \newSpacingSection
              \override Score.SpacingSpanner.common-shortest-duration = #(ly:make-moment (/ denom 2))
            #}))
         (else m)))


convrt =
#(define-music-function (mus) (ly:music?)
   (music-map convrter mus))

\context Bottom <<
  \convrt {
    \time 3/1
  }
  { 1 1 1 }
>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Starting lilypond 2.25.28 [mensural-timing-converter-debug.ly]...
Processing `/home/simon/typesetting/library/mensural-timing-converter-debug.ly'
Parsing...
/home/simon/typesetting/library/mensural-timing-converter-debug.ly:10:74: error: Guile signaled an error for the expression beginning here
              \override Score.SpacingSpanner.common-shortest-duration = #
(ly:make-moment (/ denom 2))
No applicable method for #<<generic> / (3)> in call (/ () 2)
/home/simon/typesetting/library/mensural-timing-converter-debug.ly:20:3: error: error in #{ ... #}

  \convrt {
Interpreting music...
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Converting to `mensural-timing-converter-debug.pdf'...
fatal error: failed files: "/home/simon/typesetting/library/mensural-timing-converter-debug.ly"
Exited with return code 1.

Reply via email to