[Top][All Lists]

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

custom multiple bar number markup function

From: Flaming Hakama by Elaine
Subject: custom multiple bar number markup function
Date: Sun, 9 Dec 2018 21:17:59 -0800

Send lilypond-user mailing list submissions to


I hope someone can point me in the right direction.

What I'd like to do is print multiple bar numbers for repeated sections.

The situation is that I have one instrument (upright bass) whose musical figure repeats, 
while other instruments have different material.

The bass player finds it difficult to turn pages, so to conserve space, 
I notate their part with repeats, whereas everyone else has everything written out.

I can get the overall bar numbers to coincide (after the repeat) by using 
    \set Score.currentBarNumber = #13

But in the repeated section, for the bass part, 
only the first number prints (as expected).

Here is my MWE of what I have now:

\version "2.19.15"

% all parts but bass
\score {
    \relative c'' {
        c1 | 1 | 1 | 1 | \break
        \bar "||"
        cs1 | 1 | 1 | 1 | \break
        ds1 | 1 | 1 | 1 | \break
        \bar "||"
        e1 | 1 | 1 | 1 | 

% bass part
\score {
    \relative c {
        \clef bass
        c1 | 1 | 1 | 1 | \break

        % I'd like this measure to show both bar numbers "5" and "9"
        % Perhaps by invoking a function like this:
        % \double-bar-numbers 4
        \repeat volta 2 { 
            \bar "[|:"
            b1 | 1 | 1 | 1 
            \bar ":|]"
        } \break
        \set Score.currentBarNumber = #13
        e1 | 1 | 1 | 1 | 

My intention of the comment above, 
    \double-bar-numbers 4
is to specify the following logic:

"at this point, instead of using the default bar number markup function, 
use this double-bar-numbers markup function, which takes an argument 
for the number of repeated bars."

And then that function would do the following:

"Read the current bar number, 
calculate a second bar number 
by adding the current bar number to the supplied value 
then print those two numbers in a column"

I'm basically unsure about every step here:

Is there such a thing as "the default measure number markup function"?

Can I specify another function to be used instead of the 
default measure number markup function, and if so, how?

Can I invoke this new measure number markup function on an as-needed basis--
not replace the default measure number markup function, since I would use that
everywhere other than the places I explicitly specify to use the new one?

Can I supply this function with a number-type argument?

Within my new measure number markup function, how can I access the current measure number?

Within my new measure number markup function, how can I add numbers?

Within my new measure number markup function How can I turn a number into markup?

Here is pseudocode, of what I thought the function might look like.  
It doesn't work because, among other things, 
* I don't know how to convert a number to a markup.  
* I don't know how to override the default measure number markup function.
* The syntax of "let" is also confusing (I have to enclose everything 
in another set of parens just to have scope where the variable is defined?) 

#(define-markup-command (double-bar-numbers layout props barCount) (number?)
    "Draw two bar numbers"
    (interpret-markup layout props
        (let repeatBarNumber (+ #currentBarNumber #barCount)
                <>^markup \center-column { 

Any hints would be greatly appreciated.


Elaine Alt
415 . 341 .4954                                           "Confusion is highly underrated"
Producer ~ Composer ~ Instrumentalist

reply via email to

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