Re: displaying `script-priority`

2023-12-15 Thread Werner LEMBERG


>> > 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.  [...]

Veery nice, thanks a lot!  It was quite helpful, and it eventually
lead to

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


Werner



Re: Running a system command from within Lilypond [Solved]

2023-12-15 Thread Raphael Mankin




On 15/12/2023 16:23, Jean Abou Samra wrote:

I am on version Frescobaldi 3.2 and Lilypond 2.22.1 and do not appear
to have that option. At least, I have not found it. Anyway, I have
"automatic engraving" on.


It's in Edit > Preferences > LilyPond Preferences > Running LilyPond > 
Save document if possible, but I don't think it's going to auto-save 
when the engraving job is triggered by automatic engraving, unfortunately.


Ah, that one. Thank you. Now set.

--
In software design, perfection has been reached not when there
is nothing left to add, but when there is nothing left to take
away. - After RFC1925



Re: Running a system command from within Lilypond [Solved]

2023-12-15 Thread Jean Abou Samra
> I am on version Frescobaldi 3.2 and Lilypond 2.22.1 and do not appear 
> to have that option. At least, I have not found it. Anyway, I have 
> "automatic engraving" on.

It's in Edit > Preferences > LilyPond Preferences > Running LilyPond > Save
document if possible, but I don't think it's going to auto-save when the
engraving job is triggered by automatic engraving, unfortunately.


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


Re: Running a system command from within Lilypond [Solved]

2023-12-15 Thread Raphael Mankin




On 15/12/2023 16:06, Jean Abou Samra wrote:
[Later] The error I am getting now is:  Processing 
`/tmp/frescobaldi-duowk0s5/tmpz726e77a/testGit.ly'   Parsing...fatal: 
not a git repository (or any of the parent directories): .git


If the path is in |/tmp/|, it means that you did not save your file 
before compiling, so Frescobaldi put the contents of the current editing 
window in a temporay file and compiled that.


If you simply remember to always save before compiling (or turn on 
save-on-compile in the preferences), Frescobaldi will compile your file 
with the directory where it's saved as the current directory. If that's 
inside a Git repository, |git| commands should work.




I am on version Frescobaldi 3.2 and Lilypond 2.22.1 and do not appear 
to have that option. At least, I have not found it. Anyway, I have 
"automatic engraving" on.


--
In software design, perfection has been reached not when there
is nothing left to add, but when there is nothing left to take
away. - After RFC1925



Re: Dynamics [pl|sp]acing weirdness

2023-12-15 Thread Kieren MacMillan
Hi MIchael,

> While that works, wrapping that combo isn't required all the time. E.g. when 
> you have
> dynamicsA = {
>   s2. s4\mf\< | s2 s2\f |
> }

That’s because this version does not use \after, which is a music function that 
expects a single musical expression as its first parameter.

> there still is the bar check warning, implying that the combo \mf\f does use 
> musical time.
> That's something I don't understand. Especially since it doesn't seem to when 
> wrapped in {}.

\mf\< is two musical expressions; { \mf\< } is one musical expression.
"Use musical time” isn’t exactly how I would frame the behaviour.

> If that's intended (and I'm not saying it isn't or can't be) I'd like to 
> understand the reason for this (to me) inconsistency.

It is intended, as far as I know.

Hope that helps!
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.




Re: Running a system command from within Lilypond [Solved]

2023-12-15 Thread Jean Abou Samra
> [Later] The error I am getting now is:
>  Processing `/tmp/frescobaldi-duowk0s5/tmpz726e77a/testGit.ly'
>   Parsing...fatal: not a git repository (or any of the parent 
> directories): .git


If the path is in `/tmp/`, it means that you did not save your file before 
compiling, so Frescobaldi put the contents of the current editing window in a 
temporay file and compiled that.

If you simply remember to always save before compiling (or turn on 
save-on-compile in the preferences), Frescobaldi will compile your file with 
the directory where it's saved as the current directory. If that's inside a Git 
repository, `git` commands should work.




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


Re: Running a system command from within Lilypond [Solved]

2023-12-15 Thread Raphael Mankin
Thank you for the very  prompt response. I had tried popen, but with no 
luck. I will give it another go.I do not now remember what it originally 
said, if anything.


