Line-breaking with non-aligned barlines

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Line-breaking with non-aligned barlines

David Sumbler
Below I have shown a compile-able 93 lines (sorry it can't be made much
shorter) from the files for a much longer piece.

In this particular passage the harpsichord plays 4 bars in strict tempo
whilst the flute plays 4 bars rubato.  (The 2 lines do not fit and are
meant to sound terrible together!)

After much effort I have managed to get a layout in the score which
mimics the original manuscript, but there is one problem I cannot
solve.  Although these 4 bars can just about be made to fit on to one
line, there actually needs to be a page break at some point.  This is
because there is a narrator who has a short speech during the pause at
the end of the extract.  This will require an inch or two of horizontal
space, and the 4 bars in question will then be too compressed.  The
page break should come at the end of one of the harpsichord's bars,
which correspond to the bars in the rest of the orchestra.  (I have
only included 1 violin line here; none of the other instruments play
during the 4 bars in question.)

Unfortunately, every time I ask for a \break Lilypond gives me the
dreaded

"warning: forced break was overridden by some other event, should you
be using bar checks?"

I have looked at the Lilypond Snippet "Printing music with different
time signatures [0.35714]" as well as another relevant snippet, and
have compiled it successfully.  The line break works as expected.  Yet
my code produces the warning and refuses to make a line break.

What have I missed?

David

%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.19.81"

\language "english"

#(set-global-staff-size 16)

gliss = \markup { \larger \italic "gliss." }

FifteenFlute = {
  <<
    { \relative {
      R1 | R1\fermataMarkup |
        \override Staff.TimeSignature.stencil = ##f
        \time 25/16
        \scaleDurations 8/4 { bf''8[(\mf a16]) r }
        \scaleDurations 7/4 { bf8[( a16]) r }
        \scaleDurations 6/4 { bf8[( a16]) r }
        bf8[( a16]) r
        \time 4/4
        \tuplet 5/4 { bf8( c df ef e } fs2
        \time 7/8
        \scaleDurations 7/8 { e4 ds cs bs) }
        \time 9/16
        R1*9/16\fermataMarkup
        \time 4/4
    } }
  >>
}

ScoreFifteenFirstViolinA = {
  <<
    { \relative {
      d'8(\p\>\glissando^\gliss g)\! r4
      \override DynamicText.X-offset = #-2
      g8(\mp\>\glissando^\gliss b)\! r4 |
      b8(\mf\>\glissando^\gliss d)\! r4
      \revert DynamicText.X-offset
      d8(\f\>\glissando^\gliss e)\! r4\fermata |
      R1*3 | R1\fermataMarkup |
    } }
  >>
}

FifteenHarpsUpper = {
  <<
    { \relative {
      R1 | R1\fermataMarkup |
      \key a \major
      a''16\mf \repeat unfold 9 { gs a } b bs cs d ds e cs a e cs e gs a |
      \repeat unfold 9 { b as } b cs ds e b gs e8 r \acciaccatura ds' e r\fermata |
    } }
  >>
}

FifteenHarpsLower = {
  <<
    \clef bass
    { \relative {
       R1 | R1\fermataMarkup |
      \key a \major
      \clef treble
      \repeat unfold 4 { a16 e' cs e a e cs e } | \repeat unfold 2 { a, fs' d fs a fs d fs } |
      gs, e' d e gs e d e gs,8 r \clef bass \acciaccatura ds e r\fermata |
     } }
  >>
}

\score {
  <<
    \new Staff \with { instrumentName = "Flute" } \FifteenFlute
    \new PianoStaff \with { instrumentName = "Harpsichord" } <<
      \new Staff \FifteenHarpsUpper
      \new Staff \FifteenHarpsLower >>
    \new Staff \with { instrumentName = "Violins I" } \ScoreFifteenFirstViolinA
  >>
  \layout {
   \context { \Score
              \remove "Timing_translator"
              \remove "Default_bar_line_engraver"
     }
   \context {
     \Staff
     \consists "Timing_translator"
     \consists "Default_bar_line_engraver"
   }
   \context {
     \Voice
     \remove "Forbid_line_break_engraver"
   }
   indent = 26\mm
 }
}
%%%%%%%%%%%%%%%%%%%%%%%%



_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

Phil Holmes
----- Original Message -----
From: "David Sumbler" <[hidden email]>
To: <[hidden email]>
Sent: Friday, October 26, 2018 4:57 PM
Subject: Line-breaking with non-aligned barlines


> Below I have shown a compile-able 93 lines (sorry it can't be made much
> shorter) from the files for a much longer piece.

In your example (snipped) I don't see a \break at all and so the piece
compiles without a problem.


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

