Re: LilyPond 2.23.6 *-tmp-* files

2022-06-01 Thread Jacques Menu
Hello everybody,

Thanks for you tests and information.

In fact, these *-tmp-* files remain when the PDF is produced within 
Frescobaldi, but not when using Lily on the command line.

It turns out this stems from Frescobaldi's LilyPond preferences: for some 
reason, the ‘remove intermediate files’ box was unselected… Don’t know how that 
happened.

Sorry for the noise!

JM




Re: not understanding the Al_Fine repeat feature of 2.23.9

2022-06-01 Thread Jacques Menu
Hello Kenneth,

Here is the way to do it. The :

   \volta 2 \fine

should precede the note it applies to.

JM



Volta2Fine.ly
Description: Binary data




> Le 29 mai 2022 à 01:59, Kenneth Wolcott  a écrit :
> 
> Hi;
> 
>  I tried to engrave a simple Tuba Duet that has a Fine+D.C. construct
> using Lilypond 2.23.9
> 
> I don't think I used the Al_Fine repeat feature correctly, as the
> "Fine" is displayed one bar later than I expected it to be.
> 
>  Could someone be so kind as to explain what I did wrong or what I
> could do better?
> 
>  Please see attachments (the original is from Rubank Intermediate
> Method for Tuba).
> 
> Thanks,
> Ken Wolcott
> 



Re: Lilybin?

2022-06-01 Thread Jean Abou Samra




Le 01/06/2022 à 10:08, Jean Abou Samra a écrit :

Le 31/05/2022 à 21:45, gregorybl...@gmail.com a écrit :
Apologies if this question has already been asked and answered on 
this list, but... any chance that Lilybin might come back from the 
dead, some day?


http://lilybin.com/

It's been gone for a few weeks now. Is there anything someone might 
do to help it come back from the dead?




I see an issue open on its tracker:

https://github.com/LilyBin/LilyBin/issues/92

That said, given the responsiveness in the past few years,
I am afraid it might be really dead, at least on that
hosting. The code is under a free license (see the repository
above), so someone willing to ressuscitate it could host it
on their own server.


By the way:

https://github.com/LilyBin/LilyBin/pull/91




Re: Lilybin?

2022-06-01 Thread Jean Abou Samra

Le 31/05/2022 à 21:45, gregorybl...@gmail.com a écrit :
Apologies if this question has already been asked and answered on this 
list, but... any chance that Lilybin might come back from the 
dead, some day?


http://lilybin.com/

It's been gone for a few weeks now. Is there anything someone might do 
to help it come back from the dead?




I see an issue open on its tracker:

https://github.com/LilyBin/LilyBin/issues/92

That said, given the responsiveness in the past few years,
I am afraid it might be really dead, at least on that
hosting. The code is under a free license (see the repository
above), so someone willing to ressuscitate it could host it
on their own server.





arbitrary repeat counter

2022-06-01 Thread Simon Bailey
Hi,

There's a handy snippet for counting repeated bars in the manual. But
I'm running into limitations when for instance I'd like to have 2- or
4-bar sections that I'd like to count. Usage example: a bass guitar
has a 4-bar riff that's repeated 8 times, but I can't use a volta
repeat in the part because the rest of the ensemble doesn't have
repeatable music; I'd like to print a counting number over the centre
of the first bar of each phrase.

For 2-bar phrases, using the example from the manual, I get the
following, but the Counter is centred over the middle bar-line. Does
anyone have a suggestion for some scheme magic I can investigate to
calculate the X-offset to the centre of the first bar?

\new Staff \relative c' {
  <<
{
  \set countPercentRepeats = ##t
  \hide DoublePercentRepeat
  \repeat percent 4 { s1*2}
}
\repeat unfold 4 { c4. 8 r4 8 r | d4. 4. 4 }
  >>
}

For 4-bar phrases, the best thing I've managed to come up with is this:

\new Staff \relative c {
  \clef bass
  <<
\context Voice = "foo" {
  \repeat unfold 4 { r4 d8 r r f r4 | a8 r r g r a f r8 | r4 d'8 r
r f, r4 | a8 r r g8 ~ g4 r | }
}
\context Voice = "foo" {
  \hide MultiMeasureRest
  \override Voice.MultiMeasureRestText.font-encoding = #'fetaText
  \override Voice.MultiMeasureRestText.font-size = #-2
  s1*4 | R1^"(2)" s1*3  | R1^"(3)" s1*3  | R1-"(4)" s1*3  |
}
  >>
}

but that's all a bit "manual" ;)

I was thinking it may be possible to override the stencil for the
PercentRepeatCounter and do some math on the current percent repeat
count, but I have no idea how to:

a) get the current repeat number
b) replace a text-interface::print stencil

I've just spent 2 hours digging through LSR and the exending lilypond
manual, but that was a bit fruitless.

I'm also wondering if there's any form of convention to show these
repeated phrases – as a player, if I was given a part with these
repeated phrases and no counting, I'd add the numbers in pencil and
probably a flare to the final barline of each phrase. I'm open to
suggestions ;)

Thanks, kind regards,
sb

-- 
Do not meddle in the affairs of trombonists, for they are subtle and
quick to anger.



Re: arbitrary repeat counter

2022-06-01 Thread Jean Abou Samra

Le 01/06/2022 à 10:53, Simon Bailey a écrit :

Hi,

There's a handy snippet for counting repeated bars in the manual. But
I'm running into limitations when for instance I'd like to have 2- or
4-bar sections that I'd like to count. Usage example: a bass guitar
has a 4-bar riff that's repeated 8 times, but I can't use a volta
repeat in the part because the rest of the ensemble doesn't have
repeatable music;




How about doing it like this?

\version "2.22.2"

part = {
  \repeat volta 8 { c'1 1 1 1 }
}

{ \part }

otherPart = {
  c'1 1 1 1
  d'1 1 1 1
  e'1 1 1 1
  f'1 1 1 1
  g'1 1 1 1
  a'1 1 1 1
  b'1 1 1 1
  c'1 1 1 1
}

<<
  \new Staff \unfoldRepeats \part
  \new Staff \otherPart







I'd like to print a counting number over the centre
of the first bar of each phrase.

For 2-bar phrases, using the example from the manual, I get the
following, but the Counter is centred over the middle bar-line. Does
anyone have a suggestion for some scheme magic I can investigate to
calculate the X-offset to the centre of the first bar?

\new Staff \relative c' {
   <<
 {
   \set countPercentRepeats = ##t
   \hide DoublePercentRepeat
   \repeat percent 4 { s1*2}
 }
 \repeat unfold 4 { c4. 8 r4 8 r | d4. 4. 4 }
   >>
}

For 4-bar phrases, the best thing I've managed to come up with is this:

\new Staff \relative c {
   \clef bass
   <<
 \context Voice = "foo" {
   \repeat unfold 4 { r4 d8 r r f r4 | a8 r r g r a f r8 | r4 d'8 r
r f, r4 | a8 r r g8 ~ g4 r | }
 }
 \context Voice = "foo" {
   \hide MultiMeasureRest
   \override Voice.MultiMeasureRestText.font-encoding = #'fetaText
   \override Voice.MultiMeasureRestText.font-size = #-2
   s1*4 | R1^"(2)" s1*3  | R1^"(3)" s1*3  | R1-"(4)" s1*3  |
 }
   >>
}

but that's all a bit "manual" ;)

