ly:set-option png backend broken?

2023-12-09 Thread Stefano Antonelli
Hello list,

If I add this line to my ly file:

#(ly:set-option 'backend 'png)

on 2.20.0 (linux), I get this warning:

warning: program option -dprint-pages not supported by backend `png'

on 2.24.3 (wine and linux), same file, I get this failure:

C:/lilypond-2.24.3/share/lilypond/2.24.3/ly/init.ly:65:2: error: Guile
signaled an error for the expression beginning here
#
 (let ((book-handler (if (defined? 'default-toplevel-book-handler)
In procedure module-lookup: Unbound variable: output-stencils

The file looks like this:

theMusic = \new Staff {
c4 d e f
g4 a b c
d4 e f g
}

\score {
\unfoldRepeats { \theMusic }

\layout { }
\midi { }
}

#(ly:set-option 'backend 'png)

I was going to ask why setting the png backend this way differs from
adding --png to the command line.  I thought I'd test it in 2.24.3
first in case it was fixed.

Is there a bug in 2.24.3?  Or is there something quasi wrong with the
syntax?

In the 2.20.0 version, no png is produced.  I can make the warning go
away with:

#(ly:set-option 'print-pages #f)
#(ly:set-option 'backend 'png)

but still no png is produced.  If I take those lines out and run:

lilypond --png test.ly

then a png is produced.  It's odd behaviour.

Thanks,
Stef



lilypond "preprocessor"?

2023-12-09 Thread Stefano Antonelli
Hello list,

The issue I'm facing is that I might have a song.ly that contains:

\header {
% author and stuff
}

\theMusic = new DrumStaff {
% the music
}

ly2video can't work with this file.  It needs to see a \score block so
it can add unfold repeats, layout, and midi.  ly2video actually
'scrapes' the input file and writes everything except what it wants to
remove to a file for the next stage of processing.

I know I can run lilypond on song.ly and it will implicitly wrap it in
a \score block, but is that contained in an intermediate file somewhere
I can get access to?

I can create a separate file that looks like this:

\include "song.ly"

\score {
\theMusic
}

And let ly2video do the rest, but then it can't see the header block
anymore.  So if there was alternatively an intermediate file with all
the includes, that could work too.

I didn't see a way to keep those kind of intermediate files in
lilypond's help.  There is delete-intermediate-files which talks about
.ps files that I don't think I'm interested in.

Otherwise, I have to figure out how to parse includes and make sure
it's recursive.

Any other options for getting the header block from an included file?

Thanks,
Stef




Lilypond on Linux/Fedora 39 error after system update.

2023-12-09 Thread Laurie Savage
Hi,

I was editing a lead sheet for my combo and it compiled fine. I closed
Frescobaldi, accepted Fedora's nags to update and went to bed. I opened
Frescobaldi this morning and get this error message on any file I try to
compile.

/usr/share/lilypond/2.25.4/ly/init.ly:64:2 <0>: error: Guile signaled an
error for the expression beginning here

#

(let ((book-handler (if (defined? 'default-toplevel-book-handler)

Throw to key `ly-file-failed' with args `()'.

I have the correct version of Lilypond set in my source files with
convert-ly. Any file I try to compile worked fine before the system update.
The system update was very comprehensive and I have no idea what might have
broken. I tried a re-installation of Lily but that didn't work.

Fedora 39, last updated 10/12/2023.

Laurie


Re: Unexpected bar boundaries with volta repeats and lyrics.

2023-12-09 Thread David Wright
On Sun 10 Dec 2023 at 08:14:32 (+1100), Kevin Pye wrote:
> On Sat, 9 Dec 2023, at 23:45, Michael Werner wrote:
> > On Fri, Dec 8, 2023 at 11:31 PM Kevin Pye  wrote:
> >> What silly mistake am I making here?
> > 
> > Not all that silly. Though the docs do talk about putting lyrics into the 
> > same repeat structure as the music, there's one detail in 
> > http://lilypond.org/doc/v2.25/Documentation/notation/lyrics-and-repeats 
> > that you may have missed:
> > 
> > "... when one of the `\alternative` blocks starts with a rest, a repeat 
> > construct cannot be used around the words"
> > 
> > Change the lyrics block to just
> > 
> > words = \lyricmode {
> > a b c d e 
> > }
> > 
> > and it should behave itself a bit better for you.
> 
> Unfortunately, in this case (the real score from which the example was 
> extracted) I need the words to be repeated so I can unfold them for midi 
> output. I'll just have to do the unfold manually.

