lilypond-user
[Top][All Lists]
Advanced

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

Re: Bar numbers in unmetered music.


From: Michael Lauer
Subject: Re: Bar numbers in unmetered music.
Date: Fri, 27 Apr 2007 15:11:28 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

AB <and_xyz <at> hotmail.com> writes:

> 
> Hi list,
> 
> for unmetered music, I'm using \cadenzaOn \cadenzaOff but \set
> score.currentBarNumber seems not working.
> I'm pretty sure I'm missin' something but what?
>

You need to reset measurePosition to get the bar number to print.  You can do
that directly, but here's a fancier solution that also increments the bar number
automatically (the increment function is a little complicated to deal with
simultaneous resets on different staves; maybe there's a simpler way):

\version "2.10.0"
\include "english.ly"

\header {
        title="test"
        tagline=" "
        }

verseOne=\lyricmode
        {\tiny
        This is a test
        
        }
    
incBarNo = #(define-music-function (parser location) ()
            (define (inc-bar-no m) 
                (let* ((currentNo (ly:context-property m 'currentBarNumber))
                       (currentPos (ly:context-property m 'measurePosition)))
                      (if (!= 0 (ly:moment-main-numerator currentPos))
                          (ly:context-set-property! m 'currentBarNumber (+
currentNo 1)))
                      (ly:context-set-property! m 'measurePosition
(ly:make-moment 0 1))))
            (context-spec-music #{ \applyContext $inc-bar-no #} 'Timing))

doBar = { \incBarNo \bar "|" }

melody= {\set melismaBusyProperties = #' ()
        \override Staff.TimeSignature #'break-visibility = #all-invisible
        \time 5/4
        \clef violin
        \key d \major
        \transpose c c' {
        

        \cadenzaOn
        
        e4 e e e a      \doBar
        cs2 e   a4      \doBar \break

        \set Score.currentBarNumber = #5

        d4 d d          \doBar 
        cs4 d cs e d    \bar"|."

        \cadenzaOff
        } }

\score  {
        <<
        \new Voice = "one" {\melody}
        \new Lyrics \lyricsto "one" \verseOne
        \new Voice {\melody}
        >>
    
    \layout 
    {
        \context
        {
            \Score
            barNumberVisibility = #(lambda (x) #t)      
            \override BarNumber  #'break-visibility = #end-of-line-invisible
        }
    }
} 






reply via email to

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