I was thinking it may be possible to override the stencil for the
PercentRepeatCounter and do some math on the current percent repeat
count, but I have no idea how to:

a) get the current repeat number
b) replace a text-interface::print stencil

I've just spent 2 hours digging through LSR and the exending lilypond
manual, but that was a bit fruitless.



Sadly, the extending manual isn't overly helpful. That's
the reason why I wrote

https://extending-lilypond.readthedocs.io

You may find it more useful. At any rate, it is definitely
more thorough.

That said, if you use the suggestion above, the problem
is solved without needing it at all ;-)




I'm also wondering if there's any form of convention to show these
repeated phrases – as a player, if I was given a part with these
repeated phrases and no counting, I'd add the numbers in pencil and
probably a flare to the final barline of each phrase. I'm open to
suggestions ;)



I don't know whether there is an established convention, but
I would say it is definitely easier to follow the score if
the repeat is condensed, especially for something repeated 8
times. On the other hand, it might be trickier to make it
easy to jump to a specific bar number.


Regards,
Jean




Re: vertical half-brackets

2022-06-01 Thread Werner LEMBERG


>> * Has someone coded this already?  I couldn't find code in the LSR.
> 
> I don't know if this is still the most ideal way, but it works.
> [...]

Thanks a lot for all the replies!  I'll analyze them and cook
something up for my needs.


Werner



Re: arbitrary repeat counter

2022-06-01 Thread Simon Bailey
Hi Jean,

On Wed, 1 Jun 2022 at 10:04, Jean Abou Samra  wrote:
> How about doing it like this?
> < SNIP SNIP SNIP>
> <<
>\new Staff \unfoldRepeats \part
>\new Staff \otherPart
> >>

Yeah, I know about unfoldRepeats. But using voltas in a part where
they're not in a score is a big no-no. I realise it was given practice
in some editions, but it just leads to confusion and panic in
rehearsals. Also, simply unfolding the repeats does not solve the
numbering issue ;) (indeed, \repeat volta 8 doesn't indicate that it
gets repeated 8 times without adding some markup somewhere).

Gould says on repeated sections:
<<
Repeated section[s] in instrumental parts must correspond exactly with
the layout of a score. Parts must have the same number of notated bars
as a score and repeats must occur in identical places in all material,
[…]
>>

> Sadly, the extending manual isn't overly helpful. That's
> the reason why I wrote
>
> https://extending-lilypond.readthedocs.io
>
> You may find it more useful. At any rate, it is definitely
> more thorough.

I'll bookmark that one right away. Thanks!

Kind regards,
sb

-- 
Do not meddle in the affairs of trombonists, for they are subtle and
quick to anger.



rehearsal marks, top-staff lyrics, and moved engravers

2022-06-01 Thread Werner LEMBERG

Dear LilyPonders,


the snippet below demonstrates that top-staff lyrics are incorrectly
positioned above rehearsal marks if the engraver for the latter is
moved to another context (I need that in a full score with rehearsal
marks printed simultaneously at three different vertical positions).

What am I missing?


Werner
music = { a'1 ~ | a' } 
text = \lyricmode { foo __ }
top = { s1 | \mark\default s1 }

\score {
  \new Staff = "staff"
  <<
\top
\music

\new NullVoice = "aligner" \music
\new Lyrics \with { alignAboveContext = "staff" }
  \lyricsto "aligner" \text
  >>
}


\score {
  \new Staff = "staff" \with { \consists Mark_engraver }
  <<
\top
\music

\new NullVoice = "aligner" \music
\new Lyrics \with { alignAboveContext = "staff" }
  \lyricsto "aligner" \text
  >>

  \layout {
\context {
  \Score
  \remove Mark_engraver
}
  }
}


Re: Lilybin?

2022-06-01 Thread Paul Hodges



From:   Jean Abou Samra  

By the way: 
 
https://github.com/LilyBin/LilyBin/pull/91 





That message leads indirectly to 
     
     https://hacklily.org/ 


which is using LilyPond 2.22 rather than LilyBin's 2.18.  How its functionality 
compares I don't know, as I'm not familiar with LilyBin in the first place.


Paul







Re: rehearsal marks, top-staff lyrics, and moved engravers

2022-06-01 Thread Xavier Scheuer
On Wed, 1 Jun 2022 at 11:32, Werner LEMBERG  wrote:
>
>
> Dear LilyPonders,
>
>
> the snippet below demonstrates that top-staff lyrics are incorrectly
> positioned above rehearsal marks if the engraver for the latter is
> moved to another context (I need that in a full score with rehearsal
> marks printed simultaneously at three different vertical positions).
>
> What am I missing?

Hi Werner,

I have always considered Lyrics contexts to be on the same level as Staff
(so I never put a Lyrics context inside a Staff context, but always above
or below).

So I would have thought that adding the Mark_engraver to a StaffGroup-like
context (like ChoirStaff) containing both the Lyrics and the staff (see
below) would solve the problem. But it doesn't. I would tend to consider
this a bug.

\score {
  <<
\new ChoirStaff = "choirstaff" \with {
  \consists Mark_engraver
} {
  <<
\new Staff = "staff" {
  <<
\new Voice = "music" {
  <<
\top
\music
  >>
}
\new NullVoice = "aligner" {
  \music
}
  >>
}
\new Lyrics = "lyrics" \with {
  alignAboveContext = "staff"
} \lyricsto "aligner" {
  \text
}
  >>
}
  >>
  \layout {
\context {
  \Score
  \remove Mark_engraver
}
  }
}

Cheers,
Xavier

-- 
Xavier Scheuer 


Re: rehearsal marks, top-staff lyrics, and moved engravers

2022-06-01 Thread Jean Abou Samra

Le 01/06/2022 à 11:31, Werner LEMBERG a écrit :

Dear LilyPonders,


the snippet below demonstrates that top-staff lyrics are incorrectly
positioned above rehearsal marks if the engraver for the latter is
moved to another context (I need that in a full score with rehearsal
marks printed simultaneously at three different vertical positions).

What am I missing?




That looks as expected to me. The Mark_engraver is on Staff level
and the Lyrics context goes above your Staff context, so the lyrics
get higher than the marks. Why would it look different?

I think you likely want to move the Mark_engraver to a kind
of MarkLine context instead. I was going to recommend moving
it to StaffGroup, but I found
https://gitlab.com/lilypond/lilypond/-/issues/6357

\version "2.23.10"

music = { a'1 ~ | a' }
text = \lyricmode {
  foo __

}
top = { s1 | \mark\default s1 }

\score {
  <<
    \new MarkLine \top
    \new Staff = "staff" <<
  \music
  \new NullVoice = "aligner" \music
    >>
    \new Lyrics \with {
  alignAboveContext = "staff"
    }
  \lyricsto "aligner" \text
  >>
  \layout {
    \context {
  \Score
  \remove Mark_engraver
  \remove Staff_collecting_engraver
  \accepts MarkLine
    }
    \context {
  \name MarkLine
  \type Engraver_group
  \consists Axis_group_engraver
  \consists Mark_engraver
  \override VerticalAxisGroup.staff-affinity = #DOWN
  \override VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding 
= #0.5

  \override VerticalAxisGroup.nonstaff-nonstaff-spacing.padding = #0.5
    }
  }
}


Jean





Re: Lilybin?

2022-06-01 Thread Paul Hodges