FTR the full sentence is "But when the repeated section has different
words, or when one of the \alternative blocks starts with a rest,
a repeat construct cannot be used around the words and \skip commands
have to be inserted manually to skip over the notes in the alternative
sections which do not apply."

So you need a \skip4 for the crochet rest.

The next bit is tedious; you need to add the duration to each lyric
syllable, in a similar way to the notes.

Finally, you need to associate the voice and lyrics with a
\set associatedVoice command.

I've added a couple of notes to the MWE. Unfortunately it probably
shows that I'm not up-to-date on the new ways of typesetting repeats.
I've got some reading to do.

Adding durations to lyrics is not popular. By the time the NR treats
repeats in §2.1.2, manual syllable durations are a distant memory
back in §2.1.1, until they make a fleeting return with dialogue over
music in §2.1.6.

Cheers,
David.
\paper { #(set-paper-size "a6landscape") }

music = \relative {
  \time 4/4
  \repeat volta 2 {
c'1 |
\alternative {
  { d1 | }
  { | r4 e2 f4 | g1 }
}
a2 bes2
  }
  \bar "|."
}

words = \lyricmode {
  \set associatedVoice = vvv
  \repeat volta 2 {
C1
\alternative {
  { D1 }
  { \skip4 E2 F4 G1 }
}
A2 B♭2
  }
}

\score {
  \new Staff <<
\new Voice = vvv \music
\new Lyrics \words
  >>
  \layout { }
  \midi { \tempo 4=120 }
}

\score {
  \unfoldRepeats
  \new Staff <<
\new Voice = vvv \music
\new Lyrics \words
  >>
  \layout { }
  \midi { \tempo 4=120 }
}


rpt-alt.pdf
Description: Adobe PDF document


rpt-alt.midi
Description: Binary data


rpt-alt-1.midi
Description: Binary data


Re: Unexpected bar boundaries with volta repeats and lyrics.

2023-12-09 Thread Kevin Pye
Thank you,

Unfortunately, in this case (the real score from which the example was 
extracted) I need the words to be repeated so I can unfold them for midi 
output. I'll just have to do the unfold manually.

Kevin.

On Sat, 9 Dec 2023, at 23:45, Michael Werner wrote:
> Hi Kevin,
> 
> On Fri, Dec 8, 2023 at 11:31 PM Kevin Pye  wrote:
>> __
>> What silly mistake am I making here?
> 
> Not all that silly. Though the docs do talk about putting lyrics into the 
> same repeat structure as the music, there's one detail in 
> http://lilypond.org/doc/v2.25/Documentation/notation/lyrics-and-repeats that 
> you may have missed:
> 
> "... when one of the `\alternative` blocks starts with a rest, a repeat 
> construct cannot be used around the words"
> 
> Change the lyrics block to just
> 
> words = \lyricmode {
> a b c d e 
> }
> 
> and it should behave itself a bit better for you.
> --
> Michael


Re: Video generation from multiple pages

2023-12-09 Thread Stefano Antonelli
On Sat, 2023-12-09 at 17:34 +0100, Jean Abou Samra wrote:
> > The line breaks come out before the rest of the measure does.  I
> > would
> > expect the first line break print to appear after the third
> > ly2videoBar.
> 
> Are you relying on the order in which after-line-breaking callbacks
> are run?
> 
> You shouldn't, as the order is completely undefined and has no
> guarantees. It should be easy enough to .sort() the result in Python
> to avoid the problem. If ly2video doesn't do this, it should be
> fixed.

I'm not sure what ly2video is doing.  The comments say the list is
sorted so I presume they are.  I haven't gotten that far along, yet.

If the output *must* be sorted, then I will make sure it is.  Thanks
for that info.

> > I thought that putting it in \Staff context might change the
> > behaviour, but no
> > prints came out.
> 
> System objects, representing a whole system with possibly many
> staves, live on Score level (it's actually a little more complicated
> IIRC but this is a good approximation), so they're not  affected by
> overrides on Staff level.

Got it.  Thanks and thanks again for the help.


Re: Video generation from multiple pages

2023-12-09 Thread Jean Abou Samra


> The line breaks come out before the rest of the measure does.  I would
> expect the first line break print to appear after the third
> ly2videoBar.


Are you relying on the order in which after-line-breaking callbacks are run?

You shouldn't, as the order is completely undefined and has no guarantees. It 
should be easy enough to .sort() the result in Python to avoid the problem. If 
ly2video doesn't do this, it should be fixed.


> I thought that putting it in \Staff context might change the behaviour, but no
> prints came out.

System objects, representing a whole system with possibly many staves, live on 
Score level (it's actually a little more complicated IIRC but this is a good 
approximation), so they're not  affected by overrides on Staff level.





Re: Video generation from multiple pages

2023-12-09 Thread Stefano Antonelli
On Fri, 2023-12-08 at 22:55 +0100, Jean Abou Samra wrote:
> Yes, but it was not called for System specifically until
> 
> commit 782f5528e014cc3c7f705298a83f777306541e89
> Author: Jean Abou Samra 
> Date:   Mon Mar 21 21:21:28 2022 +0100
> 
> Also call after-line-breaking/before-line-breaking/springs-and-
> rods on System
> 
> This makes System consistent with other grobs and allows for
> customizations and debugging.
> 
> 
> which appeared in 2.23.7.

Thanks for confirming.

> Please triple check that you are actually running 2.24.3.

*facepalm*

Somehow my up arrow got mixed up and was using lilypond instead of
./lilypond as I tested back to back.

> System.after-line-breaking not working hints at a pre-2.23.7 version,
> and 'when' being unbound means it's built with Guile 1 as opposed to
> Guile 2 or Guile 3, which is impossible in LilyPond 2.24.

GNU LilyPond 2.24.3 (running Guile 2.2)

I will pay more attention to that version string.

> #(define (dump-system-info sys)
>(let* ((right (ly:spanner-bound sys RIGHT))
>   (time (ly:grob-property right 'when 0)))
>  (format #t "\nline break at ~f" (ly:moment-main time
> 
> \layout {
>   \context {
> \Score
> \override System.after-line-breaking = #dump-system-info
>   }
> }

I can confirm that this works now.  However, when I integrate it with
the other dump-spacetime output:

Drawing systems...
line break at 3.0
ly2video:( 12.1143247086614170, 13.4185367086614170) 0.0
ly2video:( 14.8278751262453050, 16.1320871262453020) 0.25000
ly2video:( 17.5414255438291900, 18.8456375438291900) 0.5
ly2video:( 20.2549759614130770, 21.5591879614130770) 0.75000
ly2video:( 23.948960433930, 25.253172433920) 1.0
ly2videoBar: ( 22.8032482361398220, 22.9932482361398240) 1.0
ly2video:( 26.6625108506950780, 27.9667228506950780) 1.25000
ly2video:( 29.3760612682789630, 30.6802732682789630) 1.5
ly2video:( 32.0896116858628500, 33.3938236858628500) 1.75000
ly2video:( 35.7835961575609640, 37.0878081575609640) 2.0
ly2videoBar: ( 34.6378839605895900, 34.8278839605895900) 2.0
ly2video:( 38.4971465751448500, 39.8013585751448500) 2.25000
ly2video:( 41.2106969927287400, 42.5149089927287400) 2.5
ly2video:( 43.9242474103126300, 45.2284594103126300) 2.75000
ly2videoBar: ( 46.4725196850393800, 46.6625196850393800) 3.0
line break at 7.0

The line breaks come out before the rest of the measure does.  I would
expect the first line break print to appear after the third
ly2videoBar.  And I didn't show it, but there's no line break following
the end of the last bar.  So the number of breaks is correct, they are
all just shifted in the time that they are printed.

I guess the System.after-line-breaking is being called before all the
others (NoteHead, BarLine) which is not what I am expecting.  I thought
that putting it in \Staff context might change the behaviour, but no
prints came out.

Then I tried your other suggestion using NonMusicalPaperColumn:

#(define (dump-col-info col)
   (when (eqv? LEFT (ly:item-break-dir col))
 (let ((time (ly:grob-property col 'when 0)))
   (format #t "\nline break2 at ~f" (ly:moment-main time)

\layout {
  \context {
\Score
\override NonMusicalPaperColumn.after-line-breaking = #dump-col-
info
  }
}

And it prints before the last Bar:

Drawing systems...
line break at 3.0
ly2video:( 12.1143247086614170, 13.4185367086614170) 0.0
ly2video:( 14.8278751262453050, 16.1320871262453020) 0.25000
ly2video:( 17.5414255438291900, 18.8456375438291900) 0.5
ly2video:( 20.2549759614130770, 21.5591879614130770) 0.75000
ly2video:( 23.948960433930, 25.253172433920) 1.0
ly2videoBar: ( 22.8032482361398220, 22.9932482361398240) 1.0
ly2video:( 26.6625108506950780, 27.9667228506950780) 1.25000
ly2video:( 29.3760612682789630, 30.6802732682789630) 1.5
ly2video:( 32.0896116858628500, 33.3938236858628500) 1.75000
ly2video:( 35.7835961575609640, 37.0878081575609640) 2.0
ly2videoBar: ( 34.6378839605895900, 34.8278839605895900) 2.0
ly2video:( 38.4971465751448500, 39.8013585751448500) 2.25000
ly2video:( 41.2106969927287400, 42.5149089927287400) 2.5
ly2video:( 43.9242474103126300, 45.2284594103126300) 2.75000
line break2 at 3.0
ly2videoBar: ( 46.4725196850393800, 46.6625196850393800) 3.0
line break at 7.0

if I change 
   (when (eqv? LEFT (ly:item-break-dir col))
to
   (when (eqv? RIGHT (ly:item-break-dir col))

I get:

Drawing systems...
line break at 3.0
line break2 at 0.0
...
ly2videoBar
line break at 7.0
line break2 at 3.0

Which is better, but there is no break for the last page and having
line break2 come out at the start with 0.0 isn't helpful.

So that's closer to what I want, but not exact.

Thanks,
Stef



Re: right enharmonic spelling

2023-12-09 Thread Stefan Thomas
Dear David,
thanks for your reply. But would also a solution with regex be possible?

David Kastrup  schrieb am Sa., 9. Dez. 2023, 13:49:

> Stefan Thomas  writes:
>
> > Dear community,
> > I'm using a lot frescobaldi with MIDI input. I would like to know is how
> > could I achieve automatically the right enharmonic spelling. e.g. when I
> > want to get bis instead of c'?
>
> If I remember correctly, the MIDI entry box allowed you to set the key
> it was working with.  Just bump the number of sharps until you like the
> enharmonic spelling.
>
> --
> David Kastrup
>


Re: clefs, time signatures, and key signatures

2023-12-09 Thread Jakob Pedersen
For what it's worth, I think the original suggestion (with the top-left 
clef adjusted by -4.4%) is the better of the two.


I do understand that there's an argument to be made against adjusting 
clefs that aren't /too/ bad, but the adjusted versions of the treble 
clefs /are/ better imo.


With aesthetics and readability being important reasons why Lilypond is 
superior to other music typesetters, I think this adjustment is just 
splendid!


Best wishes,
Jakob

On 09.12.2023 12.40, Michael Gerdau wrote:

Thanks, but I would like to know whether you prefer the top
(alto-based) or bottom (treble-based) image on

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

Top (alto-based) is 6 days ago and bottom (treble-based) is 4 days ago as of 
today?

Of those two I prefer bottom as it seems to be more balanced overall to me.

Kind regards,
Michael




Re: right enharmonic spelling

2023-12-09 Thread David Kastrup
Stefan Thomas  writes:

> Dear community,
> I'm using a lot frescobaldi with MIDI input. I would like to know is how
> could I achieve automatically the right enharmonic spelling. e.g. when I
> want to get bis instead of c'?

If I remember correctly, the MIDI entry box allowed you to set the key
it was working with.  Just bump the number of sharps until you like the
enharmonic spelling.

-- 
David Kastrup



Re: Unexpected bar boundaries with volta repeats and lyrics.

2023-12-09 Thread Michael Werner
Hi Kevin,

On Fri, Dec 8, 2023 at 11:31 PM Kevin Pye  wrote:

> What silly mistake am I making here?
>

Not all that silly. Though the docs do talk about putting lyrics into the
same repeat structure as the music, there's one detail in
http://lilypond.org/doc/v2.25/Documentation/notation/lyrics-and-repeats
that you may have missed:

"... when one of the \alternative blocks starts with a rest, a repeat
construct cannot be used around the words"

Change the lyrics block to just

words = \lyricmode {
a b c d e
}

and it should behave itself a bit better for you.
-- 
Michael


right enharmonic spelling

2023-12-09 Thread Stefan Thomas
Dear community,
I'm using a lot frescobaldi with MIDI input. I would like to know is how
could I achieve automatically the right enharmonic spelling. e.g. when I
want to get bis instead of c'?
Maybee one could usw a python Script with python.ly?


Re: clefs, time signatures, and key signatures

2023-12-09 Thread Michael Gerdau


> Thanks, but I would like to know whether you prefer the top
> (alto-based) or bottom (treble-based) image on
> 
>  https://gitlab.com/lilypond/lilypond/-/merge_requests/2188

Top (alto-based) is 6 days ago and bottom (treble-based) is 4 days ago as of 
today?

Of those two I prefer bottom as it seems to be more balanced overall to me.

Kind regards,
Michael