Re: remove key change at end of line

2024-03-25 Thread bobr...@centrum.is
That did the trick! Thank you, Xavier. 

> From: "Xavier Scheuer" 
> To: "bobroff" 
> Cc: "Lillypond Users Mailing List" 
> Sent: Monday, March 25, 2024 9:37:38 PM
> Subject: Re: remove key change at end of line

> On Mon, 25 Mar 2024 at 22:19, [ mailto:bobr...@centrum.is | 
> bobr...@centrum.is ]
> < [ mailto:bobr...@centrum.is | bobr...@centrum.is ] > wrote:

>> I want to remove a key change from the ends of lines/systems. I am *not*
>> referring to just key cancellation, which I do also want. I mean, at the end 
>> of
>> a line the new key should not appear before the new line. I haven't worked it
> > out.

> Hello,

> \set Staff.explicitKeySignatureVisibility = #end-of-line-invisible

> See NR 5.4.7 Visibility of objects > Special considerations
> [
> https://lilypond.org/doc/v2.24/Documentation/notation/visibility-of-objects#special-considerations
> |
> https://lilypond.org/doc/v2.24/Documentation/notation/visibility-of-objects#special-considerations
> ]

> Kind regards,
> Xavier


Re: remove key change at end of line

2024-03-25 Thread Xavier Scheuer
On Mon, 25 Mar 2024 at 22:19, bobr...@centrum.is  wrote:
>
> I want to remove a key change from the ends of lines/systems.  I am *not*
referring to just key cancellation, which I do also want.  I mean, at the
end of a line the new key should not appear before the new line.  I haven't
worked it out.

Hello,

\set Staff.explicitKeySignatureVisibility = #end-of-line-invisible

See NR 5.4.7 Visibility of objects > Special considerations
https://lilypond.org/doc/v2.24/Documentation/notation/visibility-of-objects#special-considerations

Kind regards,
Xavier


Re: remove key change at end of line

2024-03-25 Thread Aaron Hill

On 2024-03-25 2:18 pm, bobr...@centrum.is wrote:
I want to remove a key change from the ends of lines/systems. I am 
*not* referring to just key cancellation, which I do also want. I mean, 
at the end of a line the new key should not appear before the new line. 
I haven't worked it out.



Shouldn't it be nothing more than setting break-visibility to 
'end-of-line-invisible?


https://lilypond.org/doc/v2.25/Documentation/notation/using-break_002dvisibility


-- Aaron Hill



remove key change at end of line

2024-03-25 Thread bobr...@centrum.is
I want to remove a key change from the ends of lines/systems. I am *not* 
referring to just key cancellation, which I do also want. I mean, at the end of 
a line the new key should not appear before the new line. I haven't worked it 
out. 

-David 


Re: Can't compile Lilypond files

2024-03-25 Thread Valentin Petzel
Hello David,

great that things worked out. Instead of putting a script at /usr/bin/lilypond 
which calls ~/bin/lilypond you could also create a symlink. Also modern Linux 
setups should have ~/.local/bin in PATH by default, so if the reason is only 
to be able to call `lilypond` without path adding a symlink or script there 
should be enough.

Cheers,
Valentin

signature.asc
Description: This is a digitally signed message part.


Re: LilyPond 2.25.14

2024-03-25 Thread Mathieu Demange
Hello,

Here are my results for MSDM.ly  on a M2 Max MacBook Pro:

real 12.11
user 11.02
sys 1.06

Thanks a lot!

Mathieu

Re: nested \set ?

2024-03-25 Thread Valentin Petzel
Hello Werner,

properties handle this by having internally not a single value, but a list of 
values, and
temporary overriding simply means adding to that list. Context properties do 
currently
not allow for this mechanic, but we could simulate it ourselves:

#(set-object-property! 'details
   'translation-type?
   list?)