[Later] The error I am getting now is:
Processing `/tmp/frescobaldi-duowk0s5/tmpz726e77a/testGit.ly'
 Parsing...fatal: not a git repository (or any of the parent 
directories): .git


So, after a bit of faffing around for how to change the TMPDIR in the 
GUI, I changed my whisker-menu (Ubuntu/xfce4) entry to	

bash -c "TMPDIR=$HOME/src/Music/tmp frescobaldi %F"

Doing just
TMPDIR=$HOME/src/Music/tmp frescobaldi %F
did not work.

On 15/12/2023 13:25, Jean Abou Samra wrote:
I keep my Lilypond files in a git repository. I would like to 
interpolate the repo's version number in the Lilypond output by 
running a command like "git log|head -1". I can  do this from raw 
Scheme  using the system() function, but this does not seem to work in 
Lilypond.


How does it fail? It should definitely work. It will just not capture 
the output. See LSR 567  for a 
snippet that uses |open-pipe*| from |(ice-9 popen)| to achive 
essentially the same need as yours.


I realise that being able to do so opens up a massive security hole, 
but that is not a problem here.


LilyPond does not attempt to securely compile the file if it untrusted. 
(There used to exist a |-dsafe| option, but it was found to be 
irreparably broken, and got removed.)




--
In software design, perfection has been reached not when there
is nothing left to add, but when there is nothing left to take
away. - After RFC1925



Re: Running a system command from within Lilypond

2023-12-15 Thread Graham King
On Fri, 2023-12-15 at 12:45 +, Raphael Mankin wrote:
> Motivation:
> 
> I keep my Lilypond files in a git repository. I would like to 
> interpolate the repo's version number in the Lilypond output by
> running 
> a command like "git log|head -1". I can  do this from raw Scheme 
> using 
> the system() function, but this does not seem to work in Lilypond.
> 
> So, now the question:
> 
> How do I run a system command from within Lilypond? I realise that
> being 
> able to do so opens up a massive security hole, but that is not a 
> problem here.
> 
Here's what I do.  There will be some lines in here that are redundant
for your purposes.  And the code probably needs a cleanup for recent
versions (getting rid of "layout props" args), and for my cargo-cult
coding.  Apologies if email introduces errant linebreaks:

 filestats.ily ~
\version "2.25.0"

% from snippet 197:
#(define comml(object->string (command-line)))
#(define loc  (+ (string-rindex comml #\space ) 2)) 
#(define commllen (- (string-length comml) 2))
#(define filen(substring comml loc commllen))   %
filename
#(define siz  (object->string (stat:size (stat filen%
file size
#(define ver  (object->string (lilypond-version)))  %
Lilypond version
#(define dat  (strftime "%m/%d/%Y" (localtime (current-time %
Date processed
#(define tim  (strftime "%H:%M:%S" (localtime (current-time %
Time processed
#(define modt (stat:mtime (stat filen)))%
Last modified
#(define modts(strftime "%d %b %Y %H:%M:%S" (localtime modt)))  %
Command line


% gitver and gitrev (from
http://lilypondblog.org/2014/01/why-use-version-control-for-engraving-scores/#more-2151
)
#(use-modules (ice-9 popen))
#(use-modules (ice-9 rdelim))

% NOTE: This function only reads the first line of the command!
#(define (strsystem_internal cmd)
   (let* ((port (open-input-pipe cmd))
  (str (read-line port)))
 (close-pipe port)
 str))

#(define-markup-command (strsystem layout props cmd) (markup?)
   (interpret-markup layout props
 (strsystem_internal cmd)))

%gitver = \markup { \strsystem  "/usr/bin/git log --oneline " \filen "
| wc -l" }
gitrev = \markup { \strsystem "/usr/bin/git rev-parse --short HEAD" }



Then in my source file:
 some-music.ly ~
\include "filestats.ily"

\header {
  tagline = \markup{
\center-column{
  \line { "Version control for this edition: gitrev " \gitrev " "
\modts 


HTH
-- Graham



Re: Dynamics [pl|sp]acing weirdness

2023-12-15 Thread Michael Gerdau

Hi Kieren,

thanks for answering :)


I've come across some placing or spacing weirdness with dynamics.
In the attached example \dynamicsA is what I tried to code, aka the \< starts 
directly after the \mf. What I expected is what you see in \dynamicsB. However it 
seems as if the combo \mf\< does use some musical time which makes the \f appear 1 
quaver later than I had expected.
Is this behaviour expected or a bug?


Did you notice the error(s) when you tried to compile?  ;)


You mean the failed bar check? That's basically my complaint. I don't 
understand why the bar check fails.



Try this instead:

dynamicsA = {
   s2. \after 8... { <>\mf\< } s4 | s2 s2\f |
}

Note that the combo you’re trying to insert needs to be wrapped in braces so 
that it’s a single musical expression.


While that works, wrapping that combo isn't required all the time. E.g. 
when you have


dynamicsA = {
   s2. s4\mf\< | s2 s2\f |
}

everything compiles w/o a complaint. Of course the placement of the \mf 
is different.


However when you try something like

dynamicsA = {
   s2. \after 64 \mf\< s4 | s2 s2\f |
}

there still is the bar check warning, implying that the combo \mf\f does 
use musical time.


That's something I don't understand. Especially since it doesn't seem to 
when wrapped in {}.


If that's intended (and I'm not saying it isn't or can't be) I'd like to 
understand the reason for this (to me) inconsistency.


Kind regards,
Michael
--
 Michael Gerdau   email: m...@qata.de
 GPG-keys available on request or at public keyserver



Re: Dynamics [pl|sp]acing weirdness

2023-12-15 Thread Kieren MacMillan
Hi Michael,

> I've come across some placing or spacing weirdness with dynamics.
> In the attached example \dynamicsA is what I tried to code, aka the \< starts 
> directly after the \mf. What I expected is what you see in \dynamicsB. 
> However it seems as if the combo \mf\< does use some musical time which makes 
> the \f appear 1 quaver later than I had expected.
> Is this behaviour expected or a bug?

Did you notice the error(s) when you tried to compile?  ;)

Try this instead:

dynamicsA = {
  s2. \after 8... { <>\mf\< } s4 | s2 s2\f |
}

Note that the combo you’re trying to insert needs to be wrapped in braces so 
that it’s a single musical expression.

Hope that helps!
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.




Dynamics [pl|sp]acing weirdness

2023-12-15 Thread Michael Gerdau

Hi list!

I've come across some placing or spacing weirdness with dynamics.

In the attached example \dynamicsA is what I tried to code, aka the \< 
starts directly after the \mf. What I expected is what you see in 
\dynamicsB. However it seems as if the combo \mf\< does use some musical 
time which makes the \f appear 1 quaver later than I had expected.


Is this behaviour expected or a bug?

Kind regards,
Michael
--
 Michael Gerdau   email: m...@qata.de
 GPG-keys available on request or at public keyserver\version "2.25.11"

music = {
  c'4 c'4 c'4 c'4 | c'4 c'4 c'4 r4 \bar "|."
}

dynamicsA = {
  s2. \after 8... \mf\< s4 | s2 s2\f |
}

dynamicsB = {
  s2. \after 8... \mf s4 | \after 8 \< s2 s2\f |
}

\score {
  <<
\new Dynamics { \dynamicsA }
\music
\new Dynamics { \dynamicsB }
\music
  >>
  \layout { }
}



dynamics-spacing-weirdness.pdf
Description: Adobe PDF document


Re: Running a system command from within Lilypond

2023-12-15 Thread Jean Abou Samra
> I keep my Lilypond files in a git repository. I would like to
> interpolate the repo's version number in the Lilypond output by running 
> a command like "git log|head -1". I can  do this from raw Scheme  using 
> the system() function, but this does not seem to work in Lilypond.



How does it fail? It should definitely work. It will just not capture the 
output. See [LSR 567](https://lsr.di.unimi.it/LSR/Item?id=567) for a snippet 
that uses `open-pipe*` from `(ice-9 popen)` to achive essentially the same need 
as yours.

> I realise that being able to do so opens up a massive security hole, but that 
> is not a problem here.

LilyPond does not attempt to securely compile the file if it untrusted. (There 
used to exist a `-dsafe` option, but it was found to be irreparably broken, and 
got removed.)


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


Running a system command from within Lilypond

2023-12-15 Thread Raphael Mankin

Motivation:

I keep my Lilypond files in a git repository. I would like to 
interpolate the repo's version number in the Lilypond output by running 
a command like "git log|head -1". I can  do this from raw Scheme  using 
the system() function, but this does not seem to work in Lilypond.


So, now the question:

How do I run a system command from within Lilypond? I realise that being 
able to do so opens up a massive security hole, but that is not a 
problem here.


There are workarounds, like having a cron job that writes the text into 
a file at regular intervals and then including that file. But that is 
messy - and not portable to a machine that does not have that cron job.


BTW I run Lilypond from Frescobaldi.


--
In software design, perfection has been reached not when there
is nothing left to add, but when there is nothing left to take
away. - After RFC1925



How to achieve minimum horizontal spacing between notes

2023-12-15 Thread Jiří Hon

Dear LilyPond community,

I'm working on an web psalter https://www.zaltar.cz (in Czech language) with 
responsive music notation based on LilyPond. For example, take a look at 
https://www.zaltar.cz/OL1.html and try changing the width of the browser. The 
notation is pre-engraved at 9 different sizes and the correct size is 
automatically selected using CSS rules. The LilyPond code used to create the 
notation is linked at the bottom of each page.

In order to make the notation work at so many different sizes, I have used the 
excellent work of Thomas Morley 
(https://lists.gnu.org/archive/html/lilypond-user/2020-05/msg2.html), Jean 
Abou Samra and Werner Lemberg 
(https://www.mail-archive.com/lilypond-user@gnu.org/msg149350.html). Thank you 
very much! Their code handles automatic wrapping of long breves and snapping 
syllables so that they appear as one text on each breve.

However, I would like to take musical notation even further. Right now, there's 
a lot of extra space behind the breve because of those invisible notes that are 
evenly spaced.

My question is: Is it possible to reduce the spacing between those invisible 
breves? I tried using \override NoteHead.X-extent = #'(0 . 0). This almost does 
what I want. The notes can overlap and the spacing is dictated by the text 
only, which is great for my purpose. However, there is serious drawback to 
this. The ledger lines stop working. This is understandable, since they need 
the X-extent of note heads to calculate the length. So, please, is there any 
other way to a achieve similar spacing, but without interfering with the ledger 
lines?

Below is some kind of MWE. I would like to achieve the same spacing as in the 
MWE, but with working ledger lines:

\version "2.24.0"

\header {
  tagline = ""
}

\paper {
  indent = 0\cm
  top-margin = 0\cm
  right-margin = 0\cm
  bottom-margin = 0\cm
  left-margin = 0\cm
  paper-width = 15\cm
  page-breaking = #ly:one-page-breaking
}

hideNotes = {
  % logic for hiding notes based on Thomas Morley's work
  % https://lists.gnu.org/archive/html/lilypond-user/2020-05/msg2.html
}
unHideNotes = {
  % logic for hiding notes based on Thomas Morley's work
  % https://lists.gnu.org/archive/html/lilypond-user/2020-05/msg2.html
}

squashNotes = {
  \override NoteHead.X-extent = #'(0 . 0)
}
unSquashNotes = {
  \revert NoteHead.X-extent
}

\score {
  <<
\new Voice = "melody" {
  \cadenzaOn \key c \major \relative {
c'\breve*1/16 \squashNotes \hideNotes \breve*1/16 \bar "" \breve*1/16 \bar "" \breve*1/16 
\bar "" \breve*1/16 \bar ""
\breve*1/16 \bar "" \breve*1/16 \bar "" \breve*1/16 \bar "" \breve*1/16 \bar "" 
\breve*1/16 \breve*1/16 \bar ""
\unHideNotes \unSquashNotes \bar "" f8 e d d4 r \bar "|"

d\breve*1/16 \squashNotes \hideNotes \breve*1/16 \breve*1/16 \bar "" \unHideNotes \unSquashNotes \bar ""

g8[( f)] e e2 \bar "||" \break
  }
}
\new Lyrics \lyricsto "melody" {
  \lyricmode {
\set stanza = "3."
Bu -- deš-li u -- cho -- vá -- vat "v pa" -- mě -- ti vi -- ny, Ho -- 
spo -- di -- ne,
Pa -- ne, kdo ob -- sto -- jí?
  }
}
  >>
}

Thank you very much for your time and effort,
Jiri Hon