Re: line-breaking issue

2020-08-09 Thread Andrew Bernard
Hello Ahanu,

Thanks for sending the file. I had a good look at it. What we confront
all the time when engraving is that music often simply does not fit
the page. I can't find any way to make this piece fit on two pages at
that staff size. The fact is, it's simply too long. Personally I find
it readable if you leave out system-count = 20, but I understand that
may not be your preference. If you set systems-per-page = 10 (and
remove system-count) it looks good and spacious on three pages. You
may have to compromise with that. You could reduce the staff-staff
spacing, but I think you don't want that. Apart from these ideas, I am
at a loss for a solution.

I encountered a similar problem just recently with a 300  page string
quartet I am engraving where some dense pages simply ran off (its
complicated to explain). In the end the composer suggested going
smaller, and it all looks fine and readable. In my case also, there
was no other way than reducing the staff size globally.

Andrew



Re: line-breaking issue

2020-08-09 Thread Hwaen Ch'uqi
Greetings Ahanu,

Without seeing something concrete, I think any further advice is
purely speculative at best. Not sure that _I_ will be able to shed
further light on the matter or that someone else will be willing to
wade through what is not an MWE, but it may be worth a shot to attach
your working code for review.

Hwaen Ch'uqi


On 8/9/20, Ahanu Banerjee  wrote:
> I tried playing around with base-shortest-duration earlier, and it didn't
> help. Pasted Kevin's text to make sure, and nothing changed.
>
> -Ahanu
>
>
> On Sun, Aug 9, 2020 at 3:48 AM Kevin Barry  wrote:
>
>> Hi Ahanu,
>>
>> It might help if you add this:
>> \layout {
>>   \context {
>> \Score
>> \override SpacingSpanner.base-shortest-duration = #(ly:make-moment
>> 1/32)
>>   }
>> }
>> It might make LilyPond more willing to squash sixteenths closer together
>> than it would normally like.
>>
>> Kevin
>>
>> On Sun, 2020-08-09 at 02:48 -0400, Ahanu Banerjee wrote:
>> > I tried setting systems-per-page to 10. It gave the same error as
>> > setting system-count to 20, and ran off the page.
>>
>> 3 measures per line is less than ideal, but it's readable. I'm
>> typesetting an etude book and am trying to avoid having fold-out pages
>> as much as possible.
>>
>>
>> On Sun, Aug 9, 2020, 02:41 Hwaen Ch'uqi  wrote:
>> Greetings Ahanu,
>>
>> What happens if you set the systems-per-page variable to 10 instead
>> of
>> using system-count = 20? Does the music then spill over onto a third
>> page? Just from experience, it seems that 48 sixteenth-notes per
>> line
>> would get rather cramped, no? I usually use 32-40 16ths per line as
>> my
>> guide.
>>
>> Hwaen Ch'uqi
>>
>>
>> On 8/9/20, Ahanu Banerjee  wrote:
>> > Hello,
>> >
>> > An étude I'm typesetting needs to fit on 2 pages with reasonable
>> vertical
>> > space. Normally, I'd just set system-count in \paper (in this
>> case, 20
>> > systems in 2 US letter pages), but this time it says "warning:
>> cannot find
>> > line breaking that satisfies constraints" and just runs off the
>> page. If I
>> > don't set system-count, it gives me 25 cramped systems on 2 pages.
>> >
>> > The piece is almost entirely sixteenth notes in 4/4. Some systems
>> fill with
>> > 3 bars, others with 2, and I can't figure out why. Ideally, most
>> would have
>> > 3 bars, but manual line breaks won't fix it. I've checked for
>> rhythmic
>> > errors (every measure has a barcheck) and didn't find any. I don't
>> want to
>> > decrease the font size.
>> >
>> > Unfortunately, I can't come up with a tiny example to demonstrate
>> this
>> > behaviour. If anyone has suggestions or someone would be willing
>> to look
>> > over my file, I'd really appreciate it.
>> >
>> > Cheers,
>> > -Ahanu
>> >
>>
>>
>



