lilypond-user
[Top][All Lists]
Advanced

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

Re: Bar Numbers With Letters


From: Kieren MacMillan
Subject: Re: Bar Numbers With Letters
Date: Tue, 24 Dec 2024 09:14:50 -0500

Hi Steph,

Here’s a start on doing it directly:

%%%  SNIPPET BEGINS
\version "2.23.82"

music = \relative c' {
  \set Score.currentBarNumber = #46
  \override Score.BarNumber.break-visibility = ##(#t #t #t)
  c4 d e f
  c4 d e f |
  \set Score.currentBarNumber = #48
  c4 d e f |
  \temporary \override Score.BarNumber.stencil =
   #(lambda (grob)
     (let ((text (ly:grob-property grob 'text)))
      (grob-interpret-markup grob
       #{ \markup \concat { #text "A" } #})))
  \set Score.currentBarNumber = #48
  c4 d e f
  \set Score.currentBarNumber = #48
  c4 d e f
  \set Score.currentBarNumber = #48
  c4 d e f
  \revert Score.BarNumber.stencil
  c4 d e f
  c1 \bar "|."
}

{ \music }
%%%  SNIPPET ENDS

Obviously you’ll want to figure out how to get the letters to increment while 
the numbers aren’t incrementing, and wrap it all in a music function so you can 
simply write

%%%  SNIPPET BEGINS
\version "2.23.82"

alternativeBarNumbers = …

music = \relative c' {
  […]
  c4 d e f
  \alternativeBarNumbers
  c4 d e f
  c4 d e f
  c4 d e f
  \undo \alternativeBarNumbers
  c4 d e f
  c1 \bar "|."
}

{ \music }
%%%  SNIPPET ENDS

or similar.

Hope that helps!
Kieren.

> On Dec 24, 2024, at 7:50 AM, Kieren MacMillan <kieren@kierenmacmillan.info> 
> wrote:
> 
> Hi Steph,
> 
>> I'm looking for how to set some bar numbers in my score to have letters. 
>> For example: 
>> 46, 47, 48, 48A, 48B, 48C, 49, etc...
>> I've been looking at the documentation and I see how to achieve this for 
>> \repeat'ed bars, but this is just sequential music and so the example in the 
>> documentation doesn't really apply here.
> 
> Well, you could always abuse repeats…  ;)
> 
> %%%  SNIPPET BEGINS
> \version "2.23.82"
> 
> music = \relative c' {
>  \override Score.BarNumber.break-visibility = ##(#t #t #t)
>  \set Score.alternativeNumberingStyle = #'numbers-with-letters
>  \set Score.currentBarNumber = #46
>  c4 d e f |
>  c4 d e f
>  %%  temporarily suppress VoltaBracket
>  \temporary \omit Score.VoltaBracket
>  \repeat volta 4 {
>    %%  override the default repeat-begin barline
>    \bar "|"
>    %%  here’s the un-lettered measure
>    c4 d e f |
>    %%  rewind bar number!
>    \set Score.currentBarNumber = #48
>    %%  abuse alternatives to generate lettered measures
>    \alternative {
>      \volta 1 { c4 d e f \bar "|" }
>      \volta 2 { d4 e f g \bar "|" }
>      \volta 3 { e4 f g a \bar "|" }
>  }}
>  %%  reset so subsequent repeats display as expected
>  \undo \omit Score.VoltaBracket
>  c1 \bar "|."
> }
> 
> { \music }
> %%%  SNIPPET ENDS
> 
> I’m sure there’s a way by just overriding regular measure numbers — I just 
> wanted to see if I could do it this way! LOL
> 
> Hope that helps,
> Kieren.
______________________________________________

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




reply via email to

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