Re: displaying `script-priority`

2023-12-13 Thread Michael Werner
Hi Werner,

On Thu, Dec 14, 2023 at 12:03 AM Werner LEMBERG  wrote:

>
> Walking through some unanswered e-mails of mine I stumbled across this
> one, asked in October.
>
>   https://lists.gnu.org/archive/html/lilypond-user/2023-10/msg00222.html
>
> > How can I make LilyPond display the actual values of
> > `script-priority` for a stack of grobs?  [...]
>
> Any suggestions how to do that?  Otherwise I'll file an issue.
>

A few days ago I was looking for something, and stumbled across
https://lsr.di.unimi.it/LSR/Item?id=1017
And I thought that it might help here. I was able to modify it a bit to
pare down the info it returns, as it returns *everything* about each
occurence of the grob in question. The result:

\version "2.25.10"

#(define print-all-script-priority
   (grob-transformer 'after-line-breaking
 (lambda (grob orig)
   (format #t "\n~a:" grob)
   (format #t "\n~a:" "Text-Interface")
   (format #t "\n\t~a:  ~a" "text"
   (ly:grob-property grob 'text))
   (format #t "\n~a:" "Text-Script-Interface")
   (format #t "\n\t~a:  ~a\n" "script-priority"
   (ly:grob-property grob 'script-priority))
   )))

grobPropertiesInfo =
#(define-music-function (grob-name)(symbol?)
   #{
 \override $grob-name . after-line-breaking =
 #print-all-script-priority
   #})

\relative c {
  \set strokeFingerOrientations = #'(up)
  \set fingeringOrientations = #'(up)

  \grobPropertiesInfo #'StrokeFinger
  \grobPropertiesInfo #'Fingering
  

  \override Fingering.script-priority = #118
  
}

This produces the output:

Starting lilypond 2.25.10 [Untitled]...

Processing `/tmp/frescobaldi-01dbi2f4/tmpg0hzpy81/document.ly'

Parsing...

Interpreting music...

Preprocessing graphical objects...

Finding the ideal number of pages...

Fitting music on 1 page...

Drawing systems...

Converting to `document.pdf'...


#:

Text-Interface:

text: 1

Text-Script-Interface:

script-priority: 96


#:

Text-Interface:

text: p

Text-Script-Interface:

script-priority: 121


#:

Text-Interface:

text: 4

Text-Script-Interface:

script-priority: 103


#:

Text-Interface:

text: a

Text-Script-Interface:

script-priority: 128


#:

Text-Interface:

text: 1

Text-Script-Interface:

script-priority: 114


#:

Text-Interface:

text: p

Text-Script-Interface:

script-priority: 121


#:

Text-Interface:

text: 4

Text-Script-Interface:

script-priority: 121


#:

Text-Interface:

text: a

Text-Script-Interface:

script-priority: 128

Success: compilation successfully completed

Completed successfully in 0.6".

Probably better ways to go about this, but it seems to work.
-- 
Michael


Re: lilypond "preprocessor"?

2023-12-13 Thread Stefano Antonelli
On Tue, 2023-12-12 at 14:46 -0800, Stefano Antonelli wrote:
> #(define (add-midi-to-score score)
>(define (has-midi? score)
>  (any (lambda (x) (ly:output-def-lookup x 'is-midi))
>   (ly:score-output-defs score)))
>(if (has-midi? score) score
>  #{ \score { $score \midi {} } #}))
> 
> toplevel-score-handler =
> #(lambda (score)
>(collect-scores-for-book (add-midi-to-score score)))

It seems to me, that in order to make this work, two things need to
happen:

1. The whole score collection has to be traversed and \midi counted
   This could be done via toplevel-score-handler and some global
   variable.

2. If there are no midi blocks, add one.  This is tricker.  Assuming
   there is a toplevel-of-everything-handler, it would be necessary
   to find a score (which one though?) and then add a midi block.


I took a shot at the first one:

#(define midi-count 0)

#(define (has-midi? score)
 (any (lambda (x) (ly:output-def-lookup x 'is-midi #f))
  (ly:score-output-defs score)))

#(define (count-midi-in-score score)
   (if (has-midi? score) (set! midi-count (+ midi-count 1)))
   score)

toplevel-score-handler =
#(lambda (score)
   (collect-scores-for-book (count-midi-in-score score)))

midi-count now contains the right number.

What can I do with it?









Re: displaying `script-priority`

2023-12-13 Thread Werner LEMBERG


Walking through some unanswered e-mails of mine I stumbled across this
one, asked in October.

  https://lists.gnu.org/archive/html/lilypond-user/2023-10/msg00222.html

> How can I make LilyPond display the actual values of
> `script-priority` for a stack of grobs?  [...]

Any suggestions how to do that?  Otherwise I'll file an issue.


Werner



Re: Changes to Notename - lost some functionality

2023-12-13 Thread Jean Abou Samra
> There's may be one extra paren in there because it threw a syntax error.

Yes, sorry.

> Is that a proper fix, or is something else wrong?

I wouldn't call it a “proper” fix because it's a bit too dependent on details 
that can easily change (specifically, whether the default `NoteName` text is a 
markup that `markup->string` works well on). That's why I recommend 
`noteNameFunction` instead, it's also simpler.


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


Re: Continuation slur and key signature with many sharps

2023-12-13 Thread Knute Snortum
On Wed, Dec 13, 2023 at 12:03 PM Jean Abou Samra  wrote:

> See issue #6639 .
>

Thanks.  I searched for "continued" but not "broken."  I'll know better
next time (maybe).


--
Knute Snortum


Re: Changes to Notename - lost some functionality

2023-12-13 Thread Stefano Antonelli
On Wed, 2023-12-13 at 21:29 +0100, Jean Abou Samra wrote:
> The quick fix here is to change
> 
> (let* ((default-name (ly:grob-property grob 'text)))
> to
> 
> (let* ((default-name (markup->string (ly:grob-property grob 'text
>
> in order to first get an approximate string representation of that
> markup that corresponds to the keys in your alist.

There's may be one extra paren in there because it threw a syntax
error.  I removed one paren and it seems to work:

germanNoteNames =
#(lambda (grob)
   (let* ((default-name (markup->string (ly:grob-property grob 'text)))
  (new-name (assoc-get default-name newnames)))
 (ly:grob-set-property! grob 'text new-name)
   (ly:text-interface::print grob)))

Tested on the mwe I made earlier today.

Is that a proper fix, or is something else wrong?



Re: Changes to Notename - lost some functionality

2023-12-13 Thread Jean Abou Samra
This code is too big for me to digest it, but the basic problem is that 

```
   (let* ((default-name (ly:grob-property grob 'text))
  (new-name (assoc-get default-name newnames)))
```

is doing a lookup in your `newnames` alist with the value of `text` as the key. 
In more recent versions, `text` is not a string but a full markup, which you 
can see if you add `(display default-name)`. So the lookup fails, `assoc-get` 
returns false (`#f`), and you set the grob's text to false, which leads to a 
warning because false isn't a markup.

The quick fix here is to change

```
(let* ((default-name (ly:grob-property grob 'text)))
```

to

```
(let* ((default-name (markup->string (ly:grob-property grob 'text
```

in order to first get an approximate string representation of that markup that 
corresponds to the keys in your alist.

But instead of this fragile method of changing note names, it would be a lot 
better to write a custom `noteNameFunction`, e.g.,

```
\version "2.24.2"

\new NoteNames {
  \set noteNameFunction =
#(lambda (pitch context)
   ;; Write logic to compute the note name from `pitch` as a markup.
   "TODO")
  c' d' e'
}
```


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


Re: Changes to Notename - lost some functionality

2023-12-13 Thread Robin Bannister

Stefano Antonelli wrote:



A good place to start is a minimum working example.  I can't help debug
this, but I put together a minimum working example that shows the
problem.  Maybe someone with better scheme can spot the problem.

With liilypond v2.20 there is no issue.  With lilypond v2.23.3

Preprocessing graphical objects...
programming error: Trying to interpret a non-markup object: #f
continuing, cross fingers
programming error: Trying to interpret a non-markup object: #f
continuing, cross fingers
programming error: Trying to interpret a non-markup object: #f
continuing, cross fingers
programming error: Trying to interpret a non-markup object: #f
continuing, cross fingers
Finding the ideal number of pages...

newnames =
#`(
   ("c" . "cee")
   ("d" . "dee")
   ("e" . "eee")
   ("f" . "fff")
)



With lilypond v2.20 there is no issue.
With lilypond v2.21.1, the names are missing
(and the 4 errors are reported differently)


warning: no \version statement found, please add
\version "2.21.1"
for future compatibility
Interpreting music...
Preprocessing graphical objects...
programming error: Object is not a markup.
continuing, cross fingers
programming error: Object is not a markup.
continuing, cross fingers
programming error: Object is not a markup.
continuing, cross fingers
programming error: Object is not a markup.
continuing, cross fingers
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Layout output to `./tmp-lilypond-UX8ggy'...
Converting to `2.pdf'...
Deleting `./tmp-lilypond-UX8ggy'...
This object should be a markup: #f
This object should be a markup: #f
This object should be a markup: #f
This object should be a markup: #f
Success: compilation successfully completed


Cheers,
Robin





Re: Continuation slur and key signature with many sharps

2023-12-13 Thread Jean Abou Samra
See [issue #6639](https://gitlab.com/lilypond/lilypond/-/issues/6639).



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


Re: text over hairpin

2023-12-13 Thread Paul Scott

On 12/13/23 10:28 AM, David Wright wrote:

On Wed 13 Dec 2023 at 09:54:41 (-0700), Paul Scott wrote:

I should have changed my subject line to "text inside hairpin" before
sending the original post.

Inside relative to what, though?


Between the two  lines of the hairpin.

Paul




(Think roads. In both the UK and the US, the "inside lane"
is the one on the left, ie slow in the UK, fast in the US.)

Cheers,
David.






Re: Hide a note inside a drumscore

2023-12-13 Thread Sebastien Richard
Thanks for your reply

I tried your exemple with the tie which also work great

In the full drumscore the tie gets "pushed" down. I'm trying to figure out a 
way to reposition it but I can't get any command to do so (tried "\tweak 
positions" and "\override Tie.positions")

Any ideas ?


"You are thinking too complicated." ==> it's just an idea, I'm thinking even 
more complicated than that 浪


BR

-
 Seb



From: lilypond-user-bounces+richardsgjm=hotmail@gnu.org 
 on behalf of David 
Kastrup 
Sent: Wednesday, December 13, 2023 17:49
To: Sebastien Richard 
Cc: lilypond-user@gnu.org 
Subject: Re: Hide a note inside a drumscore

Sebastien Richard  writes:

> Hello,
>
> How can I hide a note inside a drum score ? I tried following the doc here 
> https://lilypond.org/doc/v2.23/Documentation/notation/visibility-of-objects 
> but I did not managed to make it work
>
> Here is an example where I want to hide the snare :
>
> \version "2.24.2"
> up = \drummode {
>   \slurDown \grace {sn16 sn(} 4
> }
> \score {
>   \new DrumStaff
>   << \new DrumVoice { \voiceOne \up } >>
>   \layout {}
> }

You are thinking too complicated.

\version "2.24.2"
up = \drummode {
  \slurDown \grace {sn16 sn(} 4
}
\score {
  \new DrumStaff
  << \new DrumVoice { \voiceOne \up } >>
  \layout {}
}

But I consider it very likely that you actually don't want a slur but a
tie:

\version "2.24.2"
up = \drummode {
  \grace {sn16 sn_~} 4
}
\score {
  \new DrumStaff
  << \new DrumVoice { \voiceOne \up } >>
  \layout {}
}

--
David Kastrup



Re: text over hairpin

2023-12-13 Thread David Wright
On Wed 13 Dec 2023 at 09:54:41 (-0700), Paul Scott wrote:
> I should have changed my subject line to "text inside hairpin" before
> sending the original post.

Inside relative to what, though?

(Think roads. In both the UK and the US, the "inside lane"
is the one on the left, ie slow in the UK, fast in the US.)

Cheers,
David.



Re: text over hairpin

2023-12-13 Thread Paul Scott
I should have changed my subject line to "text inside hairpin" before 
sending the original post.


Paul

On 12/13/23 9:22 AM, Michael Werner wrote:

Hi Paul,

On Wed, Dec 13, 2023 at 10:36 AM Paul Scott  
wrote:


How do I put text (molto) inside a hairpin?  I didn't see it in
snippets
or NR.


Found this in the Snippets:
http://lilypond.org/doc/v2.25/Documentation/snippets/expressive-marks_003a-center-text-below-hairpin-dynamics
--
Michael



Continuation slur and key signature with many sharps

2023-12-13 Thread Knute Snortum
Hi List,

Here is something that pops up now and then when I'm engraving with
LilyPond: if a key signature has a lot of sharps, like the key of e major,
sometimes a continuation slur will be too close to the key signature.  Here
is a snippet:

%%%
\version "2.25.11"

\paper {
  ragged-right = ##t
}

\relative {
  \key e \major % ugly
  % b major is okay
  % f sharp major is ugly too
  cis''1( | \break
  cis1) |
}
%%%

The output is attached.  What is your opinion on this?  Is it an "ugly"
issue or not a problem?

--
Knute Snortum


Re: Changes to Notename - lost some functionality

2023-12-13 Thread Stefano Antonelli
On Wed, 2023-12-13 at 11:12 +0100, Sebastian Käppler wrote:
> Any help on this would be appreciated, I'm a bit lost now where to
> start.

A good place to start is a minimum working example.  I can't help debug
this, but I put together a minimum working example that shows the
problem.  Maybe someone with better scheme can spot the problem.

With liilypond v2.20 there is no issue.  With lilypond v2.23.3

Preprocessing graphical objects...
programming error: Trying to interpret a non-markup object: #f
continuing, cross fingers
programming error: Trying to interpret a non-markup object: #f
continuing, cross fingers
programming error: Trying to interpret a non-markup object: #f
continuing, cross fingers
programming error: Trying to interpret a non-markup object: #f
continuing, cross fingers
Finding the ideal number of pages...

newnames =
#`(
  ("c" . "cee")
  ("d" . "dee")
  ("e" . "eee")
  ("f" . "fff")
)

germanNoteNames =
#(lambda (grob)
   (let* ((default-name (ly:grob-property grob 'text))
  (new-name (assoc-get default-name newnames)))
 (ly:grob-set-property! grob 'text new-name)
   (ly:text-interface::print grob)))

melody = { c d e f }

\score {
  <<
\new Staff { \melody }
\new NoteNames {
  \override NoteName.stencil = #germanNoteNames
  \melody
}
  >>
  \layout {}
}




Re: Hide a note inside a drumscore

2023-12-13 Thread David Kastrup
Sebastien Richard  writes:

> Hello,
>
> How can I hide a note inside a drum score ? I tried following the doc here 
> https://lilypond.org/doc/v2.23/Documentation/notation/visibility-of-objects 
> but I did not managed to make it work
>
> Here is an example where I want to hide the snare :
>
> \version "2.24.2"
> up = \drummode {
>   \slurDown \grace {sn16 sn(} 4
> }
> \score {
>   \new DrumStaff
>   << \new DrumVoice { \voiceOne \up } >>
>   \layout {}
> }

You are thinking too complicated.

\version "2.24.2"
up = \drummode {
  \slurDown \grace {sn16 sn(} 4
}
\score {
  \new DrumStaff
  << \new DrumVoice { \voiceOne \up } >>
  \layout {}
}

But I consider it very likely that you actually don't want a slur but a
tie:

\version "2.24.2"
up = \drummode {
  \grace {sn16 sn_~} 4
}
\score {
  \new DrumStaff
  << \new DrumVoice { \voiceOne \up } >>
  \layout {}
}

-- 
David Kastrup



Re: text over hairpin

2023-12-13 Thread Paul Scott

On 12/13/23 9:22 AM, Michael Werner wrote:

Hi Paul,

On Wed, Dec 13, 2023 at 10:36 AM Paul Scott  
wrote:


How do I put text (molto) inside a hairpin?  I didn't see it in
snippets
or NR.


Found this in the Snippets:
http://lilypond.org/doc/v2.25/Documentation/snippets/expressive-marks_003a-center-text-below-hairpin-dynamics


Thank you for your reply!

The results of that snippet are easily accomplished with simple code and 
simple code is what I am using as a substitute for what I was trying to 
get.  For example:


s1\> s1_\markup\italic{molto} s2. s8\!

I actually was trying to get "molto" inside the hairpin.

Regards,

Paul



Re: Hide a note inside a drumscore

2023-12-13 Thread Sebastien Richard
Hello,

Thanks you for the quick reply

works like a charm 

-
 Seb


From: Michael Werner 
Sent: Wednesday, December 13, 2023 17:19
To: Sebastien Richard 
Cc: lilypond-user@gnu.org 
Subject: Re: Hide a note inside a drumscore

Hi Seb,

On Wed, Dec 13, 2023 at 11:00 AM Sebastien Richard 
mailto:richards...@hotmail.com>> wrote:
Hello,

How can I hide a note inside a drum score ? I tried following the doc here 
https://lilypond.org/doc/v2.23/Documentation/notation/visibility-of-objects but 
I did not managed to make it work

The issue you are running into is that overrides won't work on a single item 
when there's more than one of them happening at the same moment in the music. 
As these are (basically) notes within a chord, they're at the same moment. And 
the \hide command is just a shortcut for an override on the grob's Transparent 
property. In the case of simultaneous grobs, you want the \tweak command. 
http://lilypond.org/doc/v2.25/Documentation/notation/tweak-and-single

So, your code would become:

\version "2.24.2"

up = \drummode {
  \slurDown \grace { sn16 sn( }  4
}

\score {
  \new DrumStaff <<
\new DrumVoice {
  \voiceOne \up
}
  >>
  \layout {}
}

--
Michael



Re: text over hairpin

2023-12-13 Thread Michael Werner
Hi Paul,

On Wed, Dec 13, 2023 at 10:36 AM Paul Scott  wrote:

> How do I put text (molto) inside a hairpin?  I didn't see it in snippets
> or NR.
>

Found this in the Snippets:
http://lilypond.org/doc/v2.25/Documentation/snippets/expressive-marks_003a-center-text-below-hairpin-dynamics
-- 
Michael


Re: Hide a note inside a drumscore

2023-12-13 Thread Michael Werner
Hi Seb,

On Wed, Dec 13, 2023 at 11:00 AM Sebastien Richard 
wrote:

> Hello,
>
> How can I hide a note inside a drum score ? I tried following the doc here 
> *https://lilypond.org/doc/v2.23/Documentation/notation/visibility-of-objects
> *
>  but
> I did not managed to make it work
>

The issue you are running into is that overrides won't work on a single
item when there's more than one of them happening at the same moment in
the music. As these are (basically) notes within a chord, they're at the
same moment. And the \hide command is just a shortcut for an override on
the grob's Transparent property. In the case of simultaneous grobs, you
want the \tweak command.
http://lilypond.org/doc/v2.25/Documentation/notation/tweak-and-single

So, your code would become:

\version "2.24.2"

up = \drummode {
  \slurDown \grace { sn16 sn( }  4
}

\score {
  \new DrumStaff <<
\new DrumVoice {
  \voiceOne \up
}
  >>
  \layout {}
}

-- 
Michael


Hide a note inside a drumscore

2023-12-13 Thread Sebastien Richard
Hello,

How can I hide a note inside a drum score ? I tried following the doc here 
https://lilypond.org/doc/v2.23/Documentation/notation/visibility-of-objects but 
I did not managed to make it work

Here is an example where I want to hide the snare :

\version "2.24.2"
up = \drummode {
  \slurDown \grace {sn16 sn(} 4
}
\score {
  \new DrumStaff
  << \new DrumVoice { \voiceOne \up } >>
  \layout {}
}

returns :

Starting lilypond 2.24.2 [Untitled]...

Processing `/tmp/frescobaldi-zzesx842/tmpnp53_6vh/document.ly'

Parsing...

/tmp/frescobaldi-zzesx842/tmpnp53_6vh/document.ly:4:37<0>: error: not a 
rhythmic event

  \slurDown \grace {sn16 sn(} 4

Interpreting music...

Preprocessing graphical objects...

Finding the ideal number of pages...

Fitting music on 1 page...

Drawing systems...

Converting to `document.pdf'...

fatal error: failed files: "/tmp/frescobaldi-zzesx842/tmpnp53_6vh/document.ly"

Exited with return code 1.


Attached is a screenshot of what I'm trying to achieve (except for the slur)



BR,

-
 Seb


text over hairpin

2023-12-13 Thread Paul Scott
How do I put text (molto) inside a hairpin?  I didn't see it in snippets 
or NR.


TIA,

Paul






Changes to Notename - lost some functionality

2023-12-13 Thread Sebastian Käppler
Dear lilypond experts,

I seem to have missed some changes to LilyPond between 2.19.82 and current
versions. I use a quite big script to automatically generate some music
theory tasks for my students (in German). I'll post the complete example
below. However, my code for creating note names doesn't work anymore. The
line printed bold probably is causing problems:
\context NoteNames \with {
%%% Show notenames only for reading tasks
   * \override NoteName.stencil = #(if (and (not solution) (equal? mode
#\r)) blankNoteNames germanNoteNames)*
\override NoteName.Y-offset = -2
\override NoteName.X-offset = -1
  }

germanNoteNames is:
germanNoteNames =
#(lambda (grob)
   (let* ((default-name (ly:grob-property grob 'text))
  (new-name (assoc-get default-name newnames)))
 (ly:grob-set-property! grob 'text new-name)
   (ly:text-interface::print grob)))

I can run this code, but get "Trying to interpret a non-markup object: #f". The
blanks (or note names) are printed, but I don't get actual note names.

Any help on this would be appreciated, I'm a bit lost now where to start.
I've attached the current version of my script below, with example code at
the end of the file. My last working version and it's "documentation" can
be found at
https://gist.github.com/TheNothingMan/6f5daf540d55b4ad9138e3ff5d3ffbd0

Thank you very much for any help!


school.ly
Description: Binary data