RE: Attempting to tie chords across a measure bar fails for me (six beats in 4/4)

2020-08-09 Thread Mark Stephen Mrotek
Ken,

Can you provide a small, working example of your code?

Mark

-Original Message-
From: lilypond-user [mailto:lilypond-user-bounces+carsonmark=ca.rr@gnu.org] 
On Behalf Of Kenneth Wolcott
Sent: Sunday, August 9, 2020 2:55 PM
To: lilypond-user@gnu.org
Subject: Attempting to tie chords across a measure bar fails for me (six beats 
in 4/4)

Hi;

  I'm still learning how to use Lilypond.

I'm using version 2.20.0

  I have an example of some piano music which I am trying to engrave with 
Lilypond that has chords in the left hand which are tied, but the tie fails.  I 
have a 4/4 time signature. The pattern is a whole note tied to half note, both 
are the same triad. Do I have to separate the triad into different voices to 
get the chord to become a tie?

Thanks,
Ken Wolcott




Attempting to tie chords across a measure bar fails for me (six beats in 4/4)

2020-08-09 Thread Kenneth Wolcott
Hi;

  I'm still learning how to use Lilypond.

I'm using version 2.20.0

  I have an example of some piano music which I am trying to engrave
with Lilypond that has chords in the left hand which are tied, but the
tie fails.  I have a 4/4 time signature. The pattern is a whole note
tied to half note, both are the same triad. Do I have to separate the
triad into different voices to get the chord to become a tie?

Thanks,
Ken Wolcott



Re: line-breaking issue

2020-08-09 Thread Ahanu Banerjee
I tried playing around with base-shortest-duration earlier, and it didn't
help. Pasted Kevin's text to make sure, and nothing changed.

-Ahanu


On Sun, Aug 9, 2020 at 3:48 AM Kevin Barry  wrote:

> Hi Ahanu,
>
> It might help if you add this:
> \layout {
>   \context {
> \Score
> \override SpacingSpanner.base-shortest-duration = #(ly:make-moment
> 1/32)
>   }
> }
> It might make LilyPond more willing to squash sixteenths closer together
> than it would normally like.
>
> Kevin
>
> On Sun, 2020-08-09 at 02:48 -0400, Ahanu Banerjee wrote:
> > I tried setting systems-per-page to 10. It gave the same error as
> > setting system-count to 20, and ran off the page.
>
> 3 measures per line is less than ideal, but it's readable. I'm
> typesetting an etude book and am trying to avoid having fold-out pages
> as much as possible.
>
>
> On Sun, Aug 9, 2020, 02:41 Hwaen Ch'uqi  wrote:
> Greetings Ahanu,
>
> What happens if you set the systems-per-page variable to 10 instead
> of
> using system-count = 20? Does the music then spill over onto a third
> page? Just from experience, it seems that 48 sixteenth-notes per
> line
> would get rather cramped, no? I usually use 32-40 16ths per line as
> my
> guide.
>
> Hwaen Ch'uqi
>
>
> On 8/9/20, Ahanu Banerjee  wrote:
> > Hello,
> >
> > An étude I'm typesetting needs to fit on 2 pages with reasonable
> vertical
> > space. Normally, I'd just set system-count in \paper (in this
> case, 20
> > systems in 2 US letter pages), but this time it says "warning:
> cannot find
> > line breaking that satisfies constraints" and just runs off the
> page. If I
> > don't set system-count, it gives me 25 cramped systems on 2 pages.
> >
> > The piece is almost entirely sixteenth notes in 4/4. Some systems
> fill with
> > 3 bars, others with 2, and I can't figure out why. Ideally, most
> would have
> > 3 bars, but manual line breaks won't fix it. I've checked for
> rhythmic
> > errors (every measure has a barcheck) and didn't find any. I don't
> want to
> > decrease the font size.
> >
> > Unfortunately, I can't come up with a tiny example to demonstrate
> this
> > behaviour. If anyone has suggestions or someone would be willing
> to look
> > over my file, I'd really appreciate it.
> >
> > Cheers,
> > -Ahanu
> >
>
>