tset =
#(define-music-function (path value)
   (key-list? scheme?)
   (if (= (length path) 1) (set! path (cons 'Voice path)))
   (context-spec-music
(make-music 'ApplyContext
'procedure
(lambda (ctx)
  (let* ((details (ly:context-property ctx 'details))
 (this-hierarchy (assoc-get (cadr path) details '()))
 (this-val (ly:context-property ctx (cadr path
(ly:context-set-property! ctx
  'details
  (assoc-set!
   details
   (cadr path)
   (cons this-val this-hierarchy)))
(ly:context-set-property! ctx (cadr path) value
(car path)))

rset =
#(define-music-function (path)
   (key-list?)
   (if (= (length path) 1) (set! path (cons 'Voice path)))
   (context-spec-music
(make-music 'ApplyContext
'procedure
(lambda (ctx)
  (let* ((details (ly:context-property ctx 'details))
 (this-hierarchy (assoc-get (cadr path) details '(
(if (null? this-hierarchy)
(ly:context-unset-property ctx (cadr path))
(begin
 (ly:context-set-property! ctx (cadr path) (car 
this-hierarchy))
 (ly:context-set-property! ctx
   'details
   (assoc-set!
details
(cadr path)
(cdr this-hierarchy
(car path)))

{
  \set Staff.middleCPosition = 0
  c1
  \set Staff.middleCPosition = 1
  c1
  \unset Staff.middleCPosition
  c1
  
  \break
  
  \tset Staff.middleCPosition 0
  c1
  \tset Staff.middleCPosition 1
  c1
  \rset Staff.middleCPosition
  c1
  \rset Staff.middleCPosition
  c1
}

Cheers,
Valentin

Am Montag, 25. März 2024, 08:31:34 CET schrieb Werner LEMBERG:
> LilyPond provides `\temporary` and `\revert` to set a grob property
> temporarily, and afterwards the value of the grob property is the same
> as before.
> 
> Is there a similar possiblity for `\set` (or something usable in
> Scheme)?  I guess not, but I couldn't find this documented
> somewhere...
> 
> 
> Werner



signature.asc
Description: This is a digitally signed message part.


Re: nested \set ?

2024-03-25 Thread Werner LEMBERG

>> LilyPond provides `\temporary` and `\revert` to set a grob property
>> temporarily, and afterwards the value of the grob property is the
>> same as before.
>> 

>> Is there a similar possiblity for `\set` (or something usable in
>> Scheme)?  I guess not, but I couldn't find this documented
>> somewhere...
> 
> No, this doesn't exist OOTB. It could be implemented with a Scheme
> engraver, but that would probably be overkill, unless for some
> reason it's really important for what you're trying to do?

I was wondering whether there exists a solution to issue #4651 – the
suggested code there doesn't work, unfortunately – removing the beam
stencil might lead to missing flags if auto-beaming is active.

Perhaps I could iterate over the music, emitting `\once \autoBeamOn`
for every element?


Werner


Re: nested \set ?

2024-03-25 Thread Aaron Hill

On 2024-03-25 4:13 am, Jean Abou Samra wrote:

No, this doesn't exist OOTB. It could be implemented with a
Scheme engraver, but that would probably be overkill, unless
for some reason it's really important for what you're trying
to do?



Here's a simple non-engraver way to potentially get close:


\version "2.25.13"

#(define context-stack '())

#(define (context-stack-find property)
  (ly:assoc-get property context-stack '()))

#(define (context-stack-push! property value)
  (set! context-stack
(assoc-set! context-stack property
  (cons value (context-stack-find property)

#(define (context-stack-pop! property)
  (let ((stack (context-stack-find property)))
(if (null? stack) '()
(let ((value (car stack)) (rest (cdr stack)))
  (set! context-stack
(if (null? rest)
  (assoc-remove! context-stack property)
  (assoc-set! context-stack property rest)))
  value

push =
#(define-music-function
  (property value)
  (symbol? scheme?)
  (define (proc ctxt)
(let ((value (ly:context-property ctxt property '(
  (or (null? value)
(context-stack-push! property value)))
(ly:context-set-property! ctxt property value)
;; (format #t "~a\n" context-stack)
  )
  #{ \applyContext #proc #})

pop =
#(define-music-function
  (property)
  (symbol?)
  (define (proc ctxt)
(let ((value (context-stack-pop! property)))
  (if (null? value)
(ly:context-unset-property ctxt property)
(ly:context-set-property! ctxt property value)))
;; (format #t "~a\n" context-stack)
  )
  #{ \applyContext #proc #})

{
  \repeat unfold 8 b'8
  %% This example involves a property
  %% that already has a value set...
  \push autoBeaming ##f
  \repeat unfold 8 b'8
  \pop autoBeaming
  \repeat unfold 8 b'8
}

{
  \repeat unfold 2 { 4( ) }
  %% This example involves a property
  %% that was unset initially...
  \push doubleSlurs ##t
  \repeat unfold 2 { 4( ) }
  \pop doubleSlurs
  \repeat unfold 2 { 4( ) }
}


It is probably missing some edge case handling, and certainly the 
`context-stack` should itself be stored within the context rather than 
just some arbitrary global variable.  Another issue would be not 
handling the extended \set syntax as in, say, `\set Score.skipBars = 
##t`.  The property argument would need to become a `key-list?` with the 
appropriate handling to redirect to another named context.



-- Aaron Hill



Re: nested \set ?

2024-03-25 Thread Werner LEMBERG
> > Yes, thanks, but this is not what I'm looking after: At the start
> > of my function (created with `define-music-function`),
> > `\autoBeamOff` gets called (i.e., the `autoBeaming` context
> > variable is set to `##t`), and after the function returns the
> > previous value of `autoBeaming` should be restored.
> > 
> >> Not sure why \temporary wouldn’t/shouldn’t, although I must admit
> >> I couldn’t find the right incantation…
> > 
> > It doesn't work, I've tested it.  Maybe I made a mistake,
> > though...
>
> My Lilypond knowledge is small but have you tried the "\unset"
> command ??

`\unset` restores the default value of a context property, it doesn't
revert a set value.

Example:

```
\relative c'' {
  \set autoBeaming = ##f
  c8 c c c
  \set autoBeaming = ##t
  c8 c c c
  \unset autoBeaming
  c8 c c c
}
```


Werner


Re: nested \set ?

2024-03-25 Thread Jean Abou Samra
> My Lilypond knowledge is small but have you tried the "\unset" command ??


\unset will simply remove the value. Werner is looking for
something that resets the previous value.





signature.asc
Description: This is a digitally signed message part


Re: Snippet: Adding indicators to staves which split after a break

2024-03-25 Thread Kevin Pye
>> The easy question. The fourth line of the snippet reads:
>>(PI_OVER_180 (/ (atan2 1 1) 34))
>> Surely that “34” should be “45”.
>
> Did you try changing it?  ;)

Yes. It breaks things slightly. I need to dive further down the rabbit-hole to 
work out why.

>> The more difficult question. This snippet adds two arrows to the bar line at 
>> the end of the staff. I have a case where there is a key change at the end 
>> of the staff where I'd like to put the indicator, and so the bar line is not 
>> at the end of the staff. The snippet dutifully adds arrows to the bar line, 
>> which conflict with the new key signature. Is there a way to move the arrows 
>> to the end of the staff, rather than on the bar line?
>
> I have a modified version (included below) which handles TimeSignature 
> — you can likely adjust it to handle KeySignature as you want it to!
[script deleted]
> Hope this helps!
I'm sure it will; it should be a good exercise in improving my almost 
non-existent Scheme skills.

Thanks,

Kevin.



Re: nested \set ?

2024-03-25 Thread Jean Abou Samra
Le lundi 25 mars 2024 à 07:31 +, Werner LEMBERG a écrit :
> LilyPond provides `\temporary` and `\revert` to set a grob property
> temporarily, and afterwards the value of the grob property is the same
> as before.
> 
> Is there a similar possiblity for `\set` (or something usable in
> Scheme)?  I guess not, but I couldn't find this documented
> somewhere...


No, this doesn't exist OOTB. It could be implemented with a
Scheme engraver, but that would probably be overkill, unless
for some reason it's really important for what you're trying
to do?




signature.asc
Description: This is a digitally signed message part


Re: nested \set ?

2024-03-25 Thread Sebastien Richard
Hello,

My Lilypond knowledge is small but have you tried the "\unset" command ??

BR,

---
 Sébastien RICHARD



From: lilypond-user-bounces+richardsgjm=hotmail@gnu.org 
 on behalf of Werner 
LEMBERG 
Sent: Monday, March 25, 2024 11:12
To: kie...@kierenmacmillan.info 
Cc: lilypond-user@gnu.org 
Subject: Re: nested \set ?


>> LilyPond provides `\temporary` and `\revert` to set a grob property
>> temporarily, and afterwards the value of the grob property is the
>> same as before.
>>
>> Is there a similar possiblity for `\set` (or something usable in
>> Scheme)?  I guess not, but I couldn't find this documented
>> somewhere...
>
> \once certainly works: [...]

Yes, thanks, but this is not what I'm looking after: At the start of
my function (created with `define-music-function`), `\autoBeamOff`
gets called (i.e., the `autoBeaming` context variable is set to
`##t`), and after the function returns the previous value of
`autoBeaming` should be restored.

> Not sure why \temporary wouldn’t/shouldn’t, although I must admit I
> couldn’t find the right incantation…

It doesn't work, I've tested it.  Maybe I made a mistake, though...


Werner


Re: nested \set ?

2024-03-25 Thread Werner LEMBERG

>> LilyPond provides `\temporary` and `\revert` to set a grob property
>> temporarily, and afterwards the value of the grob property is the
>> same as before.
>> 
>> Is there a similar possiblity for `\set` (or something usable in
>> Scheme)?  I guess not, but I couldn't find this documented
>> somewhere...
> 
> \once certainly works: [...]

Yes, thanks, but this is not what I'm looking after: At the start of
my function (created with `define-music-function`), `\autoBeamOff`
gets called (i.e., the `autoBeaming` context variable is set to
`##t`), and after the function returns the previous value of
`autoBeaming` should be restored.

> Not sure why \temporary wouldn’t/shouldn’t, although I must admit I
> couldn’t find the right incantation…

It doesn't work, I've tested it.  Maybe I made a mistake, though...


Werner


Re: Snippet: Adding indicators to staves which split after a break

2024-03-25 Thread Kieren MacMillan
Hi Kevin,

> I have two questions about this snippet:

You forgot to include the snippet or a link! :)
But I assume you mean 
https://lilypond.org/doc/v2.25/Documentation/snippets/vocal-music_003a-adding-indicators-to-staves-which-get-split-after-a-break

> The easy question. The fourth line of the snippet reads:
>(PI_OVER_180 (/ (atan2 1 1) 34))
> Surely that “34” should be “45”.

Did you try changing it?  ;)

> The more difficult question. This snippet adds two arrows to the bar line at 
> the end of the staff. I have a case where there is a key change at the end of 
> the staff where I'd like to put the indicator, and so the bar line is not at 
> the end of the staff. The snippet dutifully adds arrows to the bar line, 
> which conflict with the new key signature. Is there a way to move the arrows 
> to the end of the staff, rather than on the bar line?

I have a modified version (included below) which handles TimeSignature — you 
can likely adjust it to handle KeySignature as you want it to!

Hope this helps!
Kieren.

p.s. It would be amazing if this were more automatic (i.e., it handled all 
possible end-of-staff grobs/situations), adjustable (e.g., had parameters for 
arrow angle, padding, etc.), and built into Lilypond basecode — I just don’t 
have time to climb the various learning curves and put together a patch 
currently.  :(
_

  SNIPPET BEGINS
\version "2.25.11"

\layout {
  \context {
\Score
\remove Bar_number_engraver
  }
}

#(define-markup-command (arrow-at-angle layout props angle length fill)
  (number? number? boolean?)
  (ly:stencil-rotate
(interpret-markup layout props
  (markup #:concat (#:draw-line (cons length 0)
#:hspace -0.1
#:arrow-head X RIGHT fill)))
angle -1 0))

arrowUpMarkup = \markup \concat { \hspace #0.375 \override #'(thickness . 1.5) 
\arrow-at-angle #30 #(sqrt 4) ##t }
arrowDownMarkup = \markup \concat { \hspace #0.375 \override #'(thickness . 
1.5) \arrow-at-angle #-30 #(sqrt 4) ##t }

staffSplitMarkup =
\markup
  \with-dimensions #'(0 . 0) #'(0 . 0)
  \combine
\raise #0.4 \arrowUpMarkup
\lower #0.4 \arrowDownMarkup

staffSplit = #(define-music-function (grob-name) (string?)
  #{ { \once \override Staff.$grob-name #'stencil =
  #(grob-transformer 'stencil (lambda (grob orig)
(if (= LEFT (ly:item-break-dir grob))
  (ly:stencil-combine-at-edge
orig X RIGHT
(grob-interpret-markup grob staffSplitMarkup)
(if (equal? "TimeSignature" grob-name) 0.5 0))
  orig)))
\break } #} )

staffConvergeDown = #(define-music-function (grob-name) (string?)
  #{ { \once \override Staff.$grob-name #'stencil =
  #(grob-transformer 'stencil (lambda (grob orig)
(if (= LEFT (ly:item-break-dir grob))
  (ly:stencil-combine-at-edge
orig X RIGHT
(grob-interpret-markup grob #{
  \markup
\with-dimensions #'(0 . 0) #'(0 . 0)
\arrowDownMarkup #})
(if (equal? "TimeSignature" grob-name) 0.5 0))
  orig)))
\break } #} )

staffConvergeUp = #(define-music-function (grob-name) (string?)
  #{ { \once \override Staff.$grob-name #'stencil =
  #(grob-transformer 'stencil (lambda (grob orig)
(if (= LEFT (ly:item-break-dir grob))
  (ly:stencil-combine-at-edge
orig X RIGHT
(grob-interpret-markup grob #{
  \markup
\with-dimensions #'(0 . 0) #'(0 . 0)
\arrowUpMarkup #})
(if (equal? "TimeSignature" grob-name) 0.5 0))
  orig)))
\break } #} )


upper = {
  c'1 \break
  c'1 \staffConvergeDown "BarLine" \break
  c'1 \staffConvergeDown "TimeSignature" \time 3/2 \break
  c'1.
}

lower = {
  c'1 \break
  c'1 \staffConvergeUp "BarLine" \break
  c'1 \staffConvergeUp "TimeSignature" \break
  c'1. \break
}

\new ChoirStaff <<
  \new Staff \upper
  \new Staff \lower
>>
  SNIPPET ENDS
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: nested \set ?

2024-03-25 Thread Kieren MacMillan
Hi Werner,

> LilyPond provides `\temporary` and `\revert` to set a grob property
> temporarily, and afterwards the value of the grob property is the same
> as before.
> 
> Is there a similar possiblity for `\set` (or something usable in
> Scheme)?  I guess not, but I couldn't find this documented
> somewhere...

\once certainly works:

  SNIPPET BEGINS
\version "2.25.11"

\paper { indent = 0\in left-margin = 1\in }

music = {
  \override Staff.InstrumentName.padding = 2
  \set Staff.shortInstrumentName = "actual"
  c'1 \break c'1
  \once \set Staff.shortInstrumentName = "temp" \break
  c'1 \break
  c'1
}

\score { \music }
  SNIPPET ENDS

Not sure why \temporary wouldn’t/shouldn’t, although I must admit I couldn’t 
find the right incantation…

Cheers,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Snippet: Adding indicators to staves which split after a break

2024-03-25 Thread Kevin Pye
I have two questions about this snippet:

The easy question. The fourth line of the snippet reads:
   (PI_OVER_180 (/ (atan2 1 1) 34))
Surely that “34” should be “45”.

The more difficult question. This snippet adds two arrows to the bar line at 
the end of the staff. I have a case where there is a key change at the end of 
the staff where I'd like to put the indicator, and so the bar line is not at 
the end of the staff. The snippet dutifully adds arrows to the bar line, which 
conflict with the new key signature. Is there a way to move the arrows to the 
end of the staff, rather than on the bar line?

Thanks,

Kevin.


Re: Can't compile Lilypond files

2024-03-25 Thread Raphael Mankin




On 24/03/2024 21:26, David Sumbler wrote:

On Sun, 2024-03-24 at 21:55 +0100, Lukas-Fabian Moser wrote:

[snip]


What I don't understand is why or how it always used to work, but I 
suppose there's no point in worrying about that.


I have lost count of the number of projects over the past several 
decades in which I have asked that same question.



Anyway, thanks for finding the solution!

David


--
https://saturday-october-seven.com/



nested \set ?

2024-03-25 Thread Werner LEMBERG


LilyPond provides `\temporary` and `\revert` to set a grob property
temporarily, and afterwards the value of the grob property is the same
as before.

Is there a similar possiblity for `\set` (or something usable in
Scheme)?  I guess not, but I couldn't find this documented
somewhere...


Werner