lilypond-user
[Top][All Lists]
Advanced

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

Re: updating "display multi measure rest span"


From: Thomas Morley
Subject: Re: updating "display multi measure rest span"
Date: Mon, 29 Mar 2021 10:31:00 +0200

Am Mo., 29. März 2021 um 09:31 Uhr schrieb Calvin Ransom
<calvinjransom@gmail.com>:
>
> I found this code for creating ranges of multimeasure rests.
> I ran convert.ly and it did not work correctly.
> Here is the code after running it through convert.ly:
> \version "2.22.0"
> \layout {
>   \override Score.BarNumber.break-visibility = ##(#t #t #t)
> }
>
> fancyMultiMeasureRestNumber = {
>   \applyOutput Voice.MultiMeasureRestNumber
>   #(lambda (g c p)
>      (let* ((currentBarNumber (ly:context-property c 'currentBarNumber))
>             (mmr-length
>              (ly:moment-main
>               (ly:prob-property (ly:grob-property g 'cause) 'length))))
>        (ly:grob-set-property! g 'text
>          #{
>            \markup
>            \center-column {
>              #(number->string mmr-length)
>              %% value found by try and error
>              \translate #'(0 . -7.5)
>              \with-dimensions #empty-interval #empty-interval
>              \halign #CENTER
>              \line
>              #(list (number->string currentBarNumber)
>                 " - "
>                 (number->string (1- (+ currentBarNumber mmr-length))))
>            }
>          #})))
>   \compressEmptyMeasures
> }
>
> {
>   c'1
>   \fancyMultiMeasureRestNumber R1*14
>   c'1
> }
>
> %{
> convert-ly (GNU LilyPond) 2.22.0  convert-ly: Processing `'...
> Applying conversion: 2.19.46, 2.19.49, 2.20.0, 2.21.0, 2.21.2, 2.22.0
> %}
> %%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> When I try to engrave it I get the following error:
>
> Processing 
> `C:/Users/calvi/AppData/Local/Temp/frescobaldi-1mq0e1iz/tmp1w3mgm6e/document.ly'
>
> Parsing...
>
> Interpreting 
> music...C:/Users/calvi/AppData/Local/Temp/frescobaldi-1mq0e1iz/tmp1w3mgm6e/document.ly:12:15:
>  In expression (ly:Prob-property (ly:grob-property g #) (quote length)):
>
> C:/Users/calvi/AppData/Local/Temp/frescobaldi-1mq0e1iz/tmp1w3mgm6e/document.ly:12:15:
>  Unbound variable: ly:Prob-property
>
> Exited with return code 1.
>
>
> I don't really know where to start in fixing this
>
>
> Regards,
>
>
> Calvin Ransom

No idea why Frescobaldi complains about ly:Prob-property, i.e. with
upcase "P", afaict, it's not in the code...

Anyway, there were some internal changes in the relationship of
MultiMeasureRest and MultiMeasureRestNumber.
convert-ly can't be expected to cope with them.

Here a fixed version:

\version "2.22.0"

\layout {
  \override Score.BarNumber.break-visibility = ##(#t #t #t)
}

fancyMultiMeasureRestNumber = {
  \applyOutput Voice.MultiMeasureRestNumber
  #(lambda (g c p)
     (let* ((currentBarNumber (ly:context-property c 'currentBarNumber))
            (mmr (ly:grob-parent g X))
            (mmr-length
             (ly:moment-main
              (ly:prob-property (ly:grob-property mmr 'cause) 'length))))
       (ly:grob-set-property! g 'text
         #{
           \markup
           \center-column {
             #(number->string mmr-length)
             %% value found by try and error
             \translate #'(0 . -7.5)
             \with-dimensions #empty-interval #empty-interval
             \halign #CENTER
             \line
             #(list (number->string currentBarNumber)
                " - "
                (number->string (1- (+ currentBarNumber mmr-length))))
           }
         #})))
  \compressEmptyMeasures
}

{
  c'1
  \fancyMultiMeasureRestNumber R1*14
  c'1
}

Cheers,
  Harm



reply via email to

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