Re: Quick question re pmp.ily

2020-08-09 Thread Rutger Hofman

I think I once tried something along these lines:

\quoteDuring instA { ... time 1 ... }
\PMPChords #'( "instA" "instB" ) { ... time 2 ... }
\partCombine
\quoteDuring instA { ... time 3 ... }
\quoteDuring instB { ... time 3 ... }
\PMPApart #'( "instA" "instB" ) { ... time 4 ... }

and I think it worked; to my surprise. to be true.

I have no idea if \partCombineApart etc work through quoteDuring.

My own workflow is to start out trying partCombine for one staff with 
two voices, then when partCombine first fails I try "easy" fixes like 
adding \partCombineApart etc. If these fail, I convert to PMP 
completely. It depends on the complexity of the polyphony I guess.


Rutger

On 8/8/20 6:34 PM, David Sumbler wrote:

Hi Rutger

Thanks again for sharing your brilliant work on staff management.

I downloaded pmp.ily, and I have got it working for my orchestral
score.  Clearly it is more versatile and controllable than
\partCombine.  But it is, of course, somewhat more complicated to use,
by its very nature and also because of certain limitations in Lilypond
that you mention in your tutorial.

One quick question: if one wishes to use PMP for some passages and
\partCombine for those where it works acceptably, is it necessary to
define two different staves (with different VerticalAxisGroup.remove-
layer values), or can it all be done on one defined stave?

I think the answer is that I need to define an extra stave, but perhaps
you will tell me differently.

Thanks for your help.

David





Re: Scheme: change duration of NoteEvent

2020-08-09 Thread David Kastrup
Lukas-Fabian Moser  writes:

