lilypond-user
[Top][All Lists]
Advanced

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

Re: Different start and end bars


From: Mats Bengtsson
Subject: Re: Different start and end bars
Date: Fri, 15 Oct 2004 10:44:50 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

I'm afraid you'll have to take a look at the implementation to
be able to handle this problem. The bar lines to be printed at
line breaks is determined by the function specified by the
break-glyph-function property of the BarLine object.
In the following example, I have started from the default definition
(from scm/output-lib.scm and scm/lily.scm) and modified the
behaviour of ":|" to print a bar line also at the beginning of the
next line.

#(define (index-cell cell dir)
  (if (equal? dir 1)
      (cdr cell)
      (car cell)))

#(define (my-break-barline glyph dir)
   (let ((result (assoc glyph
                        '((":|:" . (":|" . "|:"))
                          ("||:" . ("||" . "|:"))
                          ("|" . ("|" . ()))
                          ("||:" . ("||" . "|:"))
                          ("|s" . (() . "|"))
                          ("|:" . ("|" . "|:"))
                          ("|." . ("|." . ()))
                           (".|" . ("|" . ".|"))
                          (":|" . (":|" . "|"))
                          ("||" . ("||" . ()))
                          (".|." . (".|." . ()))
                          ("" . ("" . ""))
                          (":" . (":" . ""))
                          ("empty" . (() . ()))
                          ("brace" . (() . "brace"))
                          ("bracket" . (() . "bracket"))
                          )
                        )))
     (if (equal? result #f)
         (ly:warn (string-append "Unknown bar glyph: `" glyph "'"))
         (index-cell (cdr result) dir))
     ) )

startBar = \notes { \once \override Staff.BarLine #'before-line-breaking-callback = ##f \bar "|" }
\score {

\new Staff \with { \remove "Clef_engraver" } {
\override Score.BarLine #'break-glyph-function = #my-break-barline
\override Score.TimeSignature #'break-visibility = #end-of-line-invisible

\notes {

\startBar
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar ":|" \break
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar ":|" \break
}}}


  /Mats

Ted Frazier wrote:
Lilypond is wonderful and fun but until I understand the object model can be frustrating...!!! I am transcribing exercises and want behavior that is not standard. Liliypond, with it's smarts, will start a new line of music with no bar or the same bar that ended the previous line. I want to end every line of music with a :| bar and start every line with a | bar. Take the following code: startBar = \notes { \once \override Staff.BarLine #'before-line-breaking-callback = ##f \bar "|" }
\score {

\new Staff \with { \remove "Clef_engraver" } {

\override Score.TimeSignature #'break-visibility = #end-of-line-invisible

\notes {

\startBar
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar ":|" \break

\startBar
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar "|"
\time 4/4 f' a' c'' e'' \bar ":|" \break
}}}

The first line of music ends with | and not :| as one might think. But if I comment out the second \startBar command, the first line ends with :| and the second line has no start bar. I have tried many ways of getting around this and finally found one where I change the glyph in the overridden BarLine print function by changing the glyph at hard coded indices. There's got to be a better way. Any ideas? Thanks... Ted Frazier

------------------------------------------------------------------------

_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user

--
=============================================
        Mats Bengtsson
        Signal Processing
        Signals, Sensors and Systems
        Royal Institute of Technology
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463                         
        Fax:   (+46) 8 790 7260
        Email: address@hidden
        WWW: http://www.s3.kth.se/~mabe
=============================================




reply via email to

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