Thomas Morley-2
In reply to this post by David Sumbler
Am Fr., 26. Okt. 2018 um 18:26 Uhr schrieb David Sumbler <[hidden email]>:

>
> Below I have shown a compile-able 93 lines (sorry it can't be made much
> shorter) from the files for a much longer piece.
>
> In this particular passage the harpsichord plays 4 bars in strict tempo
> whilst the flute plays 4 bars rubato.  (The 2 lines do not fit and are
> meant to sound terrible together!)
>
> After much effort I have managed to get a layout in the score which
> mimics the original manuscript, but there is one problem I cannot
> solve.  Although these 4 bars can just about be made to fit on to one
> line, there actually needs to be a page break at some point.  This is
> because there is a narrator who has a short speech during the pause at
> the end of the extract.  This will require an inch or two of horizontal
> space, and the 4 bars in question will then be too compressed.  The
> page break should come at the end of one of the harpsichord's bars,
> which correspond to the bars in the rest of the orchestra.  (I have
> only included 1 violin line here; none of the other instruments play
> during the 4 bars in question.)
>
> Unfortunately, every time I ask for a \break Lilypond gives me the
> dreaded
>
> "warning: forced break was overridden by some other event, should you
> be using bar checks?"
>
> I have looked at the Lilypond Snippet "Printing music with different
> time signatures [0.35714]" as well as another relevant snippet, and
> have compiled it successfully.  The line break works as expected.  Yet
> my code produces the warning and refuses to make a line break.
>
> What have I missed?
>
> David
>
> %%%%%%%%%%%%%%%%%%%%%%%%
> \version "2.19.81"
>
> \language "english"
>
> #(set-global-staff-size 16)
>
> gliss = \markup { \larger \italic "gliss." }
>
> FifteenFlute = {
>   <<
>     { \relative {
>       R1 | R1\fermataMarkup |
>         \override Staff.TimeSignature.stencil = ##f
>         \time 25/16
>         \scaleDurations 8/4 { bf''8[(\mf a16]) r }
>         \scaleDurations 7/4 { bf8[( a16]) r }
>         \scaleDurations 6/4 { bf8[( a16]) r }
>         bf8[( a16]) r
>         \time 4/4
>         \tuplet 5/4 { bf8( c df ef e } fs2
>         \time 7/8
>         \scaleDurations 7/8 { e4 ds cs bs) }
>         \time 9/16
>         R1*9/16\fermataMarkup
>         \time 4/4
>     } }
>   >>
> }
>
> ScoreFifteenFirstViolinA = {
>   <<
>     { \relative {
>       d'8(\p\>\glissando^\gliss g)\! r4
>       \override DynamicText.X-offset = #-2
>       g8(\mp\>\glissando^\gliss b)\! r4 |
>       b8(\mf\>\glissando^\gliss d)\! r4
>       \revert DynamicText.X-offset
>       d8(\f\>\glissando^\gliss e)\! r4\fermata |
>       R1*3 | R1\fermataMarkup |
>     } }
>   >>
> }
>
> FifteenHarpsUpper = {
>   <<
>     { \relative {
>       R1 | R1\fermataMarkup |
>       \key a \major
>       a''16\mf \repeat unfold 9 { gs a } b bs cs d ds e cs a e cs e gs a |
>       \repeat unfold 9 { b as } b cs ds e b gs e8 r \acciaccatura ds' e r\fermata |
>     } }
>   >>
> }
>
> FifteenHarpsLower = {
>   <<
>     \clef bass
>     { \relative {
>        R1 | R1\fermataMarkup |
>       \key a \major
>       \clef treble
>       \repeat unfold 4 { a16 e' cs e a e cs e } | \repeat unfold 2 { a, fs' d fs a fs d fs } |
>       gs, e' d e gs e d e gs,8 r \clef bass \acciaccatura ds e r\fermata |
>      } }
>   >>
> }
>
> \score {
>   <<
>     \new Staff \with { instrumentName = "Flute" } \FifteenFlute
>     \new PianoStaff \with { instrumentName = "Harpsichord" } <<
>       \new Staff \FifteenHarpsUpper
>       \new Staff \FifteenHarpsLower >>
>     \new Staff \with { instrumentName = "Violins I" } \ScoreFifteenFirstViolinA
>   >>
>   \layout {
>    \context { \Score
>               \remove "Timing_translator"
>               \remove "Default_bar_line_engraver"
>             }
>    \context {
>      \Staff
>      \consists "Timing_translator"
>      \consists "Default_bar_line_engraver"
>    }
>    \context {
>      \Voice
>      \remove "Forbid_line_break_engraver"
>    }
>    indent = 26\mm
>  }
> }
> %%%%%%%%%%%%%%%%%%%%%%%%

Hi,