> Hi Pavel,
>
> Am 09.08.20 um 12:30 schrieb Павел:
>> I want to write simple function that will be change duration of
>> note. But I stuck on the first step: I can't "extract" (or "see")
>> the duration property:
>>
>> \version "2.20.0"
>> mynote = c'
>> \displayMusic \mynote
>> #(display-scheme-music
>>     (ly:music-property mynote 'duration))
>
> Try setting mynote = c'8 from the start.
>
> LilyPond interprets your mynote as a naked pitch (and you obvioulsy
> can't extract a duration from a pitch). This can be seen by doing 
> #(display-scheme-music mynote) which yields (ly:make-pitch 0 0), or
>  simply by #(display mynote) which yields #.
>
> It seems using \displayMusic hides this fact by first upgrading
> #mynote to a full-fledged NoteEvent; these implicit conversions happen
> all the time in LilyPond.

It's not really \displayMusic which does it but the parser.  The parser
would pass the pitch to \displayMusic as-is, but the predicate for
displayMusic's argument is ly:music? which refuses taking it so the
parser instead checks whether it can interpret \mynote in a manner more
acceptible to \displayMusic.  When it finds a valid interpretation
passing the predicate, it ultimately calls displayMusic with it.

-- 
David Kastrup



Re: Iterators in Scheme?

2020-08-09 Thread Niols

Hello,

On 07/08/2020 00:18, David Kastrup wrote:

Niols  writes:

I have not managed to override the "\repeat" music function.


It isn't a music function but a "reserved" word in LilyPond.


I know. Yet there is a "repeat" scheme function defined in 
scm/ly-syntax-constructors.ly that I tried to redefine (by recompiling 
LilyPond) and successfully managed to make it do what I wanted. I guess 
the lambda it contains gets passed to a table of some kind that 
associates reserved words to behaviours, but I could not locate such a 
table.



I suspect there is something I do not understand in the order in which
things are executed in LilyPond.

I have however found a solution based on overriding "make-music". I
replace "make-music" by a wrapper around it that adds the callback
from the snippet to all 'VoltaRepeatedMusic and leaves the rest
alone. This is actually just a few lines:

 #(define the-make-music make-music)

 #(define (make-music-wrapped name . music-properties)
   (let ((music (apply the-make-music (cons name music-properties
(if (equal? name 'VoltaRepeatedMusic)
 (ly:music-set-property! music 'elements-callback new-volta-set))
music))

 #(set! make-music make-music-wrapped)

It might not be the cleanest, but that is all I have, and that seems
to work.


It would be easier to do

music-descriptions.VoltaRepeatedMusic.elements-callback = ...

A cursory glance would suggest that might work (though its effect would
not be limited to one session).


Great idea! By reading scm/define-music-types.scm,I saw that 
music-descriptions is fed to a hash table. I thus managed this with:


#(let ((props (hashq-ref music-name-to-property-table 
'VoltaRepeatedMusic)))

  (assoc-set! props 'elements-callback new-volta-set))


You could also try to redefine the make-volta-set function.


That, I did not manage to make work. I suppose that the music-properties 
list and, later, the music-name-to-property-table only store the 
contents of make-volta-set; overriding it later is thus of no use.



2. Maybe there is a way to define a function that will be ran before
processing on any music? But this I have no idea if this is
possible, or how to do it, and my research has proven ineffective so
far.


There are the scorification hooks.


That sounds really interesting, whatever that is, also for other hacks 
around LilyPond. Would you happen to have any pointer for that?



3. Maybe there is a way to override the "make-volta-set" callback
instead of creating a new one? Such that then, in LilyPond's normal
execution, it uses the new definition and not and old one that then
needs to be replaced?


For 2. and 3., I still have no idea as this is far beyond my
understanding of the internals of LilyPond. I am not really looking
into it though.


Not a matter of internals.

#(define original-make-volta-set make-volta-set)

(define (make-volta-set ...) ...)

Possibly

(set! make-volta-set (lambda (...) ...))

but I think that the define probably works.


I suppose they work to override make-volta-set. As said earlier, though, 
I did not manage to get the expected result from this. I suppose the 
lambda is already fed to the music-name-to-property-table. Overriding 
this thus does not give much useful things.


Thank you very much for you help!
— Niols



Get grob value from another context

2020-08-09 Thread Павел

I want to write scheme function for this, but I don't know where to start:

\new Staff <<
    {
        c
    }
    \new Voice {
%        \stemUp, if note c (in another voice) has stem down
%        \stemDown, if note c has stem up
        g
    }
>>




Re: accidentals and broken bars

2020-08-09 Thread David Kastrup
Kevin Barry  writes:

> On Sun, 2020-08-09 at 06:48 +0200, Werner LEMBERG wrote:
>> Thanks for the explanation.  What about the other way round, this is,
>> adding some information to the invisible bar line that defines a
>> broken bar, and which accidentals could use to print themselves in
>> such cases?
>
> You could try something like
> maybeBreak =
> #(define-music-function (music) (ly:music?)
>#{
>  \bar ""
>  \accidentalStyle forget
>  #music
>  \accidentalStyle modern
>#})
> but that would force accidentals to be reprinted even if the line does
> not get broken.
>
> To get around that you could write some kind of callback for accidentals
> that would remove them when not at the beginning of a line as long as
> they are not new. I tried to do this but got stuck trying to detect if
> an accidental was new at that point in the bar or not. I was trying to
> use the localAlterations property but I was only ever able to see the
> last value of it. If there's a way a grob callback can check a context
> property at the moment of the event that caused the grob I don't know
> it. (I say this just in case anyone else does know how.)

There is no such thing, but an engraver acknowledging a grob can attach
properties to it (or try keeping score of them separately) from the
context it either is working in itself or the context of the engraver
creating the grob.

I think most of the time the handwaving heuristic "let a line break mark
all information not corresponding to the current key signature as
unknown" would work with most accidental rules.

-- 
David Kastrup



Re: Scheme: change duration of NoteEvent

2020-08-09 Thread Lukas-Fabian Moser

Hi Pavel,

Am 09.08.20 um 12:30 schrieb Павел:
I want to write simple function that will be change duration of note. 
But I stuck on the first step: I can't "extract" (or "see") the 
duration property:


\version "2.20.0"
mynote = c'
\displayMusic \mynote
#(display-scheme-music
    (ly:music-property mynote 'duration))


Try setting mynote = c'8 from the start.

LilyPond interprets your mynote as a naked pitch (and you obvioulsy 
can't extract a duration from a pitch). This can be seen by doing 
#(display-scheme-music mynote) which yields (ly:make-pitch 0 0), or 
simply by #(display mynote) which yields #.


It seems using \displayMusic hides this fact by first upgrading #mynote 
to a full-fledged NoteEvent; these implicit conversions happen all the 
time in LilyPond.


Best
Lukas


Re: accidentals and broken bars

2020-08-09 Thread Kevin Barry
On Sun, 2020-08-09 at 06:48 +0200, Werner LEMBERG wrote:
> Thanks for the explanation.  What about the other way round, this is,
> adding some information to the invisible bar line that defines a
> broken bar, and which accidentals could use to print themselves in
> such cases?

You could try something like
maybeBreak =
#(define-music-function (music) (ly:music?)
   #{
 \bar ""
 \accidentalStyle forget
 #music
 \accidentalStyle modern
   #})
but that would force accidentals to be reprinted even if the line does
not get broken.

To get around that you could write some kind of callback for accidentals
that would remove them when not at the beginning of a line as long as
they are not new. I tried to do this but got stuck trying to detect if
an accidental was new at that point in the bar or not. I was trying to
use the localAlterations property but I was only ever able to see the
last value of it. If there's a way a grob callback can check a context
property at the moment of the event that caused the grob I don't know
it. (I say this just in case anyone else does know how.)

Kevin 




Scheme: change duration of NoteEvent

2020-08-09 Thread Павел
I want to write simple function that will be change duration of note. 
But I stuck on the first step: I can't "extract" (or "see") the duration 
property:


\version "2.20.0"
mynote = c'
\displayMusic \mynote
#(display-scheme-music
    (ly:music-property mynote 'duration))




Re: line-breaking issue

2020-08-09 Thread Kevin Barry
Hi Ahanu,

It might help if you add this:
\layout {
  \context {
\Score
\override SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/32)
  }
}
It might make LilyPond more willing to squash sixteenths closer together
than it would normally like.

Kevin

On Sun, 2020-08-09 at 02:48 -0400, Ahanu Banerjee wrote:
> I tried setting systems-per-page to 10. It gave the same error as
> setting system-count to 20, and ran off the page.

3 measures per line is less than ideal, but it's readable. I'm
typesetting an etude book and am trying to avoid having fold-out pages
as much as possible. 


On Sun, Aug 9, 2020, 02:41 Hwaen Ch'uqi  wrote:
Greetings Ahanu,

What happens if you set the systems-per-page variable to 10 instead
of
using system-count = 20? Does the music then spill over onto a third
page? Just from experience, it seems that 48 sixteenth-notes per
line
would get rather cramped, no? I usually use 32-40 16ths per line as
my
guide.

Hwaen Ch'uqi


On 8/9/20, Ahanu Banerjee  wrote:
> Hello,
>
> An étude I'm typesetting needs to fit on 2 pages with reasonable
vertical
> space. Normally, I'd just set system-count in \paper (in this
case, 20
> systems in 2 US letter pages), but this time it says "warning:
cannot find
> line breaking that satisfies constraints" and just runs off the
page. If I
> don't set system-count, it gives me 25 cramped systems on 2 pages.
>
> The piece is almost entirely sixteenth notes in 4/4. Some systems
fill with
> 3 bars, others with 2, and I can't figure out why. Ideally, most
would have
> 3 bars, but manual line breaks won't fix it. I've checked for
rhythmic
> errors (every measure has a barcheck) and didn't find any. I don't
want to
> decrease the font size.
>
> Unfortunately, I can't come up with a tiny example to demonstrate
this
> behaviour. If anyone has suggestions or someone would be willing
to look
> over my file, I'd really appreciate it.
>
> Cheers,
> -Ahanu
>




Re: line-breaking issue

2020-08-09 Thread Ahanu Banerjee
I tried setting systems-per-page to 10. It gave the same error as setting
system-count to 20, and ran off the page.

3 measures per line is less than ideal, but it's readable. I'm typesetting
an etude book and am trying to avoid having fold-out pages as much as
possible.


On Sun, Aug 9, 2020, 02:41 Hwaen Ch'uqi  wrote:

> Greetings Ahanu,
>
> What happens if you set the systems-per-page variable to 10 instead of
> using system-count = 20? Does the music then spill over onto a third
> page? Just from experience, it seems that 48 sixteenth-notes per line
> would get rather cramped, no? I usually use 32-40 16ths per line as my
> guide.
>
> Hwaen Ch'uqi
>
>
> On 8/9/20, Ahanu Banerjee  wrote:
> > Hello,
> >
> > An étude I'm typesetting needs to fit on 2 pages with reasonable vertical
> > space. Normally, I'd just set system-count in \paper (in this case, 20
> > systems in 2 US letter pages), but this time it says "warning: cannot
> find
> > line breaking that satisfies constraints" and just runs off the page. If
> I
> > don't set system-count, it gives me 25 cramped systems on 2 pages.
> >
> > The piece is almost entirely sixteenth notes in 4/4. Some systems fill
> with
> > 3 bars, others with 2, and I can't figure out why. Ideally, most would
> have
> > 3 bars, but manual line breaks won't fix it. I've checked for rhythmic
> > errors (every measure has a barcheck) and didn't find any. I don't want
> to
> > decrease the font size.
> >
> > Unfortunately, I can't come up with a tiny example to demonstrate this
> > behaviour. If anyone has suggestions or someone would be willing to look
> > over my file, I'd really appreciate it.
> >
> > Cheers,
> > -Ahanu
> >
>


Re: line-breaking issue

2020-08-09 Thread Hwaen Ch'uqi
Greetings Ahanu,

What happens if you set the systems-per-page variable to 10 instead of
using system-count = 20? Does the music then spill over onto a third
page? Just from experience, it seems that 48 sixteenth-notes per line
would get rather cramped, no? I usually use 32-40 16ths per line as my
guide.

Hwaen Ch'uqi


On 8/9/20, Ahanu Banerjee  wrote:
> Hello,
>
> An étude I'm typesetting needs to fit on 2 pages with reasonable vertical
> space. Normally, I'd just set system-count in \paper (in this case, 20
> systems in 2 US letter pages), but this time it says "warning: cannot find
> line breaking that satisfies constraints" and just runs off the page. If I
> don't set system-count, it gives me 25 cramped systems on 2 pages.
>
> The piece is almost entirely sixteenth notes in 4/4. Some systems fill with
> 3 bars, others with 2, and I can't figure out why. Ideally, most would have
> 3 bars, but manual line breaks won't fix it. I've checked for rhythmic
> errors (every measure has a barcheck) and didn't find any. I don't want to
> decrease the font size.
>
> Unfortunately, I can't come up with a tiny example to demonstrate this
> behaviour. If anyone has suggestions or someone would be willing to look
> over my file, I'd really appreciate it.
>
> Cheers,
> -Ahanu
>