lilypond-user
[Top][All Lists]
Advanced

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

Re: defineBarLine confusion


From: Flaming Hakama by Elaine
Subject: Re: defineBarLine confusion
Date: Fri, 13 Jan 2023 18:43:20 -0800

 
From: David Zelinsky <dzpost@dedekind.net>
To: lilypond-user@gnu.org
Cc: 
Bcc: 
Date: Fri, 13 Jan 2023 17:37:15 -0500
Subject: Re: defineBarLine confusion
David Zelinsky <dzpost@dedekind.net> writes:

> I'm trying to understand how to use defineBarLine, based on the
> documentation in Notation Reference 1.2.5, and bar-line.scm.  The
> meaning of the "bartype" argument seems to not be exactly explained
> anywhere, but from what is said (mostly in bar-line.scm), and a lot of
> experimentation, I deduce that all the characters before a possible "-"
> are taken to be names of existing barline glyph elements, and the new
> barline glyph is the concatenation of those.
>
> Moreover, from the documentation, the second argument is a list of 3
> things that define the behavior at a line break or for spanning multiple
> staves.  So I expected these to have no effect when the barline is
> occuring in the middle of a single staff.
>
> However, I'm seeing some different behavior:
>
> \version "2.24.0"
> \relative c'' {
>   \defineBarLine ":;|!-a" #'(#t #t #t)
>   \defineBarLine ":;|!-b" #'(#t #t #f)
>   \defineBarLine ":;|!-c" #'(#t #t "||")
>   a1 \bar ":;|!-a"
>   b1 \bar ":;|!-b"
>   c1 \bar ":;|!-c"
>   d1
> }
>
>
>
>
> Since this is a single staff, I expected all these to appear the same.
> But version "b" only uses the first character of the bartype argument.
> I don't see this documented anywhere, and can't imagine a use-case.
>
> Is it a bug?
>
>
> -David



After delving into the code in bar-line.scm, I see why this is
happening, and I'm convinced it *is* a bug, and I can describe what I
think is a reasonable fix.  How should I best go about conveying this to
the developers?

-David

Here is something I wrote up for a blog post during the 2.18 days.

I am not sure if it applies to your case, but it sounds like you probably are not yet familiar with how barlines are defined.  Which is not surprising, since they are not well documented.  Which is why I created these notes in the first place, to help myself understand how they work.

Lilypond has a conception of barlines that you may not have encountered before: barlines may be printed differently if they are mid-line, versus when they are at the end/beginning of a line.

This makes sense when you consider repeats as compared to non-repeat barlines.   Let's assume we have two sections with a barline in between:  either a double bar, or a start-repeat.

* If the second section starts in the middle of the line, there is just one barline:
** For the non-repeat case, this is a double-bar line
** For the repeat case, this is the start-repeat barline.
* If the second section starts on a new line, there may be one or two barlines:
** For the non-repeat case, you print the double bar at the end of the line, and do not print any barline at the start of the next line.
** For the repeat case, you print the double bar at the end of the line, and then print a start-repeat barline printed at the beginning of the next line.

You may note that the default starting repeat barline does not print at the beginning of the line.  In order to get a repeat barline to appear at the beginning of a piece, you need to define a new barline type.


There is a setting for what barlines appear between staves.



Now, to look at the key point of the Lilypond documentation on barlines.
http://lilypond.org/doc/v2.18/Documentation/notation/bars#bar-lines

    New bar line types can be defined with \defineBarLine:
    \defineBarLine bartype #'(end begin span)


Let's talk about the "bartype" argument.  

* "bartype" really acts more like "mid-name".  Because the "mid" is what defines the contents of the barline when it occurs mid-line, in the same way that "end", "begin" and "span" define the barline at the end of a line, beginning of a line, and between staves.
* "-name" is an optional name you can choose to identify this custom bartype.  This is probably useful to distinguish two barline types that have the same "mid" definition.

These strings "mid", "end", "begin" and "span" are composed of the possible barline elements:
* Normal bar line "|"
* Thick bar line "."
* Dashed bar line "!"
* Dotted bar line ";"
* Repeat dots ":"
* "kievan" bar line "k"
* In-staff segno "S"
* Double bar line for use with in-staff segno "="
* Start repeat bar line with flags "["
* End repeat bar line with flags "]"
* No bar line ""
* Tick "'"
* Standalone thin double barline \bar "//"

They can be in any order, with the exception that the only valid context for "=" is after "S".

Here are some examples of (somewhat nonsensical) bartype names:

* :.|kS='; ][!-allTheBartypeCharacters
* ...|||'''-patternOfNineBarlines
* .[-barebrace
* S|S|[:=-doubleSegnoBeginRepeat

Here is one that matches the default repeat barline, but prints at the beginning of a piece:

    \version "2.19.15"
    \defineBarLine ".|:-printAtBeginning" #'("" ".|:" ".|:")
    {
        \bar ".|:-printAtBeginning"
        \repeat volta 2 {
            c4 d e f | g a b c  
        }
    }


Looking at your example, I think the first place you are going off is that you do not define the barlines using ##t, ##f, you instead put the characters that correspond to what you want to appear in those places.

The second issue is that you seem to be modifying the last argument, which is the barlines to appear between staves.  But your example has only one staff, so your MWE is not exercising that feature.

Here is an MWE that demonstrates something similar to what yours attempts


\version "2.22.2"

\new StaffGroup<<
    \new Staff \relative c'' {
        \defineBarLine ":;|!-everywhere" #'(":;|" ":;|" ":;|")
        \defineBarLine ":;|!-notBetweenStaves" #'(":;|" ":;|" "")
        \defineBarLine ":;|!-doubleBarBetweenStaves" #'(":;|" ":;|" "||")

        <>^"prints at beginning, middle, end of line, and between staves"
        \bar ":;|!-everywhere" a1
        \bar ":;|!-everywhere" a1  
        \bar ":;|!-everywhere" a1 \break
        \bar ":;|!-everywhere" a1 1 1 \break

        <>^"prints at beginning, middle, end of line, but not between staves"
        \bar ":;|!-notBetweenStaves" b1
        \bar ":;|!-notBetweenStaves" b1  
        \bar ":;|!-notBetweenStaves" b1 \break
        \bar ":;|!-notBetweenStaves" b1 1 1 \break

        <>^"prints at beginning, middle, end of line, and prints double bar between staves"
        \bar ":;|!-doubleBarBetweenStaves" c1
        \bar ":;|!-doubleBarBetweenStaves" c1  
        \bar ":;|!-doubleBarBetweenStaves" c1 \break
        \bar ":;|!-doubleBarBetweenStaves" c1 1 1 \break
    }
    \new Staff \relative c'' {
        a1 1 1
        a1 1 1
        b1 1 1
        b1 1 1
        c1 1 1
        c1 1 1
    }
>>

However, the thing that is really a bug in this last example is that if you use different barlines between staves than within staves, the barlines between the staves do not line up horizontally with the barlines in staves. 

HTH, 

Elaine Alt
415 . 341 .4954                                           "Confusion is highly underrated"
elaine@flaminghakama.com
Producer ~ Composer ~ Instrumentalist ~ Educator
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

reply via email to

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