you likely know lily breaks only at matching BarLines.
So you have to insert a \bar "" at appropriate place. Which is tricky
here, because there is _no_ appropriate place.

Well, then create one, i.e.
instead of the original event, insert same simultaneous music like
<< e { s \bar "" s } >>
and then figure out which duration the first skip must have.

Which is tricky as well. For that purpose I use:
ctxMom =
  \applyContext
  #(lambda (ctx)
    (format #t "\nin context~a: ~a" ctx (ly:context-current-moment ctx)))

and insert \ctxMom where I wrote \break (below I've did it in
FifteenHarpsUpper) and before the second skip of the inserted
simultaneous music in FifteenFlute.
Now I can scale the duration of the first skip until both values of
\ctxMom match.

%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.19.81"

ctxMom =
  \applyContext
  #(lambda (ctx)
    (format #t "\nin context~a: ~a" ctx (ly:context-current-moment ctx)))


\language "english"

#(set-global-staff-size 16)

gliss = \markup { \larger \italic "gliss." }

FifteenFlute = {
  <<
    { \relative {
      R1 | R1\fermataMarkup |
        \override Staff.TimeSignature.stencil = ##f
        \time 25/16
        \scaleDurations 8/4 { bf''8[(\mf a16]) r }
        \scaleDurations 7/4 { bf8[( a16]) r }
        \scaleDurations 6/4 { bf8[( a16]) r }
        bf8[( a16]) r
        \time 4/4
        \tuplet 5/4 {
          bf8( c df ef
          << e { s1*15/320 \bar "" \ctxMom s } >>
        }
        fs2
        \time 7/8
        \scaleDurations 7/8 { e4 ds cs bs) }
        \time 9/16
        R1*9/16\fermataMarkup
        \time 4/4
    } }
  >>
}

ScoreFifteenFirstViolinA = {
  <<
    { \relative {
      d'8(\p\>\glissando^\gliss g)\! r4
      \override DynamicText.X-offset = #-2
      g8(\mp\>\glissando^\gliss b)\! r4 |
      b8(\mf\>\glissando^\gliss d)\! r4
      \revert DynamicText.X-offset
      d8(\f\>\glissando^\gliss e)\! r4\fermata |
      R1*3 | R1\fermataMarkup |
    } }
  >>
}

FifteenHarpsUpper = {
  <<
    { \relative {
      R1 |
      R1\fermataMarkup |
      \key a \major
      a''16\mf \repeat unfold 9 { gs a } b bs cs d ds e cs a e cs e gs a |
      \break
      \ctxMom
      \repeat unfold 9 { b as } b cs ds e b gs e8 r \acciaccatura ds'
e r\fermata |
    } }
  >>
}

FifteenHarpsLower = {
  <<
    \clef bass
    { \relative {
       R1 | R1\fermataMarkup |
      \key a \major
      \clef treble
      \repeat unfold 4 { a16 e' cs e a e cs e } | \repeat unfold 2 {
a, fs' d fs a fs d fs } |
      gs, e' d e gs e d e gs,8 r \clef bass \acciaccatura ds e r\fermata |
     } }
  >>
}

\score {
  <<
    \new Staff \with { instrumentName = "Flute" } \FifteenFlute
    \new PianoStaff \with { instrumentName = "Harpsichord" } <<
      \new Staff \FifteenHarpsUpper
      \new Staff \FifteenHarpsLower >>
    \new Staff \with { instrumentName = "Violins I" } \ScoreFifteenFirstViolinA
  >>
  \layout {
   \context { \Score
              \remove "Timing_translator"
              \remove "Default_bar_line_engraver"
            }
   \context {
     \Staff
     \consists "Timing_translator"
     \consists "Default_bar_line_engraver"
   }
   \context {
     \Voice
     \remove "Forbid_line_break_engraver"
   }
   indent = 26\mm
 }
}
%%%%%%%%%%%%%%%%%%%%%%%%


HTH,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

Thomas Morley-2
Am Fr., 26. Okt. 2018 um 18:56 Uhr schrieb Thomas Morley
<[hidden email]>:

>           << e { s1*15/320 \bar "" \ctxMom s } >>
Well, could be shortened to s1*3/64 and the \ctxMom-command should be
deleted after the duration is found, ofcourse.

Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

David Sumbler
In reply to this post by Thomas Morley-2

-----Original Message-----
From: Thomas Morley <[hidden email]>
To: David Sumbler <[hidden email]>
CC: lilypond-user <[hidden email]>
Subject: Re: Line-breaking with non-aligned barlines
Date: Fri, 26 Oct 2018 18:56:15 +0200

> Hi,
>
> you likely know lily breaks only at matching BarLines.
> So you have to insert a \bar "" at appropriate place. Which is tricky
> here, because there is _no_ appropriate place.
>
> Well, then create one, i.e.
> instead of the original event, insert same simultaneous music like
> << e { s \bar "" s } >>
> and then figure out which duration the first skip must have.
>
> Which is tricky as well. For that purpose I use:
> ctxMom =
>   \applyContext
>   #(lambda (ctx)
>     (format #t "\nin context~a: ~a" ctx (ly:context-current-moment
> ctx)))
>
> and insert \ctxMom where I wrote \break (below I've did it in
> FifteenHarpsUpper) and before the second skip of the inserted
> simultaneous music in FifteenFlute.
> Now I can scale the duration of the first skip until both values of
> \ctxMom match.
>
> %%%%%%%%%%%%%%%%%%%%%%%%
> \version "2.19.81"
>
> ctxMom =
>   \applyContext
>   #(lambda (ctx)
>     (format #t "\nin context~a: ~a" ctx (ly:context-current-moment
> ctx)))
>
>
> \language "english"
>
> #(set-global-staff-size 16)
>
> gliss = \markup { \larger \italic "gliss." }
>
> FifteenFlute = {
>   <<
>     { \relative {
>       R1 | R1\fermataMarkup |
>         \override Staff.TimeSignature.stencil = ##f
>         \time 25/16
>         \scaleDurations 8/4 { bf''8[(\mf a16]) r }
>         \scaleDurations 7/4 { bf8[( a16]) r }
>         \scaleDurations 6/4 { bf8[( a16]) r }
>         bf8[( a16]) r
>         \time 4/4
>         \tuplet 5/4 {
>           bf8( c df ef
>           << e { s1*15/320 \bar "" \ctxMom s } >>
>         }
>         fs2
>         \time 7/8
>         \scaleDurations 7/8 { e4 ds cs bs) }
>         \time 9/16
>         R1*9/16\fermataMarkup
>         \time 4/4
>     } }
>   >>
> }
>
> ScoreFifteenFirstViolinA = {
>   <<
>     { \relative {
>       d'8(\p\>\glissando^\gliss g)\! r4
>       \override DynamicText.X-offset = #-2
>       g8(\mp\>\glissando^\gliss b)\! r4 |
>       b8(\mf\>\glissando^\gliss d)\! r4
>       \revert DynamicText.X-offset
>       d8(\f\>\glissando^\gliss e)\! r4\fermata |
>       R1*3 | R1\fermataMarkup |
>     } }
>   >>
> }
>
> FifteenHarpsUpper = {
>   <<
>     { \relative {
>       R1 |
>       R1\fermataMarkup |
>       \key a \major
>       a''16\mf \repeat unfold 9 { gs a } b bs cs d ds e cs a e cs e
> gs
> a |
>       \break
>       \ctxMom
>       \repeat unfold 9 { b as } b cs ds e b gs e8 r \acciaccatura ds'
> e r\fermata |
>     } }
>   >>
> }
>
> FifteenHarpsLower = {
>   <<
>     \clef bass
>     { \relative {
>        R1 | R1\fermataMarkup |
>       \key a \major
>       \clef treble
>       \repeat unfold 4 { a16 e' cs e a e cs e } | \repeat unfold 2 {
> a, fs' d fs a fs d fs } |
>       gs, e' d e gs e d e gs,8 r \clef bass \acciaccatura ds e
> r\fermata |
>      } }
>   >>
> }
>
> \score {
>   <<
>     \new Staff \with { instrumentName = "Flute" } \FifteenFlute
>     \new PianoStaff \with { instrumentName = "Harpsichord" } <<
>       \new Staff \FifteenHarpsUpper
>       \new Staff \FifteenHarpsLower >>
>     \new Staff \with { instrumentName = "Violins I" }
> \ScoreFifteenFirstViolinA
>   >>
>   \layout {
>    \context { \Score
>               \remove "Timing_translator"
>               \remove "Default_bar_line_engraver"
>             }
>    \context {
>      \Staff
>      \consists "Timing_translator"
>      \consists "Default_bar_line_engraver"
>    }
>    \context {
>      \Voice
>      \remove "Forbid_line_break_engraver"
>    }
>    indent = 26\mm
>  }
> }
> %%%%%%%%%%%%%%%%%%%%%%%%
>
>
> HTH,
>   Harm

Thank you very much for all of that.

Your very first sentence answers my original question: what I had
missed was the fact that there must be a barline (possibly invisible)
in every stave at the musical moment a line break is required.

The ctxMom routine is beyond my understanding, I am afraid, both as
regards the Scheme code and also how it is used.  I can see that it
must be useful if one has a lot of such passages to typeset; but
fortunately I only have this one, and I was able to calculate the
values for the spacer rests myself.  To make sure I was doing it
correctly and also because I am not quite sure yet where I want the
line break to be in the final score, I calculated the values for all
three possible breaks (end of bars 3, 4 and 5).  I then tried inserting
a \break at each of these points in turn.

A break at the end of bar 4 or bar 5 worked fine, but I could not get
Lilypond to allow a break at the end of bar 3.  I eventually concluded
that this must be because of the beam in the flute part, so I removed
it in the code and the line break then worked.  After searching the IR
I discovered that in order to make it work with a beam I needed to add
\once \override Beam.breakable = ##t

I doubt that I shall want a line break at this point, and in any case I
could subtly alter the time values so that the beam does not cross the
barline.  But as things are the break here is still unsatisfactory
because the semiquaver just after the break has 2 long beams stretching
back to the start of the line, whereas one would ideally want 1 long
beam and a short one.  I haven't managed to figure out how this can be
changed: any ideas would be welcome.

David


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

Thomas Morley-2
Am Fr., 26. Okt. 2018 um 23:52 Uhr schrieb David Sumbler <[hidden email]>:


> But as things are the break here is still unsatisfactory
> because the semiquaver just after the break has 2 long beams stretching
> back to the start of the line, whereas one would ideally want 1 long
> beam and a short one.  I haven't managed to figure out how this can be
> changed: any ideas would be welcome.

A minimal would be:

\paper { indent = 0 ragged-right = ##t }

{
    \override Beam.breakable = ##t
    s2. s8
    c'8[
    \break
    c'16]
}

Not sure I'd call it a bug. But I'd love to have a method to change
this behaviour easily, currently there's none.
Though, you can dive into Beam deeply and reset 'beam-segments with
custom values. Leading to:

\version "2.19.81"

\paper { indent = 0 ragged-right = ##t }

shortenBrokenBeams =
#(define-music-function (amount)(number-list?)
"
 Shorten broken Beams after line-break.

 We get the 'beam-segments, rebuilding it modified.
 The 'beam-segments-property is an alist of type:
    '(((vertical-count . 0) (horizontal 3.865018 . 5.93))
      ((vertical-count . 1) (horizontal 3.865018 . 5.93)))

    `vertical-count' is the beam-count.
    `horizontal' is the X-extent relative to 'System's 'line-width.

 Applying it only if the left-bound of the 'Beam is 'NonMusicalPaperColumn,
 i.e after a line-break.
 Affecting a broken Beam at line-end is possible, too, but not yet coded.
"
#{
  \override Beam.beam-segments =
    #(lambda (grob)
       (let* ((beam-segments (ly:beam::calc-beam-segments grob))
              (rebuild-beam-segments-proc
                (lambda (vertical-count horizontal shorten)
                  (cons
                    (cons 'vertical-count vertical-count)
                    (list
                      (cons 'horizontal
                        (cons (- (car horizontal) shorten)
                              (cdr horizontal))))))))

       (if (eq? (grob::name (ly:spanner-bound grob LEFT))
                'NonMusicalPaperColumn)
           (begin
              (let* ((horizontals
                       (map
                         (lambda (x) (assoc-get 'horizontal x))
                         beam-segments))
                     (vertical-counts
                       (map
                         (lambda (x) (assoc-get 'vertical-count x))
                         beam-segments))
                     (new-beam-segments
                       (map
                         rebuild-beam-segments-proc
                         vertical-counts horizontals amount)))

       ;;;; If you want to compare the default and the changed
       ;;;; settings, uncomment the following lines.
       ;        (let* ((new-horizontals
       ;                 (map
       ;                   (lambda (x) (assoc-get 'horizontal x))
       ;                   new-beam-segments)))
       ;             (display "\n\thorizontals \t")(write horizontals)
       ;             (display "\n\tnew-horizontals ")(write new-horizontals))
              new-beam-segments))
           beam-segments)))
#})


{
    \override Beam.breakable = ##t
    s2. s8
    \shortenBrokenBeams #'(-2.239194 0)
    c'8[
    \break
    c'16]
}


HTH,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

Werner LEMBERG
> A minimal would be:
>
> \paper { indent = 0 ragged-right = ##t }
>
> {
>     \override Beam.breakable = ##t
>     s2. s8
>     c'8[
>     \break
>     c'16]
> }
>
> Not sure I'd call it a bug.

IMHO, it is a bug.

> But I'd love to have a method to change this behaviour easily,
> currently there's none.

I fully agree.

> Though, you can dive into Beam deeply and reset 'beam-segments with
> custom values.  Leading to: [...]

Very nice!  If possible, this should be made the default.  I even
suggest to completely drop the current behaviour since I can't
envision a situation where you really want this.


    Werner

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

Thomas Morley-2
Am So., 28. Okt. 2018 um 08:07 Uhr schrieb Werner LEMBERG <[hidden email]>:

>
> > A minimal would be:
> >
> > \paper { indent = 0 ragged-right = ##t }
> >
> > {
> >     \override Beam.breakable = ##t
> >     s2. s8
> >     c'8[
> >     \break
> >     c'16]
> > }
> >
> > Not sure I'd call it a bug.
>
> IMHO, it is a bug.
>
> > But I'd love to have a method to change this behaviour easily,
> > currently there's none.
>
> I fully agree.
>
> > Though, you can dive into Beam deeply and reset 'beam-segments with
> > custom values.  Leading to: [...]
>
> Very nice!  If possible, this should be made the default.  I even
> suggest to completely drop the current behaviour since I can't
> envision a situation where you really want this.
>
>
>     Werner

Hi Werner,

I'll open an issue on the tracker.

As workaround a much more elaborated coding below.
It's now possible to process complex Beams, affecting them before and
after a line-break.
Not yet coded is affecting the beam-segments of the middle-beam-parts
of a more than two times broken Beam.
Though, it will not happen very often. At least I hope so.

\version "2.19.82"

\paper { indent = 0 ragged-right = ##t }

#(define (devide-at-vertical-count beam-dir dir-pred lst)
;; 'lst' is supposed to be the list of beam-segments
;; A new list is returned where all entries of same vertical-count are wrapped
;; into a sublist.
;; Relying on dir-pred those sublists appear in reversed order.
;; This is important to get have 'new-beams' working on the correct
;; beam-segment. Empty sublists would disturb, they are removed.
  (remove
    null?
    (map
      (lambda (i)
        (let ((inner-list
                (filter
                  (lambda (el) (eqv? (assoc-get 'vertical-count el) i))
                  lst)))
          (cond ((eq? dir-pred 'first-beam)
                 (reverse inner-list))
                ((eq? dir-pred 'last-beam)
                 inner-list))))
    ;; TODO Unlikely to have more than 10 beam-segments.
    ;; Better than removing empty lists afterwards would be to find the correct
    ;; beam-count, though. Too lazy right now ...
    (iota 10 0 (- beam-dir)))))



#(define (new-beams amounts dir-predicate lst)
  ;; Returns a new list suitable for 'beam-segments.
  ;; Relying on 'dir-predicate' left or right side of the beam-segments are
  ;; changed.
  (append-map
    (lambda (a el)
      (cons
        (list (caar el)
              (let* ((hor (assoc-get 'horizontal (car el))))
                (cons 'horizontal
                      (cond ((eqv? dir-predicate LEFT)
                             (cons (+ a (car hor)) (cdr hor)))
                            ((eqv? dir-predicate RIGHT)
                             (cons (car hor) (+ a (cdr hor))))
                            (else hor)))))
        (cdr el)))
    amounts
    lst))


shortenBrokenBeams =
#(define-music-function (amount)(list?)
"
 Shorten broken Beams at line-break.

 We get the 'beam-segments, rebuilding it modified.
 The 'beam-segments-property is an alist of type:
    '(((vertical-count . 0) (horizontal 3.865018 . 5.93))
      ((vertical-count . 1) (horizontal 3.865018 . 5.93)))

    `vertical-count' is the beam-count, which may grow negative.
    `horizontal' is the X-extent relative to 'System's 'line-width.
    Regrettable this means changing `horizontal' will need to be adjusted
    frequently. P.e. if Beam-direction changes.

 @var{amount} is a list containing number-lists. Their values are applied to
 the beam-segments at line-break.
 At line-end they are applied to the right. At line-start to the left.
 An empty sublist will trigger default beaming.

 Limitations:
   Does not work for the inner beam-parts of more than two times broken Beams.
"
#{
  %% Add \once ?
  \override Beam.beam-segments =
    #(lambda (grob)
       (let* ((middle-of-broken-beam?
                (and (eq? (grob::name (ly:spanner-bound grob LEFT))
                          'NonMusicalPaperColumn)
                     (eq? (grob::name (ly:spanner-bound grob RIGHT))
                          'NonMusicalPaperColumn)))
              (first-of-broken-beam?
                (and (eq? (grob::name (ly:spanner-bound grob RIGHT))
                          'NonMusicalPaperColumn)
                     (not (eq? (grob::name (ly:spanner-bound grob LEFT))
                               'NonMusicalPaperColumn))))
              (last-of-broken-beam?
                (and (eq? (grob::name (ly:spanner-bound grob LEFT))
                          'NonMusicalPaperColumn)
                     (not (eq? (grob::name (ly:spanner-bound grob RIGHT))
                               'NonMusicalPaperColumn))))
              (beam-segments (ly:beam::calc-beam-segments grob))
              (dir (ly:grob-property grob 'direction)))
       (cond
         (middle-of-broken-beam?
           (ly:message
             "Tweaking left and right ends of a beam-segments is not yet coded.
Returning default.")
           beam-segments)
         (first-of-broken-beam?
           ;; uncomment to watch 'beam-segments' of first beam-part
           ;(format #t "\nBEAM-SEGMENTS of FIRST beam-part:\n~y" beam-segments)
           (if (null? (car amount))
               beam-segments
               (new-beams
                 (car amount)
                 RIGHT
                 (devide-at-vertical-count dir 'first-beam beam-segments))))
         (last-of-broken-beam?
           ;; uncomment to watch 'beam-segments' of last beam-part
           ;(format #t "\nBEAM-SEGMENTS of LAST beam-part:\n~y" beam-segments)
           (if (null? (cadr amount))
               beam-segments
               (new-beams
                 (cadr amount)
                 LEFT
                 (devide-at-vertical-count dir 'last-beam beam-segments))))
         (else beam-segments))))
#})

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXAMPLES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\markup "Beam at start of line"
{
    \override Beam.breakable = ##t
    s8*5
    \shortenBrokenBeams
      %% empty sublist are possible
      %#'(()(0 2.239 2.239))
      %#'((0 -1.852)())
      #'((0 -1.852)(0 2.239 2.239))
    c'16[
    c'
    c'8.
    c'16
    \break
    c'32
    c'8
    c'16
    c']
}

{
    \override Beam.breakable = ##t
    s8*7
    \shortenBrokenBeams
      #'(()(0 1))
    c''8[
    \break
    c''16]
}

{
    \override Beam.breakable = ##t
    s16*15
    \shortenBrokenBeams
      #'((0 -1.2)())
    c''16[
    \break
    c''8]
}

Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

Werner LEMBERG

>> If possible, this should be made the default.  I even suggest to
>> completely drop the current behaviour since I can't envision a
>> situation where you really want this.
>
> I'll open an issue on the tracker.

Thanks.

> As workaround a much more elaborated coding below.

Excellent!  I guess this should eventually be coded in C++, right?


    Werner

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

Thomas Morley-2
Am Mo., 29. Okt. 2018 um 07:58 Uhr schrieb Werner LEMBERG <[hidden email]>:
>
>
> >> If possible, this should be made the default.  I even suggest to
> >> completely drop the current behaviour since I can't envision a
> >> situation where you really want this.
> >
> > I'll open an issue on the tracker.
>
> Thanks.

Done.
https://sourceforge.net/p/testlilyissues/issues/5432/

>
> > As workaround a much more elaborated coding below.
>
> Excellent!  I guess this should eventually be coded in C++, right?

Yep, my coding is a workaround (with limitations) modifying what is done in C++
Needless to say it would be better to do it correctly in the first place.

Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

David Sumbler
In reply to this post by Thomas Morley-2

-----Original Message-----
From: Thomas Morley <[hidden email]>
To: David Sumbler <[hidden email]>
CC: lilypond-user <[hidden email]>
Subject: Re: Line-breaking with non-aligned barlines
Date: Sun, 28 Oct 2018 02:01:04 +0200

Am Fr., 26. Okt. 2018 um 23:52 Uhr schrieb David Sumbler <
[hidden email]>:


> But as things are the break here is still unsatisfactory
> because the semiquaver just after the break has 2 long beams
> stretching
> back to the start of the line, whereas one would ideally want 1 long
> beam and a short one.  I haven't managed to figure out how this can
> be
> changed: any ideas would be welcome.

A minimal would be:

\paper { indent = 0 ragged-right = ##t }

{
    \override Beam.breakable = ##t
    s2. s8
    c'8[
    \break
    c'16]
}

I do not quite understand what to do with this.

What I now have (in the light of your previous email) amounts to:

{
        s2 s4..
        \once \override Beam.breakable = ##t
        \scaleDurations 6/4 {
                << bf8[( { s1*1/24 \bar"" \break s1*1/12 } >>
                             a16]) r }
}

This gives the unsatisfactorily long second beam on the a16 note.
Does your minimal example provide a way of correcting this, and if so,
how should my code be altered?

David


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

Thomas Morley-2
Am Mo., 29. Okt. 2018 um 12:10 Uhr schrieb David Sumbler <[hidden email]>:

>
>
> -----Original Message-----
> From: Thomas Morley <[hidden email]>
> To: David Sumbler <[hidden email]>
> CC: lilypond-user <[hidden email]>
> Subject: Re: Line-breaking with non-aligned barlines
> Date: Sun, 28 Oct 2018 02:01:04 +0200
>
> Am Fr., 26. Okt. 2018 um 23:52 Uhr schrieb David Sumbler <
> [hidden email]>:
>
>
> > But as things are the break here is still unsatisfactory
> > because the semiquaver just after the break has 2 long beams
> > stretching
> > back to the start of the line, whereas one would ideally want 1 long
> > beam and a short one.  I haven't managed to figure out how this can
> > be
> > changed: any ideas would be welcome.
>
> A minimal would be:
>
> \paper { indent = 0 ragged-right = ##t }
>
> {
>     \override Beam.breakable = ##t
>     s2. s8
>     c'8[
>     \break
>     c'16]
> }
>
> I do not quite understand what to do with this.
Well, a minimal example demonstrates a certain behaviour. In this case
the too long "second beam" which should be a beamlet.
It does it in a shorter way compared to your code below. Nothing else.

In the same mail I provided some code as a workaround to shorten the
second beam to a beamlet.
In a followup I provided a more general coding:
http://lists.gnu.org/archive/html/lilypond-user/2018-10/msg00406.html

So I don't understand what you're asking.

>
> What I now have (in the light of your previous email) amounts to:
>
> {
>         s2 s4..
>         \once \override Beam.breakable = ##t
>         \scaleDurations 6/4 {
>                 << bf8[( { s1*1/24 \bar"" \break s1*1/12 } >>
>                              a16]) r }
> }
This code will only work if you remove Forbid_line_break_engraver from
the relevant Voice, p.e.

\language "english"
\new Voice \with { \remove "Forbid_line_break_engraver" }
{
        s2 s4..
        \once \override Beam.breakable = ##t
        \scaleDurations 6/4 {
                << bf8[( { s1*1/24 \bar"" \break s1*1/12 } >>
                             a16]) r }
}
>
> This gives the unsatisfactorily long second beam on the a16 note.

Yep, as for my minimal.
Attached you'll find an image where I colored the too long beam along
with another one applying my latter function.
(Using your example)

\language "english"
\new Voice \with { \remove "Forbid_line_break_engraver" }
{
        s2 s4..
        \once \override Beam.breakable = ##t
        \shortenBrokenBeams
          #'(()(0 2.6))
        \scaleDurations 6/4 {
                << bf8[( { s1*1/24 \bar"" \break s1*1/12 } >>
                             a16]) r }
}

> Does your minimal example provide a way of correcting this, and if so,
> how should my code be altered?

Your code is ok (apart from the need to remove said engraver).
LilyPond is at fault here and provides no method to get better output.
Thus I coded one. Use it ;)

HTH,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

atest-83-long-second-beam.png (8K) Download Attachment
atest-83-beamlet.png (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Line-breaking with non-aligned barlines

David Sumbler

-----Original Message-----
From: Thomas Morley <[hidden email]>
To: David Sumbler <[hidden email]>
CC: lilypond-user <[hidden email]>
Subject: Re: Line-breaking with non-aligned barlines
Date: Mon, 29 Oct 2018 22:25:42 +0100

Am Mo., 29. Okt. 2018 um 12:10 Uhr schrieb David Sumbler <
[hidden email]>:

>
>
> -----Original Message-----
> From: Thomas Morley <[hidden email]>
> To: David Sumbler <[hidden email]>
> CC: lilypond-user <[hidden email]>
> Subject: Re: Line-breaking with non-aligned barlines
> Date: Sun, 28 Oct 2018 02:01:04 +0200
>
> Am Fr., 26. Okt. 2018 um 23:52 Uhr schrieb David Sumbler <
> [hidden email]>:
>
>
> > But as things are the break here is still unsatisfactory
> > because the semiquaver just after the break has 2 long beams
> > stretching
> > back to the start of the line, whereas one would ideally want 1
> > long
> > beam and a short one.  I haven't managed to figure out how this can
> > be
> > changed: any ideas would be welcome.
>
> A minimal would be:
>
> \paper { indent = 0 ragged-right = ##t }
>
> {
>     \override Beam.breakable = ##t
>     s2. s8
>     c'8[
>     \break
>     c'16]
> }
>
> I do not quite understand what to do with this.

Well, a minimal example demonstrates a certain behaviour. In this case
the too long "second beam" which should be a beamlet.
It does it in a shorter way compared to your code below. Nothing else.

In the same mail I provided some code as a workaround to shorten the
second beam to a beamlet.
In a followup I provided a more general coding:
http://lists.gnu.org/archive/html/lilypond-user/2018-10/msg00406.html

So I don't understand what you're asking.

<snip>

My apologies.  I misunderstood the relevance of the minimal example.
In the light of your latest email, I now see that it was a minimal
demonstration of the problem; I thought it was intended to be a minimal
solution to the problem.

Thanks for all your attention to this, and indeed for the actual
workaround.

David


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user