Re: defineBarLine confusion

2023-01-14 Thread David Zelinsky
Jean Abou Samra  writes:

> Le 14/01/2023 à 07:14, David Zelinsky a écrit :
>> I have submitted a bug report, and I'm working on submitting a patch.
>
>
> Did you see that Harm has already submitted a patch for this?
>
> https://gitlab.com/lilypond/lilypond/-/merge_requests/1813
>
> Best,
> Jean

Yes, I just saw it.  You guys are quick!

Many thanks.

-David



Re: defineBarLine confusion

2023-01-14 Thread Jean Abou Samra

Le 14/01/2023 à 07:14, David Zelinsky a écrit :

I have submitted a bug report, and I'm working on submitting a patch.



Did you see that Harm has already submitted a patch for this?

https://gitlab.com/lilypond/lilypond/-/merge_requests/1813

Best,
Jean



OpenPGP_signature
Description: OpenPGP digital signature


Re: defineBarLine confusion

2023-01-14 Thread David Zelinsky
Flaming Hakama by Elaine  writes:

> 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.

Thanks.  The documentation would definitely benefit from a description
as detailed as you gave.  It took me a while but I did eventually figure
out how this all is supposed to work.


> 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.

On the contrary, the documentation clearly states that these are valid
values for the end, beginning, and span arguments.


> 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.

That's exactly the point.  Since there is only one staff, the last
argument should have no effect.  And yet it does.  And the effect is to
truncate the mid-bar specification and only use its first character.  In
fact, I have identified where in the code this is happening, and it is
clearly a bug.  I have submitted a bug report, and I'm working on
submitting a patch.


-David



Re: defineBarLine confusion

2023-01-13 Thread Aaron Hill

On 2023-01-13 6:43 pm, Flaming Hakama by Elaine wrote:
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.


#t and #f are valid in bar line definitions, as convenient short hand.  
See [1]:


The \defineBarLine arguments specifying replacement glyphs can be set 
to #t to copy the mid-line glyph or #f to create no bar line. The empty 
string, "", yields a zero-width bar line.


[1]: 
https://lilypond.org/doc/v2.24/Documentation/notation/bars#index-defining-bar-line



-- Aaron Hill



Re: defineBarLine confusion

2023-01-13 Thread Flaming Hakama by Elaine
> From: David Zelinsky 
> To: lilypond-user@gnu.org
> Cc:
> Bcc:
> Date: Fri, 13 Jan 2023 17:37:15 -0500
> Subject: Re: defineBarLine confusion
> David Zelinsky  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 li

Re: defineBarLine confusion

2023-01-13 Thread Jean Abou Samra

Le 13/01/2023 à 23:37, David Zelinsky a écrit :

How should I best go about conveying this to the developers?


See https://lilypond.org/bug-reports.html

Thanks,
Jean




OpenPGP_signature
Description: OpenPGP digital signature


Re: defineBarLine confusion

2023-01-13 Thread David Zelinsky
David Zelinsky  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



defineBarLine confusion

2023-01-11 Thread David Zelinsky
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


Re: \defineBarLine confusion

2022-04-18 Thread Mark Probert
Hans wrote:
> 
> Assuming that you want all reapeats with ears see 
> https://lilypond.org/doc/v2.22/Documentation/snippets/repeats
> 
Missed that totally! 

Many thanks 
 ..m.



Re: \defineBarLine confusion

2022-04-18 Thread Hans Aikema


> On 18 Apr 2022, at 06:56, Mark Probert  wrote:
> 
> 
> Hi.
> 
> I am confused as to why the following doesn't work as expected. I am 
> thinking the closing repeat, within the alternative 1, should have 
> "ears" yet it doesn't. Have I not understood the \defineBarLine 
> correctly? Or is there something else here?
> 
> (I do note if I put a \break at the end of alternative 1 then the 
> bar-with-ears appears, but I don't want that all the time.)
> 
> Any help appreciated.
> 
> .. mark.
> 
> ---
> 
> \version "2.22"
> 
> \defineBarLine ".|:" #'("" "[|:" "")
> \defineBarLine ":|." #'(":|]" "" "")
> 
> melody = \relative c'' {
>  \clef treble
>  \bar ".|:"
>  \repeat volta 2 {
>a4 b c d~ |
>  }
>  \alternative {
>{ d2 r2 | }
>{ d2.\repeatTie r4 \bar "|." }
>  }
> }
> 
> \score {
>  \new Staff  \melody
> }
> 

Assuming that you want all reapeats with ears see 
https://lilypond.org/doc/v2.22/Documentation/snippets/repeats

The proper way would be overriding the default barlines for repeats in the 
Score context (and you typically would want to include the double repeat just 
in case you have to volta repeats back-to-back):

\layout {
  \context {
\Score
%% Changing the defaults from engraver-init.ly
startRepeatType = #"[|:"
endRepeatType = #":|]"
doubleRepeatType = #":|][|:"
  }
}





\defineBarLine confusion

2022-04-17 Thread Mark Probert


Hi.

I am confused as to why the following doesn't work as expected. I am 
thinking the closing repeat, within the alternative 1, should have 
"ears" yet it doesn't. Have I not understood the \defineBarLine 
correctly? Or is there something else here?

(I do note if I put a \break at the end of alternative 1 then the 
bar-with-ears appears, but I don't want that all the time.)

Any help appreciated.

 .. mark.

---

\version "2.22"

\defineBarLine ".|:" #'("" "[|:" "")
\defineBarLine ":|." #'(":|]" "" "")

melody = \relative c'' {
  \clef treble
  \bar ".|:"
  \repeat volta 2 {
a4 b c d~ |
  }
  \alternative {
{ d2 r2 | }
{ d2.\repeatTie r4 \bar "|." }
  }
}

\score {
  \new Staff  \melody
}