From:   Paul Hodges  
 To:   Jean Abou Samra , "gregorybl...@gmail.com" 
,  
 Sent:   01/06/2022 11:14 
 Subject:   Re: Lilybin? 




From:   Jean Abou Samra  

By the way: 
 
https://github.com/LilyBin/LilyBin/pull/91 





That message leads indirectly to 
     
     https://hacklily.org/ 


which is using LilyPond 2.22 rather than LilyBin's 2.18.  How its functionality 
compares I don't know, as I'm not familiar with LilyBin in the first place.


Paul


The documentation is also less thin than that of LilyBin:






 
      https://github.com/emilyskidsister/hacklily


Paul

Re: arbitrary repeat counter

2022-06-01 Thread Simon Bailey
Hi,

with a little bit of digging through your manual, i have solved some
of my questions:

#(define (counter-stencil grob)
   (let* ((counter (ly:grob-property grob 'text)))  ; get the value of
the counter
 (ly:stencil-aligned-to
   (grob-interpret-markup grob
 (markup counter "!")) ; print the counter back with !
   Y
   CENTER)))

This basically replicates the behaviour of the regular percent counter
and adds an exclamation mark. so now i can just add some if/mod/div
magic and it should do what I want. Getting there… ;)

Kind regards,
sb



Re: rehearsal marks, top-staff lyrics, and moved engravers

2022-06-01 Thread Werner LEMBERG

> I think you likely want to move the Mark_engraver to a kind of
> MarkLine context instead.

Well, the problem is that such a context needs the
`Axis_group_engraver`, which tries to align stuff horizontally on a
line.  I don't want that.  Rehearsal and tempo marks should be aligned
on the selected staff as if they were part of it, see attached
example.  But maybe you and your wizardry find a solution for that :-)


Werner
\version "2.23.10"

music = { a'1 ~ | a' | a' | a' }
text = \lyricmode {
  foo __

}
top = { \tempo "Allegro" s1 | s | \mark\default s | s }


\score {
  <<
\new Staff = "staff" <<
  \top
  \new NullVoice = "aligner" \music
  \music
>>
\new Lyrics \with {
  alignAboveContext = "staff"
}
  \lyricsto "aligner" \text
  >>
}

\score {
  <<
\new MarkLine \top

\new Staff = "staff" <<
  \music
  \new NullVoice = "aligner" \music
>>
\new Lyrics \with {
  alignAboveContext = "staff"
}
  \lyricsto "aligner" \text
  >>
  \layout {
\context {
  \Score
  \remove Mark_engraver
  \remove Staff_collecting_engraver
  \accepts MarkLine
}
\context {
  \name MarkLine
  \type Engraver_group
  \consists Axis_group_engraver
  \consists Mark_engraver
  \override VerticalAxisGroup.staff-affinity = #DOWN
  \override VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding = #0.5
  \override VerticalAxisGroup.nonstaff-nonstaff-spacing.padding = #0.5
}
  }
}


Re: rehearsal marks, top-staff lyrics, and moved engravers

2022-06-01 Thread Werner LEMBERG


>> the snippet below demonstrates that top-staff lyrics are
>> incorrectly positioned above rehearsal marks if the engraver for
>> the latter is moved to another context (I need that in a full score
>> with rehearsal marks printed simultaneously at three different
>> vertical positions).
> 
> That looks as expected to me.  The Mark_engraver is on Staff level
> and the Lyrics context goes above your Staff context, so the lyrics
> get higher than the marks.  Why would it look different?

OK, I simplified my real-world example too much, since...

> I think you likely want to move the Mark_engraver to a kind
> of MarkLine context instead.

... I'm doing exactly that and was actually bitten by...

> I was going to recommend moving it to StaffGroup, but I found
> https://gitlab.com/lilypond/lilypond/-/issues/6357

this bug :-)


Werner



Re: Lilybin?

2022-06-01 Thread Jean Abou Samra

Le 01/06/2022 à 12:32, Kevin Cole a écrit :

I hadn't heard of either LilyBin or HacLily.

So... Basically Frescobaldi over the web, yes?



Frescobaldi has enormously more features, but on the
basic level, yes.



Other than the collaborative, distributed nature -- which I can see as 
advantageous in some situations -- do they have features that 
Frescobaldi doesn't have?



I think the main advantage is being able to use LilyPond
anywhere (e.g. in a library, on rehearsal, ...) without
installing it on your computer first.


Best,
Jean




Re: Lilybin?

2022-06-01 Thread Kevin Cole
I hadn't heard of either LilyBin or HacLily.

So... Basically Frescobaldi over the web, yes?

Other than the collaborative, distributed nature -- which I can see as
advantageous in some situations -- do they have features that Frescobaldi
doesn't have?


Re: rehearsal marks, top-staff lyrics, and moved engravers

2022-06-01 Thread Werner LEMBERG


> Rehearsal and tempo marks should be aligned
> on the selected staff as if they were part of it, see attached
> example.

I forgot to also move `Metronome_mark_engraver` in my example, but it
doesn't make a visual difference here.


Werner



Re: Lilybin?

2022-06-01 Thread Paolo Prete
Hello,

FYI this editor completely works over the web:


https://github.com/paopre/Spontini


I hope someone will decide to host it...

Best,
P


On Wednesday, June 1, 2022, Kevin Cole  wrote:

> I hadn't heard of either LilyBin or HacLily.
>
> So... Basically Frescobaldi over the web, yes?
>
> Other than the collaborative, distributed nature -- which I can see as
> advantageous in some situations -- do they have features that Frescobaldi
> doesn't have?
>
>


Re: generate eps file from frecobaldi

2022-06-01 Thread WaiMing Tsang
Hi Simon Bailey, Silvain Dupertuis, David M. Boothe & Henning Hraban Ramm Thank you all for giving me suggestion. I am a window 10 user. I don’t know GIMP, Inkscape, I will search if these programs are available for window 10? Even if they are, learning curve will occurs. I knew to select eps output from Frecobaldi, but I was hopping I can use Frecobaldi to run commandline for lilypond. Thank you all again,Shalom,ming Sent from Mail for Windows 



Re: arbitrary repeat counter

2022-06-01 Thread Jean Abou Samra

Le 01/06/2022 à 12:25, Simon Bailey a écrit :

Hi,

with a little bit of digging through your manual, i have solved some
of my questions:

#(define (counter-stencil grob)
(let* ((counter (ly:grob-property grob 'text)))  ; get the value of
the counter
  (ly:stencil-aligned-to
(grob-interpret-markup grob
  (markup counter "!")) ; print the counter back with !
Y
CENTER)))

This basically replicates the behaviour of the regular percent counter
and adds an exclamation mark. so now i can just add some if/mod/div
magic and it should do what I want. Getting there… ;)




Well, you have two possible approaches. The one you sketch above is
the backend approach: override the measure counter's alignment so
it aligns within the first measure rather than the whole span.
The other is the translation approach: arrange to create the
counter so that it has the right bound you want from the start.
I think that is simpler in this case, so I'd do something like

\version "2.22.2"

newRepeatMarker = #(make-music 'MeasureCounterEvent 'mark-new-repeat #t)

repeatCounting =
#(define-music-function (n music) (index? ly:music?)
   #{
 \startMeasureCount
 \repeat unfold #n { \newRepeatMarker #music }
   #})

#(define (My_counter_engraver context)
   (let ((count 1)
 (count-here #f)
 (spanner #f)
 (spanner-to-end #f))
 (make-engraver
  (listeners
   ((measure-counter-event engraver event)
    (cond
 ((eqv? LEFT (ly:event-property event 'span-direction))
  (set! count 1))
 ((ly:event-property event 'mark-new-repeat #f)
  (set! count-here #t)
  ((process-music engraver)
   (if count-here
   (let ((col (ly:context-property context 'currentCommandColumn)))
 (set! spanner (ly:engraver-make-grob engraver 
'MeasureCounter '()))

 (ly:spanner-set-bound! spanner LEFT col)
 (ly:grob-set-property! spanner 'count-from count)
 (set! count (1+ count)
  (acknowledgers
   ((bar-line-interface engraver grob source-engraver)
    (if spanner-to-end
    (let ((col (ly:context-property context 
'currentCommandColumn)))

 (ly:spanner-set-bound! spanner-to-end RIGHT col)
 (ly:engraver-announce-end-grob engraver spanner-to-end '())
 (set! spanner-to-end #f)
  ((stop-translation-timestep engraver)
   (if spanner
   (set! spanner-to-end spanner))
   (set! spanner #f)
   (set! count-here #f)

\layout {
  \context {
    \Staff
    \consists #My_counter_engraver
  }
}

\new Staff \relative c' {
  \repeatCounting 4 { c4. 8 r4 8 r | d4. 4. 4 | 1 }
}


Best,
Jean




Start bookPart on even page

2022-06-01 Thread Simon Albrecht

Hi everybody,

it’s been a long time since I’ve used bookPart, it seems, and I don’t 
know how to search for an answer.


How can I allow Lily to start a bookPart on even pages? She will insert 
empty pages to avoid that.


Best, Simon




Re: Start bookPart on even page

2022-06-01 Thread Jean Abou Samra




Le 01/06/2022 à 15:08, Simon Albrecht a écrit :

Hi everybody,

it’s been a long time since I’ve used bookPart, it seems, and I don’t 
know how to search for an answer.


How can I allow Lily to start a bookPart on even pages? She will 
insert empty pages to avoid that.



Please give an example. For me, this produces two bookparts on pages 1 
and 2:


\version "2.22.2"

\bookpart { { c' } }
\bookpart { { c' } }


Jean





Re: generate eps file from frecobaldi

2022-06-01 Thread Silvain Dupertuis


Gimp and Inkscape are free and available in Windows, MacOs and Linux.

Le 01.06.22 à 14:30, WaiMing Tsang a écrit :


Hi Simon Bailey, Silvain Dupertuis, David M. Boothe &/Henning Hraban Ramm/

//

/Thank you all for giving me suggestion. I am a window 10 user. I don’t know GIMP, 
/Inkscape/, /


/I will search if these programs are available for window 10? Even if they are, learning 
curve will occurs. /


/I knew to select eps output from Frecobaldi, but I was hopping I can use Frecobaldi to 
run commandline for lilypond./


//

/Thank you all again,/

/Shalom,/

/ming/

Sent from Mail  for Windows



--
Silvain Dupertuis
Route de Lausanne 335
1293 Bellevue (Switzerland)
tél. +41-(0)22-774.20.67
portable +41-(0)79-604.87.52
web: silvain-dupertuis.org 

Re: arbitrary repeat counter

2022-06-01 Thread Simon Bailey
Hi Jean,

thanks for that example. Is it supposed to print any numbers? It's not
doing so in 2.23.9 (windows, frescobaldi).

I've come up with a slightly different approach, that's not quite
finished (and not as fancy as creating a new engraver):

#(set-object-property! 'phrase-length 'backend-type? integer?)
#(define (counter-stencil grob)
   (let* ((counter (string->number (ly:grob-property grob 'text)))
  (phrase-length (ly:grob-property grob 'phrase-length)))
 (if (and (eq? (modulo counter phrase-length) 1) (>= counter phrase-length))
 (ly:stencil-aligned-to
  (grob-interpret-markup grob
(markup (number->string (ceiling (/ counter phrase-length)
  Y
  CENTER

\relative c' {
  \set countPercentRepeats = ##t
  \override PercentRepeatCounter.phrase-length = 4
  \override PercentRepeatCounter.stencil = #counter-stencil
  \repeat percent 12 { c d e f }
}

I intend to wrap that in a music function that does all the override
magic and will take the music as a parameter (maybe work out the
phrase length from that, or pass it manually) and number of repeats.

Thanks, kind regards,
sb

On Wed, 1 Jun 2022 at 13:51, Jean Abou Samra  wrote:
>
> Le 01/06/2022 à 12:25, Simon Bailey a écrit :
> > Hi,
> >
> > with a little bit of digging through your manual, i have solved some
> > of my questions:
> >
> > #(define (counter-stencil grob)
> > (let* ((counter (ly:grob-property grob 'text)))  ; get the value of
> > the counter
> >   (ly:stencil-aligned-to
> > (grob-interpret-markup grob
> >   (markup counter "!")) ; print the counter back with !
> > Y
> > CENTER)))
> >
> > This basically replicates the behaviour of the regular percent counter
> > and adds an exclamation mark. so now i can just add some if/mod/div
> > magic and it should do what I want. Getting there… ;)
>
>
>
> Well, you have two possible approaches. The one you sketch above is
> the backend approach: override the measure counter's alignment so
> it aligns within the first measure rather than the whole span.
> The other is the translation approach: arrange to create the
> counter so that it has the right bound you want from the start.
> I think that is simpler in this case, so I'd do something like
>
> \version "2.22.2"
>
> newRepeatMarker = #(make-music 'MeasureCounterEvent 'mark-new-repeat #t)
>
> repeatCounting =
> #(define-music-function (n music) (index? ly:music?)
> #{
>   \startMeasureCount
>   \repeat unfold #n { \newRepeatMarker #music }
> #})
>
> #(define (My_counter_engraver context)
> (let ((count 1)
>   (count-here #f)
>   (spanner #f)
>   (spanner-to-end #f))
>   (make-engraver
>(listeners
> ((measure-counter-event engraver event)
>  (cond
>   ((eqv? LEFT (ly:event-property event 'span-direction))
>(set! count 1))
>   ((ly:event-property event 'mark-new-repeat #f)
>(set! count-here #t)
>((process-music engraver)
> (if count-here
> (let ((col (ly:context-property context 'currentCommandColumn)))
>   (set! spanner (ly:engraver-make-grob engraver
> 'MeasureCounter '()))
>   (ly:spanner-set-bound! spanner LEFT col)
>   (ly:grob-set-property! spanner 'count-from count)
>   (set! count (1+ count)
>(acknowledgers
> ((bar-line-interface engraver grob source-engraver)
>  (if spanner-to-end
>  (let ((col (ly:context-property context
> 'currentCommandColumn)))
>   (ly:spanner-set-bound! spanner-to-end RIGHT col)
>   (ly:engraver-announce-end-grob engraver spanner-to-end '())
>   (set! spanner-to-end #f)
>((stop-translation-timestep engraver)
> (if spanner
> (set! spanner-to-end spanner))
> (set! spanner #f)
> (set! count-here #f)
>
> \layout {
>\context {
>  \Staff
>  \consists #My_counter_engraver
>}
> }
>
> \new Staff \relative c' {
>\repeatCounting 4 { c4. 8 r4 8 r | d4. 4. 4 | 1 }
> }
>
>
> Best,
> Jean
>


-- 
Do not meddle in the affairs of trombonists, for they are subtle and
quick to anger.



Re: arbitrary repeat counter

2022-06-01 Thread Jean Abou Samra

Le 01/06/2022 à 15:50, Simon Bailey a écrit :

Hi Jean,

thanks for that example. Is it supposed to print any numbers? It's not
doing so in 2.23.9 (windows, frescobaldi).



I tested it with 2.22. There were some changes (by me) in
the internals of MeasureCounter in 2.23, so it needs to
be adapted a little:


\version "2.23.9"

newRepeatMarker = #(make-music 'MeasureCounterEvent 'mark-new-repeat #t)

repeatCounting =
#(define-music-function (n music) (index? ly:music?)
   #{
 \startMeasureCount
 \repeat unfold #n { \newRepeatMarker #music }
   #})

#(define (My_counter_engraver context)
   (let ((count 1)
 (count-here #f)
 (spanner #f)
 (spanner-to-end #f))
 (make-engraver
  (listeners
   ((measure-counter-event engraver event)
    (cond
 ((eqv? LEFT (ly:event-property event 'span-direction))
  (set! count 1))
 ((ly:event-property event 'mark-new-repeat #f)
  (set! count-here #t)
  ((process-music engraver)
   (if count-here
   (let ((col (ly:context-property context 'currentCommandColumn)))
 (set! spanner (ly:engraver-make-grob engraver 
'MeasureCounter '()))

 (ly:spanner-set-bound! spanner LEFT col)
 (ly:grob-set-property! spanner 'text (number->string 
count)) ;;; <== here

 (set! count (1+ count)
  (acknowledgers
   ((bar-line-interface engraver grob source-engraver)
    (if spanner-to-end
    (let ((col (ly:context-property context 
'currentCommandColumn)))

 (ly:spanner-set-bound! spanner-to-end RIGHT col)
 (ly:engraver-announce-end-grob engraver spanner-to-end '())
 (set! spanner-to-end #f)
  ((stop-translation-timestep engraver)
   (if spanner
   (set! spanner-to-end spanner))
   (set! spanner #f)
   (set! count-here #f)

\layout {
  \context {
    \Staff
    \consists #My_counter_engraver
  }
}

\new Staff \relative c' {
  \repeatCounting 4 { c4. 8 r4 8 r | d4. 4. 4 | 1 }
}




I've come up with a slightly different approach, that's not quite
finished (and not as fancy as creating a new engraver):

#(set-object-property! 'phrase-length 'backend-type? integer?)
#(define (counter-stencil grob)
(let* ((counter (string->number (ly:grob-property grob 'text)))
   (phrase-length (ly:grob-property grob 'phrase-length)))
  (if (and (eq? (modulo counter phrase-length) 1) (>= counter 
phrase-length))
  (ly:stencil-aligned-to
   (grob-interpret-markup grob
 (markup (number->string (ceiling (/ counter phrase-length)
   Y
   CENTER

\relative c' {
   \set countPercentRepeats = ##t
   \override PercentRepeatCounter.phrase-length = 4
   \override PercentRepeatCounter.stencil = #counter-stencil
   \repeat percent 12 { c d e f }
}

I intend to wrap that in a music function that does all the override
magic and will take the music as a parameter (maybe work out the
phrase length from that, or pass it manually) and number of repeats.




Yes, that works too. Good job :-)

Best,
Jean




Re: arbitrary repeat counter

2022-06-01 Thread Simon Bailey
On Wed, 1 Jun 2022 at 15:50, Jean Abou Samra  wrote:
> I tested it with 2.22. There were some changes (by me) in
> the internals of MeasureCounter in 2.23, so it needs to
> be adapted a little:
>


I'll test that in a moment.

> > I intend to wrap that in a music function that does all the override
> > magic and will take the music as a parameter (maybe work out the
> > phrase length from that, or pass it manually) and number of repeats.
>
>
>
> Yes, that works too. Good job :-)

A bit more work and I now have the following:

\version "2.23.9"
#(set-object-property! 'phrase-length 'backend-type? integer?)
#(define (counter-stencil grob)
   (let* ((counter (string->number (ly:grob-property grob 'text)))
  (phrase-length (ly:grob-property grob 'phrase-length)))
 (if (and (eq? (modulo counter phrase-length) 1) (>= counter phrase-length))
 (ly:stencil-aligned-to
  (grob-interpret-markup grob
(markup (number->string (ceiling (/ counter phrase-length)
  Y
  CENTER

\defineBarLine "!|" #'("!|" "" "!|")
repeatCounting =
#(define-music-function (n bar-length phrase-length music) (index?
ly:music? integer? ly:music?)
   #{
 <<
   \repeat unfold #n { #music \bar "!|" }
   {
 \set countPercentRepeats = ##t
 \hide PercentRepeat
 \override PercentRepeatCounter.phrase-length = #phrase-length
 \override PercentRepeatCounter.stencil = #counter-stencil
 \repeat percent #(* phrase-length n) { #bar-length }
   }
 >>
   #})

\new Staff \relative c' {
  \repeatCounting 4 s1 2 {c4 d e f | g f e d }
  \break c1
  \time 7/4
  \repeatCounting 4 s4*7 3 {c4 d e f r r r | g f e d r r r| c1 r2 r4 }
}

How can I find out the following two bits of information?

1. What is the duration of a measure dependent on the current time signature?
2. How long is a given musical expression (in measures or beats)?

If I can work out those two problems, then I could get rid of the two
extra parameters bar-length and phrase-length…

Thanks, kind regards,
sb
-- 
Do not meddle in the affairs of trombonists, for they are subtle and
quick to anger.



Re: arbitrary repeat counter

2022-06-01 Thread Jean Abou Samra

Le 01/06/2022 à 17:04, Simon Bailey a écrit :

A bit more work and I now have the following:

\version "2.23.9"
#(set-object-property! 'phrase-length 'backend-type? integer?)
#(define (counter-stencil grob)
(let* ((counter (string->number (ly:grob-property grob 'text)))
   (phrase-length (ly:grob-property grob 'phrase-length)))
  (if (and (eq? (modulo counter phrase-length) 1) (>= counter 
phrase-length))
  (ly:stencil-aligned-to
   (grob-interpret-markup grob
 (markup (number->string (ceiling (/ counter phrase-length)
   Y
   CENTER

\defineBarLine "!|" #'("!|" "" "!|")
repeatCounting =
#(define-music-function (n bar-length phrase-length music) (index?
ly:music? integer? ly:music?)
#{
  <<
\repeat unfold #n { #music \bar "!|" }
{
  \set countPercentRepeats = ##t
  \hide PercentRepeat
  \override PercentRepeatCounter.phrase-length = #phrase-length
  \override PercentRepeatCounter.stencil = #counter-stencil
  \repeat percent #(* phrase-length n) { #bar-length }
}
  >>
#})

\new Staff \relative c' {
   \repeatCounting 4 s1 2 {c4 d e f | g f e d }
   \break c1
   \time 7/4
   \repeatCounting 4 s4*7 3 {c4 d e f r r r | g f e d r r r| c1 r2 r4 }
}

How can I find out the following two bits of information?

1. What is the duration of a measure dependent on the current time signature?




In an engraver :-)

(ly:context-property context 'measureLength)

You can't get it in the music function, since timing is not
established at that point (just think that the time signature
could come from another element of a << >> construct, for
example).

Remember, though, that the time signature might change
in the middle of the repeat. Thus it will be a bit
more reliable to actually acknowledge the PercentRepeatCount
grobs and increment a counter whenever you see one.




2. How long is a given musical expression (in measures or beats)?



(ly:music-length your-music)


Best,
Jean




Re: not understanding the Al_Fine repeat feature of 2.23.9

2022-06-01 Thread Kenneth Wolcott
Thank you!  I got this piece to work now.  I just need to study this a
bit more, try another couple of pieces that have repeats like this.

On Wed, Jun 1, 2022 at 12:59 AM Jacques Menu  wrote:
>
> Hello Kenneth,
>
> Here is the way to do it. The :
>
>\volta 2 \fine
>
> should precede the note it applies to.
>
> JM
>
>
>
>
>
> > Le 29 mai 2022 à 01:59, Kenneth Wolcott  a écrit :
> >
> > Hi;
> >
> >  I tried to engrave a simple Tuba Duet that has a Fine+D.C. construct
> > using Lilypond 2.23.9
> >
> > I don't think I used the Al_Fine repeat feature correctly, as the
> > "Fine" is displayed one bar later than I expected it to be.
> >
> >  Could someone be so kind as to explain what I did wrong or what I
> > could do better?
> >
> >  Please see attachments (the original is from Rubank Intermediate
> > Method for Tuba).
> >
> > Thanks,
> > Ken Wolcott
> > 
>



Re: arbitrary repeat counter

2022-06-01 Thread Simon Bailey
On Wed, 1 Jun 2022 at 16:14, Jean Abou Samra  wrote:
> > 1. What is the duration of a measure dependent on the current time 
> > signature?
>
> In an engraver :-)
>
> (ly:context-property context 'measureLength)
>
> You can't get it in the music function, since timing is not
> established at that point (just think that the time signature
> could come from another element of a << >> construct, for
> example).
>
> Remember, though, that the time signature might change
> in the middle of the repeat. Thus it will be a bit
> more reliable to actually acknowledge the PercentRepeatCount
> grobs and increment a counter whenever you see one.

I actually tried that and ran into scheme problems (incrementing a
counter didn't seem to work).

> > 2. How long is a given musical expression (in measures or beats)?
>
> (ly:music-length your-music)
>

I think I might use your engraver ;)  But I've definitely learnt more
today. Thanks!

I did make one small change to your engraver:

(if (> count 1)
   (ly:grob-set-property! spanner 'text (number->string count))) ;;;
<== here

So that it only prints the numbers for repeated phrases.

Kind regards,
sb

-- 
Do not meddle in the affairs of trombonists, for they are subtle and
quick to anger.



Re: arbitrary repeat counter

2022-06-01 Thread Jean Abou Samra




Le 01/06/2022 à 18:04, Simon Bailey a écrit :

On Wed, 1 Jun 2022 at 16:14, Jean Abou Samra  wrote:

1. What is the duration of a measure dependent on the current time signature?

In an engraver :-)

(ly:context-property context 'measureLength)

You can't get it in the music function, since timing is not
established at that point (just think that the time signature
could come from another element of a << >> construct, for
example).

Remember, though, that the time signature might change
in the middle of the repeat. Thus it will be a bit
more reliable to actually acknowledge the PercentRepeatCount
grobs and increment a counter whenever you see one.

I actually tried that and ran into scheme problems (incrementing a
counter didn't seem to work).



What did not work? This is perfectly valid Scheme:

(set! count (1+ count))

In fact, it's in the code of my engraver.



2. How long is a given musical expression (in measures or beats)?

(ly:music-length your-music)


I think I might use your engraver ;)  But I've definitely learnt more
today. Thanks!



You're welcome. To be honest, and simplifying a bit, I had a
year of unsuccessful attempts to grasp Scheme before Urs'
Scheme tutorial made me learn as much of Scheme in 4 hours
as I had learnt in a year, then another year without that kind
of help to learn LilyPond internals, so if I've managed to write
something that is similarly turning a year into 4 hours for
you, I'm quite happy.

Best,
Jean




Re: arbitrary repeat counter

2022-06-01 Thread Simon Bailey
Hi,

On Wed, 1 Jun 2022 at 17:09, Jean Abou Samra - jean at abou-samra.fr
 wrote:
> What did not work? This is perfectly valid Scheme:
>
> (set! count (1+ count))

(set! counter (+ counter 1))

was giving an error message. Probably had some misaligned parentheses
or other weirdness. I didn't know about (1+ var) ;)

> You're welcome. To be honest, and simplifying a bit, I had a
> year of unsuccessful attempts to grasp Scheme before Urs'
> Scheme tutorial made me learn as much of Scheme in 4 hours
> as I had learnt in a year, then another year without that kind
> of help to learn LilyPond internals, so if I've managed to write
> something that is similarly turning a year into 4 hours for
> you, I'm quite happy.

Your readthedocs thing really helped; I still need to have a look at
Urs' tutorial. I did some functional programming sometime at the
beginning of the millenium, but 20yrs of OOP is a hard habit to break
;-)

A further definition:

repeatCountingWithTags = #(define-music-function (n music) (index? ly:music?)
  #{
<<
  \tag #'score \repeat unfold #n { #music }
  \tag #'part \repeatCounting #n { #music \bar "!|" }
>>
  #})

ebass = \relative c {
  \clef bass
  \time 7/4
  \repeatCountingWithTags 4 { c4. 8 r4 8 r c2. | d4. 4. 4 e2. | 1 r2 r4 | }
}

\new StaffGroup <<
  \new Staff \with { instrumentName = "Score" } \keepWithTag #'score \ebass
  \new Staff \with { instrumentName = "Part" } \keepWithTag #'part \ebass
>>
and I get the attached output, which is exactly what I want. And it
makes my input files so much easier to read and manage.

Thanks ever so much for your help!

Kind regards,
sb

-- 
Do not meddle in the affairs of trombonists, for they are subtle and
quick to anger.


Re: arbitrary repeat counter

2022-06-01 Thread Jean Abou Samra

Le 01/06/2022 à 18:19, Simon Bailey a écrit :

Hi,

On Wed, 1 Jun 2022 at 17:09, Jean Abou Samra - jean at abou-samra.fr
 wrote:

What did not work? This is perfectly valid Scheme:

(set! count (1+ count))

(set! counter (+ counter 1))

was giving an error message. Probably had some misaligned parentheses
or other weirdness. I didn't know about (1+ var) ;)


You're welcome. To be honest, and simplifying a bit, I had a
year of unsuccessful attempts to grasp Scheme before Urs'
Scheme tutorial made me learn as much of Scheme in 4 hours
as I had learnt in a year, then another year without that kind
of help to learn LilyPond internals, so if I've managed to write
something that is similarly turning a year into 4 hours for
you, I'm quite happy.

Your readthedocs thing really helped; I still need to have a look at
Urs' tutorial. I did some functional programming sometime at the
beginning of the millenium, but 20yrs of OOP is a hard habit to break
;-)



For what it's worth, while LilyPond's seldom uses it, Guile actually
has an object-oriented layer.

https://www.gnu.org/software/guile/manual/html_node/GOOPS.html

You may find yourself liking that. This shows that OOP is or
can be largely orthogonal to functional vs. imperative.




A further definition:

repeatCountingWithTags = #(define-music-function (n music) (index? ly:music?)
   #{
 <<
   \tag #'score \repeat unfold #n { #music }
   \tag #'part \repeatCounting #n { #music \bar "!|" }
 >>
   #})

ebass = \relative c {
   \clef bass
   \time 7/4
   \repeatCountingWithTags 4 { c4. 8 r4 8 r c2. | d4. 4. 4 e2. | 1 r2 r4 | }
}

\new StaffGroup <<
   \new Staff \with { instrumentName = "Score" } \keepWithTag #'score \ebass
   \new Staff \with { instrumentName = "Part" } \keepWithTag #'part \ebass
and I get the attached output, which is exactly what I want. And it
makes my input files so much easier to read and manage.

Thanks ever so much for your help!




Again, you're welcome.

Best,
Jean




Re: make \breath (kind-of) ignore clef change

2022-06-01 Thread Werner LEMBERG

David,


thanks for your code – I consider it quite an elegant solution.

> squashed =
>   \once \propertyTweak stencil
> #(grob-transformer 'stencil
>   (lambda (grob old)
>   (ly:stencil-aligned-to old X RIGHT)))
>   \etc
> 
> { 1 \breathe |  }
> 
> { 1 \breathe \squashed Staff.Clef \clef alto |  }

This code might serve as an example for `\propertyTweak`, which the NR
is currently missing.

Would you care to submit an MR, expanding the documentation
accordingly?


Werner


Re: arbitrary repeat counter

2022-06-01 Thread Jean Abou Samra

Le 01/06/2022 à 19:03, Simon Bailey a écrit :

Here's a weird one. Using this definition in the c,-octave, I get a
really weird output. Each note in the music drops down an octave. In
the c-octave, it works normally. Using the untagged version of
\repeatCounting doesn't show this issue in either octave.
Any ideas?



Ah, yes. Here's a definition that already works better:

repeatCountingWithTags = #(define-music-function (n music) (index? 
ly:music?)

  #{
    <<
  \tag #'score \repeat unfold #n { $music }
  \tag #'part \repeatCounting #n { $music \bar "!|" }
    >>
  #})


Namely, it uses $music instead of #music. More details
are here:
https://extending-lilypond.readthedocs.io/en/latest/lily-and-scheme.html#hash-vs-dollar
and here:
https://extending-lilypond.readthedocs.io/en/latest/music.html#copying-music
Basically, for the sake of efficiency, all music functions
are allowed to mutate their input. When you do \variable
in LilyPond code, this actually makes a deep copy of the
content of the variable (at least if it's a music object).
That way, users don't have surprises with music objects
shared between several locations, and music functions can
freely mutate music objects they receive. What's happening
here is that in order to interpret the relative octaves,
\relative walks in the music and converts the pitches
to absolute as needed. In this case, the pitches end up
on the octave of "c,". After that's done on the first
part tagged with #'score, it's done again on the second
one, which shares identity with the first and thus contains
lots of "d,", which get interpreted by \relative as lowering
the octave at every note.

Still, this isn't ideal because it doesn't work on something
like

\repeatCountingWithTags n { d' d }

as that translates to

<<
  \tag #'score \repeat unfold n { d' d }
  \tag #'part { [...] \repeat unfold n { [...] d' d } }
>>

and the second time the music occurs is affected by the
relative octave that the first time left. Of course, you
can fix it by playing with the pitches yourself in the
Scheme code. It's much simpler, however, to rewrite
this definition so that the argument gets just once
into the output. Giving:


\version "2.23.9"

#(define (Phrase_counter_engraver context)
   (let ((count 1)
 (count-here #f)
 (spanner #f)
 (spanner-to-end #f))
 (make-engraver
  (listeners
   ((measure-counter-event engraver event)
    (cond
 ((eqv? LEFT (ly:event-property event 'span-direction))
  (set! count 1))
 ((ly:event-property event 'mark-new-repeat #f)
  (set! count-here #t)
  ((process-music engraver)
   (if count-here
   (let ((col (ly:context-property context 'currentCommandColumn)))
 (set! spanner (ly:engraver-make-grob engraver 
'MeasureCounter '()))

 (ly:spanner-set-bound! spanner LEFT col)
 (if (> count 1)
   (ly:grob-set-property! spanner 'text (number->string 
count))) ;;; <== here

 (set! count (1+ count)
  (acknowledgers
   ((bar-line-interface engraver grob source-engraver)
    (if spanner-to-end
    (let ((col (ly:context-property context 
'currentCommandColumn)))

  (ly:spanner-set-bound! spanner-to-end RIGHT col)
  (ly:engraver-announce-end-grob engraver spanner-to-end '())
  (set! spanner-to-end #f)
  ((stop-translation-timestep engraver)
   (if spanner
   (set! spanner-to-end spanner))
   (set! spanner #f)
   (set! count-here #f)

\layout {
  \context {
    \Staff
    \consists #Phrase_counter_engraver
  }
}

newRepeatMarker = #(make-music 'MeasureCounterEvent 'mark-new-repeat #t)

\defineBarLine "!|" #'("!|" "" " |")

repeatCounting =
#(define-music-function (n music) (index? ly:music?)
   #{
 \startMeasureCount
 \repeat unfold #n { \newRepeatMarker #music }
   #})

repeatCountingWithTags = #(define-music-function (n music) (index? 
ly:music?)

  #{
    \tag #'part \startMeasureCount
    \repeat unfold #n {
  \tag #'part \newRepeatMarker
  $music
    }
  #})


ebass = \relative c, {
  \clef "bass_8"
  d4. d8 r4 d8 r | r8 d r4 d f8 g  | %45-46
  \repeatCountingWithTags 2 { d4. d8 r4 d8 r | r8 d r4 d8 r c4 | }
  %\octaveCheck c,
  d4. d8 r4 d8 r | r8 d r4 d f8 g  | %45-46
  \repeatCounting 2 { d4. d8 r4 d8 r | r8 d r4 d8 r c4 | }
}

ebassUp = \relative c {
  \clef "bass"
  d4. d8 r4 d8 r | r8 d r4 d f8 g  | %45-46
  \repeatCountingWithTags 2 { d4. d8 r4 d8 r | r8 d r4 d8 r c4 | }
  \octaveCheck c
  d4. d8 r4 d8 r | r8 d r4 d f8 g  | %45-46
  \repeatCounting 2 { d4. d8 r4 d8 r | r8 d r4 d8 r c4 | }
  %\repeatCounting 2 { d4. d8 r4 d8 r | r8 d r4 d8 r c4 | }
}

\new StaffGroup <<
  \new Staff \with { instrumentName = "Up" } \keepWithTag #'score \ebass
  \new Staff \with { instrumentName = "Low" } \keepWithTag #'part \ebass
>>


Best,
Jean







bookTitleMarkup and tocItem cause empty page

2022-06-01 Thread Simon Albrecht

Hi Jean,

On 01/06/2022 15:24, Jean Abou Samra wrote:


Please give an example.



I’ve gone debugging, and it’s a weird combination of two things that 
causes the empty page:


%%%
\version "2.23.9"

\paper {
  bookTitleMarkup = \markup {
    \vspace #.3
  }
}

\bookpart { \markup { 1 } }

\tocItem \markup "toc2"
\bookpart { \markup { 2 } }
%

I don’t understand… in my real-world book, the empty pages were empty, 
now in this tiny example the second bookpart appears to get duplicated, 
and this only because the bookTitleMarkup contains _anything_ other than 
empty \fromproperty calls. Even \markup\null as bookTitleMarkup has the 
bug (?) occurring.


Best, Simon




Re: make \breath (kind-of) ignore clef change

2022-06-01 Thread David Kastrup
Werner LEMBERG  writes:

> David,
>
>
> thanks for your code – I consider it quite an elegant solution.
>
>> squashed =
>>   \once \propertyTweak stencil
>> #(grob-transformer 'stencil
>>   (lambda (grob old)
>>   (ly:stencil-aligned-to old X RIGHT)))
>>   \etc
>> 
>> { 1 \breathe |  }
>> 
>> { 1 \breathe \squashed Staff.Clef \clef alto |  }
>
> This code might serve as an example for `\propertyTweak`, which the NR
> is currently missing.
>
> Would you care to submit an MR, expanding the documentation
> accordingly?

Frankly, I have no idea what I am actually doing there with the
ly:stencil-aligned-to .  I was just fudging around until something fell
out that looked like what you wanted to be doing.  So "\squashed" is
actually a misnomer from the first attempt where I just thought I'd
shrink stuff (which did not work).

So while the technique for diddling with a stencil is programmed in a
straightforward manner, I have no clue about the underlying core action.

-- 
David Kastrup



Re: make \breath (kind-of) ignore clef change

2022-06-01 Thread Jean Abou Samra

Le 01/06/2022 à 21:50, David Kastrup a écrit :

Frankly, I have no idea what I am actually doing there with the
ly:stencil-aligned-to . I was just fudging around until something fell
out that looked like what you wanted to be doing. So "\squashed" is
actually a misnomer from the first attempt where I just thought I'd
shrink stuff (which did not work).
So while the technique for diddling with a stencil is programmed in a
straightforward manner, I have no clue about the underlying core action.



https://lilypond.org/doc/v2.23/Documentation/internals/breathingsign
indicates that BreathingSign.space-alist.time-signature defaults to
#'(minimum-space . 1.5). The minimum-space spacing style is
defined by this in break-alignment-interface.cc:

  /* should probably junk minimum-space */
  else if (scm_is_eq (type, ly_symbol2scm ("minimum-space")))
    offsets[next_idx] = std::max (extents[idx][RIGHT], distance);

Namely, it measures the minimum distance from the left
grob's X reference point to the right grob's, with
care to ensure that the right grob's reference point
is not further to the left than the right of the
left grob's extent. If the extent of the grob on the
right sticks out to the left, that part isn't taken
into account. So you're effectively making that distance
measured to the right of the time signature rather than
to the left.

I'm not sure why this takes into account the right
endpoint of the extent on the left but not the left
endpoint of the extent on the right. I think it
might just be assuming that all break-aligned grobs
have an extent starting at 0.





Re: make \breath (kind-of) ignore clef change

2022-06-01 Thread Jean Abou Samra

Le 01/06/2022 à 20:07, Werner LEMBERG a écrit :


This code might serve as an example for `\propertyTweak`, which the NR
is currently missing.

Would you care to submit an MR, expanding the documentation
accordingly?



I'm not sure if the NR is the best place for explaining
\propertyTweak. Its usefulness is basically to be a helper
for defining "dual" commands like \shape, \footnote, \omit,
or (in 2.23) \parenthesize. In essence, it has the semantics:

\propertyTweak property  [Context.]Grob   → \override 
[Context.]Grob.property = 
\propertyTweak property    → \tweak property 
 


Is that useful to know for Joe User? I wonder if it should
go in the extending manual instead.

On the other hand, I still have a branch for that two-part
patch of which only one part made it to master so far,
reorganizing the "Changing defaults" part of the NR.
I put it in the NR in that patch, because I was already
explaining lots of other commands (\single, etc.)




Re: bookTitleMarkup and tocItem cause empty page

2022-06-01 Thread Jean Abou Samra

Le 01/06/2022 à 21:12, Simon Albrecht a écrit :

Hi Jean,

On 01/06/2022 15:24, Jean Abou Samra wrote:


Please give an example.



I’ve gone debugging, and it’s a weird combination of two things that 
causes the empty page:


%%%
\version "2.23.9"

\paper {
  bookTitleMarkup = \markup {
    \vspace #.3
  }
}

\bookpart { \markup { 1 } }

\tocItem \markup "toc2"
\bookpart { \markup { 2 } }
%

I don’t understand… in my real-world book, the empty pages were empty, 
now in this tiny example the second bookpart appears to get 
duplicated, and this only because the bookTitleMarkup contains 
_anything_ other than empty \fromproperty calls. Even \markup\null as 
bookTitleMarkup has the bug (?) occurring.




OK, opened https://gitlab.com/lilypond/lilypond/-/issues/6358
about that. The thing is, \tocItem works by inserting a label
at the point it is being used. Since the label is a standalone
object between two bookparts, it is being made a bookpart
of its own! Without a title, that bookpart has no pages, but
if you have a title, it becomes visible ...

As said on the ticket, you need to move \tocItem inside
the second bookpart, like this:

\version "2.23.9"

\paper {
  bookTitleMarkup = \markup {
    \vspace #.3
  }
}

\bookpart { \markup { 1 } }

\bookpart {
  \tocItem \markup "toc2"
  \markup { 2 }
}


Best,
Jean





Re: make \breath (kind-of) ignore clef change

2022-06-01 Thread Werner LEMBERG


> I'm not sure why this takes into account the right endpoint of the
> extent on the left but not the left endpoint of the extent on the
> right.  I think it might just be assuming that all break-aligned
> grobs have an extent starting at 0.

Or maybe it's simply a thinko...


Werner



Re: make \breath (kind-of) ignore clef change

2022-06-01 Thread Werner LEMBERG

>> This code might serve as an example for `\propertyTweak`, which the
>> NR is currently missing.
>>
>> Would you care to submit an MR, expanding the documentation
>> accordingly?
> 
> I'm not sure if the NR is the best place for explaining
> \propertyTweak.  Its usefulness is basically to be a helper for
> defining "dual" commands like \shape, \footnote, \omit, or (in 2.23)
> \parenthesize.  In essence, it has the semantics:
> 
> \propertyTweak property  [Context.]Grob   → \override 
> [Context.]Grob.property = 
> \propertyTweak property    → \tweak property  
> 
> 
> Is that useful to know for Joe User?

I'd say yes, because it doesn't use Scheme code.


Werner


Re: bookTitleMarkup and tocItem cause empty page

2022-06-01 Thread Simon Albrecht

Hi Jean,

On 01/06/2022 22:41, Jean Abou Samra wrote:

As said on the ticket, you need to move \tocItem inside
the second bookpart,



thanks for looking into it and opening the issue. The workaround is 
inconvenient, because I want to have the \bookpart{} statement in an 
include file for use in different contexts, but I guess I’ll have to 
make it work for now.


Best, Simon




Left-hand end of tuplet bracket sometimes wrong

2022-06-01 Thread Paul Hodges
Both Ross (p161) and Gould (p195) are completely clear when they say that the 
left hand end of a tuplet bracket aligns with the left-hand side of the first 
note.


However, LilyPond doesn't always do this - instead, if the first note has an 
up-stem, the bracket is aligned with the stem instead.


Is there a reason for this?  And is there a way to correct this globally, or do 
I have to tweak shorten-pair for each affected instance?


Paul