Re: Feedback request on image formats

2023-01-10 Thread Benjamin Tordoff
Almost all the images I use for cover art etc are JPEG or PNG originally so for 
me PNG is the most important format. Other images I use are generally icons or 
clip art and these are almost always png or svg. I don’t think I’ve ever seen 
stock imagery or icons in pdf format, only documents.

So, +1 for SVG (+PNG obviously) from me.

Ben

> On 10 Jan 2023, at 22:52, Stephan Schöll  wrote:
> 
> +1 for SVG:
> From my perspective and experience including vector graphics in musical
> scores is most often about icons or graphics, illustration or extended
> markup, but rather not entire documents / pages (knowing that PDFs can
> be small as well of course ;-).
> SVG is widely used for icons and graphics of any dimension (and scalable
> by definition ;-) ), while PDF contains a lot of overhead that might
> cause trouble "easier".
> 
> And yes: PNG is welcome as well :-)
> 
> Best Stephan
> 
>> On 10.01.2023 23:35, Abraham Lee wrote:
>> If I had a vote, and if PDF really can be seamlessly converted, I would
>> make the front-end favor the SVG format as I think that format would be
>> more likely used by most users.
>> 
>> Glad to hear about this! Both PNG and SVG would be very nice additions.
>> 
>> Best,
>> Abraham
>> 
>> On Tue, Jan 10, 2023 at 3:23 PM Jean Abou Samra > > wrote:
>> 
>>Hi,
>> 
>>This is a little call for feedback, especially from users of the
>>\epsfile
>>markup command. (To be clear, I'm not speaking "in the name of the
>>development
>>team", just in my name.)
>> 
>>Over the past year and a half, LilyPond has gained a new output
>>backend based on the Cairo graphics library. While this backend
>>has many advantages, there's a downside: it is not possible with
>>Cairo to include EPS files in PDF output. Yet this is the only way
>>today to include images, via the \epsfile markup command.
>> 
>>To address this limitation, we're considering adding support for more
>>image formats than EPS. We will likely add PNG. However, because PNG
>>is a raster graphics format while EPS can contain vector graphics
>>(https://en.wikipedia.org/wiki/Vector_graphics
>>), we'd like to add a
>>vector graphics format as well. Basically, the contenders are PDF
>>and SVG. However, each of them requires adding dependencies, so we'd
>>rather not have them both.
>> 
>>Which leads to the question in this straw poll: would it be more useful
>>for you to be able to insert SVG or PDF images? Keep in mind that both
>>can be converted into each other seamlessly, so the question is mainly
>>what will be most useful for a majority of people.
>> 
>>Thanks,
>>Jean
>> 
> 



Re: Image width issue

2023-01-10 Thread Rajesh Baskar

Hi Jean,

I don't know if I'm doing this wrong as suggested by you, but I'm still 
not getting the results.


\version "2.22.0" \language english \header {tagline = ##f} \score {\new 
Staff \with {\omit TimeSignature}

   {\set Staff.midiInstrument = #"Acoustic Grand"
    \key c \major \time 5/1 \clef bass g,1 a,
 \tweak transparent ##t b,
 c d \bar "||"}
   \layout {\context { \Score proportionalNotationDuration 
= #(ly:make-moment 1/2) } } \midi { \tempo 1 = 72}}



\version "2.22.0"
\language english
RedDotMarkup = \markup \with-color "#FF" \vcenter \fontsize #-1 
\musicglyph "dots.dot"

RedDot =
  \tweak text \RedDotMarkup
  \tweak stencil #ly:text-interface::print
  \tweak staff-position #0
  \etc

\header {
  tagline = ##f
}

\score {
  \new Staff \with { \omit TimeSignature }
  {
    \set Staff.midiInstrument = #"acoustic grand"
    \key c \major
    \time 5/1
    \clef bass
    g,1 a,
    \RedDot b,
    c d
    \bar "||"
  }
  \layout {
    \context {
  \Score proportionalNotationDuration = #(ly:make-moment 1/2)
    }
  }
}

issue
On 1/10/2023 1:58 PM, Jean Abou Samra wrote:

\tweak transparent ##t

Re: Feedback request on image formats

2023-01-10 Thread Stephan Schöll

+1 for SVG:
From my perspective and experience including vector graphics in musical
scores is most often about icons or graphics, illustration or extended
markup, but rather not entire documents / pages (knowing that PDFs can
be small as well of course ;-).
SVG is widely used for icons and graphics of any dimension (and scalable
by definition ;-) ), while PDF contains a lot of overhead that might
cause trouble "easier".

And yes: PNG is welcome as well :-)

Best Stephan

On 10.01.2023 23:35, Abraham Lee wrote:

If I had a vote, and if PDF really can be seamlessly converted, I would
make the front-end favor the SVG format as I think that format would be
more likely used by most users.

Glad to hear about this! Both PNG and SVG would be very nice additions.

Best,
Abraham

On Tue, Jan 10, 2023 at 3:23 PM Jean Abou Samra mailto:j...@abou-samra.fr>> wrote:

Hi,

This is a little call for feedback, especially from users of the
\epsfile
markup command. (To be clear, I'm not speaking "in the name of the
development
team", just in my name.)

Over the past year and a half, LilyPond has gained a new output
backend based on the Cairo graphics library. While this backend
has many advantages, there's a downside: it is not possible with
Cairo to include EPS files in PDF output. Yet this is the only way
today to include images, via the \epsfile markup command.

To address this limitation, we're considering adding support for more
image formats than EPS. We will likely add PNG. However, because PNG
is a raster graphics format while EPS can contain vector graphics
(https://en.wikipedia.org/wiki/Vector_graphics
), we'd like to add a
vector graphics format as well. Basically, the contenders are PDF
and SVG. However, each of them requires adding dependencies, so we'd
rather not have them both.

Which leads to the question in this straw poll: would it be more useful
for you to be able to insert SVG or PDF images? Keep in mind that both
can be converted into each other seamlessly, so the question is mainly
what will be most useful for a majority of people.

Thanks,
Jean





Re: Feedback request on image formats

2023-01-10 Thread Jean Abou Samra

Le 10/01/2023 à 23:35, Abraham Lee a écrit :

If I had a vote, and if PDF really can be seamlessly converted



Yes, it can.

pdf2svg in.pdf out.svg

(https://manpages.ubuntu.com/manpages/impish/man1/pdf2svg.1.html)

In the opposite direction:

rsvg-convert in.svg -f pdf -o out.pdf

The only caveat is that an SVG image can't contain multiple pages,
whereas with PDF support working, we could also consider supporting
insertion of multiple pages in one go (but it's not clear to me
how useful that would be).



OpenPGP_signature
Description: OpenPGP digital signature


Re: Feedback request on image formats

2023-01-10 Thread Abraham Lee
If I had a vote, and if PDF really can be seamlessly converted, I would
make the front-end favor the SVG format as I think that format would be
more likely used by most users.

Glad to hear about this! Both PNG and SVG would be very nice additions.

Best,
Abraham

On Tue, Jan 10, 2023 at 3:23 PM Jean Abou Samra  wrote:

> Hi,
>
> This is a little call for feedback, especially from users of the \epsfile
> markup command. (To be clear, I'm not speaking "in the name of the
> development
> team", just in my name.)
>
> Over the past year and a half, LilyPond has gained a new output
> backend based on the Cairo graphics library. While this backend
> has many advantages, there's a downside: it is not possible with
> Cairo to include EPS files in PDF output. Yet this is the only way
> today to include images, via the \epsfile markup command.
>
> To address this limitation, we're considering adding support for more
> image formats than EPS. We will likely add PNG. However, because PNG
> is a raster graphics format while EPS can contain vector graphics
> (https://en.wikipedia.org/wiki/Vector_graphics), we'd like to add a
> vector graphics format as well. Basically, the contenders are PDF
> and SVG. However, each of them requires adding dependencies, so we'd
> rather not have them both.
>
> Which leads to the question in this straw poll: would it be more useful
> for you to be able to insert SVG or PDF images? Keep in mind that both
> can be converted into each other seamlessly, so the question is mainly
> what will be most useful for a majority of people.
>
> Thanks,
> Jean
>
>


Feedback request on image formats

2023-01-10 Thread Jean Abou Samra

Hi,

This is a little call for feedback, especially from users of the \epsfile
markup command. (To be clear, I'm not speaking "in the name of the 
development

team", just in my name.)

Over the past year and a half, LilyPond has gained a new output
backend based on the Cairo graphics library. While this backend
has many advantages, there's a downside: it is not possible with
Cairo to include EPS files in PDF output. Yet this is the only way
today to include images, via the \epsfile markup command.

To address this limitation, we're considering adding support for more
image formats than EPS. We will likely add PNG. However, because PNG
is a raster graphics format while EPS can contain vector graphics
(https://en.wikipedia.org/wiki/Vector_graphics), we'd like to add a
vector graphics format as well. Basically, the contenders are PDF
and SVG. However, each of them requires adding dependencies, so we'd
rather not have them both.

Which leads to the question in this straw poll: would it be more useful
for you to be able to insert SVG or PDF images? Keep in mind that both
can be converted into each other seamlessly, so the question is mainly
what will be most useful for a majority of people.

Thanks,
Jean



OpenPGP_signature
Description: OpenPGP digital signature


Re: Image width issue

2023-01-10 Thread Jean Abou Samra

Le 10/01/2023 à 22:33, Rajesh Baskar a écrit :


Hi,

I have 2 staffs, one with the 3rd note hidden and another replacing 
the 3rd note with a red dot. But the 2 staffs are not having the same 
width. What do I need to do make the 2nd staff the same width as the 
1st staff. Please see the image for details and thank you all so much 
for the help.





On the first staff, you use \hideNotes, which prints a hidden note
head. On the second staff, you change the way the note head is drawn,
which makes it less wide than a normal head, hence the difference.
Try using the same markup in the first case, but transparent.

\version "2.24.0"

\language english

RedDotMarkup = \markup \with-color "#FF" \vcenter \fontsize #-1 
\musicglyph "dots.dot"

RedDot =
  \tweak text \RedDotMarkup
  \tweak stencil #ly:text-interface::print
  \tweak staff-position #0
  \etc

\header {
  tagline = ##f
}

\score {
  \new Staff \with { \omit TimeSignature }
  {
    \set Staff.midiInstrument = #"acoustic grand"
    \key c \major
    \time 5/1
    \clef bass
    g,1 a,
    \tweak transparent ##t %% Comment or uncomment this line
    \RedDot b,
    c d
    \bar "||"
  }
  \layout {
    \context {
  \Score proportionalNotationDuration = #(ly:make-moment 1/2)
    }
  }
}


Best,
Jean




OpenPGP_signature
Description: OpenPGP digital signature


Image width issue

2023-01-10 Thread Rajesh Baskar

Hi,

I have 2 staffs, one with the 3rd note hidden and another replacing the 
3rd note with a red dot. But the 2 staffs are not having the same width. 
What do I need to do make the 2nd staff the same width as the 1st staff. 
Please see the image for details and thank you all so much for the help.


Raj


\version "2.22.0" \language english \header {tagline = ##f} \score {\new 
Staff \with {\omit TimeSignature}

   {\set Staff.midiInstrument = #"Acoustic Grand Piano"
    \key c \major \time 5/1 \clef bass g,1 a, \hideNotes b, 
\unHideNotes c d \bar "||"}
   \layout {\context { \Score proportionalNotationDuration 
= #(ly:make-moment 1/2) } } \midi { \tempo 1 = 72}}


\version "2.22.2" \language english
RedDotMarkup = \markup \vcenter \with-color "#FF" \fontsize #-1 
\musicglyph "dots.dot"
RedDot = \tweak text \RedDotMarkup \tweak stencil 
#ly:text-interface::print \tweak staff-position #0 \etc

\header { tagline = ##f } \score {\new Staff \with {\omit TimeSignature }
  {\set Staff.midiInstrument = 
#"Acoustic Grand Piano"
    \key c \major \time 5/1 \clef bass g,1 a, \RedDot b, c d \bar 
"||"}
    \layout { \context { \Score proportionalNotationDuration = 
#(ly:make-moment 1/2) } } }



issue

New list admin

2023-01-10 Thread Jean Abou Samra

Hi,

As per the discussion last October
(https://lists.gnu.org/archive/html/lilypond-user/2022-10/msg00047.html)
I have been made an admin for the lilypond-user, lilypond-devel
and bug-lilypond mailing lists. (If you're wondering, there was
some delay on the GNU side).

I don't view this as holding some kind of authority, but just
being responsible for some administrivia, namely rejecting spam and
accepting the rest, and providing assistance in case people need
help with using the list.

I have updated the list info pages such as
https://lists.gnu.org/mailman/listinfo/lilypond-user
to include some useful information and make the
subscription options easier to find. (The new style
was borrowed from the lilypond-user-fr list info page,
originally written by Valentin Villenave, thank
you Valentin.)

I have also removed the footer that got inserted
at the bottom of each post on bug-lilypond, because
neither lilypond-user nor lilypond-devel do this, and
as someone noted some time ago, it breaks DKIM signatures.

In order to increase the bus factor, I would like to
nominate one or two other regulars as admins. If you
feel like it, please let me know.

Best,
Jean



OpenPGP_signature
Description: OpenPGP digital signature


Re: Resize \rhythm in mixed markup

2023-01-10 Thread Thomas Morley
Am Di., 10. Jan. 2023 um 02:44 Uhr schrieb David Kastrup :
>
> Thomas Morley  writes:
>
> > Am So., 8. Jan. 2023 um 10:21 Uhr schrieb Thomas Morley
> > :
> >>
> >> Hi,
> >>
> >> consider below
> >>
> >> \version "2.24.0"
> >>
> >> \score {
> >>   { g'1^\markup { My Rhythm \rhythm { 8[ 8] } } }
> >>   \layout {
> >> \context {
> >>   \StandaloneRhythmStaff
> >>   fontSize = #6
> >> }
> >>   }
> >> }
> >>
> >> I'll have numerous such markups combining straight text and \rhythm.
> >> Thus I'd like to have a method to adjust the \rhythm-part in a
> >> score-layout without affecting other parts of TextScripts.
> >> Alas the setting fontSize takes no effect.
> >>
> >> How to?
> >>
> >> Cheers,
> >>   Harm
> >
> > Actually it works, if the \layout is placed toplevel.
> > A bug?
>
> Try 
>
> --
> David Kastrup

Hi David,

I used below test-code and commented/uncommented the color settings.

\layout {
  \context {
\StandaloneRhythmScore
\override NoteHead.color = #red
  }
  \context {
\StandaloneRhythmStaff
\override NoteHead.color = #green
  }
  \context {
\StandaloneRhythmVoice
\override NoteHead.color = #blue
  }
}

\markup \rhythm { { 2 } }

\score {
  { g^\markup \rhythm { { 1 } } }
  \layout {
\context {
  \StandaloneRhythmScore
  \override NoteHead.color = #cyan
}
\context {
  \StandaloneRhythmStaff
  \override NoteHead.color = #yellow
}
\context {
  \StandaloneRhythmVoice
  \override NoteHead.color = #grey
}
  }
}

Afaict, it works fine, the score-layout is taken into account and
takes precedence over the toplevel one.
Very nice!

No idea why the pipeline fails for !1810 ...

Many thanks for your work!

Best,
  H>arm



Re: Getting readline to work in scheme-sandbox

2023-01-10 Thread Kevin Cole
On Tue, Jan 10, 2023 at 2:38 PM David Wright  wrote:
>
> On Tue 10 Jan 2023 at 10:34:19 (-0500), Kevin Cole wrote:
> > An old thread at
> > https://mail.gnu.org/archive/html/lilypond-user/2020-01/msg00350.html
> > finished up with:
> >
> > > From:Michael Käppler
> > > Subject:Re: Getting readline to work in scheme-sandbox
> > > Date:Fri, 17 Jan 2020 23:22:38 +0100
> > >
> > > Am 17.01.2020 um 00:32 schrieb Knute Snortum:
> > >
> > >> That did it!  Thanks!
> > >
> > > Nice to hear, a very ugly 'fix', though. I will continue investigating.
> >
> > Is there a more beautiful fix three years later?
>
> The last thing I remember reading about this here was:
>
> https://lists.gnu.org/archive/html/lilypond-user/2022-05/msg00185.html
>
> Cheers,
> David.

...and, reading more of that archive thread suggests rlwrap -- or,
upon further investigation, rlfe or ledit -- will get me what I need.
(I haven't installed any of them yet, but I'll give them a try and see
if one is more featureful than another.)



Re: Getting readline to work in scheme-sandbox

2023-01-10 Thread Kevin Cole
On Tue, Jan 10, 2023 at 2:38 PM David Wright  wrote:
>
> On Tue 10 Jan 2023 at 10:34:19 (-0500), Kevin Cole wrote:
> > An old thread at
> > https://mail.gnu.org/archive/html/lilypond-user/2020-01/msg00350.html
> > finished up with:
> >
> > > From:Michael Käppler
> > > Subject:Re: Getting readline to work in scheme-sandbox
> > > Date:Fri, 17 Jan 2020 23:22:38 +0100
> > >
> > > Am 17.01.2020 um 00:32 schrieb Knute Snortum:
> > >
> > >> That did it!  Thanks!
> > >
> > > Nice to hear, a very ugly 'fix', though. I will continue investigating.
> >
> > Is there a more beautiful fix three years later?
>
> The last thing I remember reading about this here was:
>
> https://lists.gnu.org/archive/html/lilypond-user/2022-05/msg00185.html
>
> Cheers,
> David.

Ah. Thanks. Rather than fuss with recompiling, etc., I'll live without
the feature (and remember not to use the up arrow) then.



Re: Getting readline to work in scheme-sandbox

2023-01-10 Thread David Wright
On Tue 10 Jan 2023 at 10:34:19 (-0500), Kevin Cole wrote:
> An old thread at
> https://mail.gnu.org/archive/html/lilypond-user/2020-01/msg00350.html
> finished up with:
> 
> > From:Michael Käppler
> > Subject:Re: Getting readline to work in scheme-sandbox
> > Date:Fri, 17 Jan 2020 23:22:38 +0100
> >
> > Am 17.01.2020 um 00:32 schrieb Knute Snortum:
> >
> >> That did it!  Thanks!
> >
> > Nice to hear, a very ugly 'fix', though. I will continue investigating.
> 
> Is there a more beautiful fix three years later?

The last thing I remember reading about this here was:

https://lists.gnu.org/archive/html/lilypond-user/2022-05/msg00185.html

Cheers,
David.


Re: Is there a simple way to test for command line options?

2023-01-10 Thread Jean Abou Samra

Le 10/01/2023 à 19:11, Timothy Lanfear a écrit :
The function ly:command-line-options returns a string with all the -d 
options. The backend option is set to svg when when generating svg 
output and absent by default.


\version "2.22.0"

#(let* ((options (ly:command-line-options))
    (svg (string-contains options "(backend . svg)")))
  (if (integer? svg) (ly:message "svg") (ly:message "not svg")))

{
  c''1
}





In recent versions, this is not always true: if you compile with the Cairo
backend, using -dbackend=cairo, the 'backend option is set to 'cairo
regardless of the output format. In fact, in the Cairo backend, you
can generate PDF and SVG in the same LilyPond invocation. Therefore,
I think it's best to use either environment variables, or the
-e / --evaluate option described here:

https://lilypond.org/doc/v2.24/Documentation/usage/command_002dline-usage#basic-command-line-options-for-lilypond

Best,
Jean



OpenPGP_signature
Description: OpenPGP digital signature


Re: Is there a simple way to test for command line options?

2023-01-10 Thread Timothy Lanfear

On 09/01/2023 23:00, Kevin Cole wrote:

Is there a way, within a .ly file to conditionally include sections
based on command line options?

Specifically, I would like to have \paper settings go one way for
"lilypond --pdf" and another way for "lilypond --svg".


The function ly:command-line-options returns a string with all the -d 
options. The backend option is set to svg when when generating svg 
output and absent by default.


\version "2.22.0"

#(let* ((options (ly:command-line-options))
    (svg (string-contains options "(backend . svg)")))
  (if (integer? svg) (ly:message "svg") (ly:message "not svg")))

{
  c''1
}

--
Timothy Lanfear, Bristol, UK.


Re: Getting readline to work in scheme-sandbox

2023-01-10 Thread Kevin Cole
An old thread at
https://mail.gnu.org/archive/html/lilypond-user/2020-01/msg00350.html
finished up with:

> From:Michael Käppler
> Subject:Re: Getting readline to work in scheme-sandbox
> Date:Fri, 17 Jan 2020 23:22:38 +0100
>
> Am 17.01.2020 um 00:32 schrieb Knute Snortum:
>
>> That did it!  Thanks!
>
> Nice to hear, a very ugly 'fix', though. I will continue investigating.

Is there a more beautiful fix three years later?

To summarize:
__

$ lilypond scheme-sandbox
GNU LilyPond 2.22.1
Processing `/usr/share/lilypond/2.22.1/ly/scheme-sandbox.ly'
Parsing...
/usr/share/lilypond/2.22.1/ly/scheme-sandbox.ly:21:2: \
   error: GUILE signaled an error for the expression beginning here
#
 (load-user-init)
file: "libguilereadline-v-17", message: "file not found"

guile>
__

And there is no "libguilereadline*" file anywhere on my system.

I'm on a Pop! OS 22.04 system, using .deb packages as much as possible
and not constantly chasing my tail with git pulls and recompiles. So,
I'm currently at LilyPond v. 2.22. Searching dpkg for likely suspects
/ relevant-sounding packages yields:

guile-2.2-libs:amd64 2.2.7+1-6build2
guile-3.03.0.7-1
guile-3.0-libs:amd64 3.0.7-1
libreadline-dev:amd648.1.2-1
libreadline7:amd64   0~7.0-3
libreadline8:amd64   8.1.2-1
lilypond 2.22.1-2
lilypond-data2.22.1-2
readline-common  8.1.2-1



Re: Is there a simple way to test for command line options?

2023-01-10 Thread David Zelinsky
Kevin Cole  writes:

> On Mon, Jan 9, 2023 at 7:07 PM Hans Aikema  wrote:
>
>> On 10 Jan 2023, at 00:01, Kevin Cole  wrote:
>>
>> Is there a way, within a .ly file to conditionally include sections
>> based on command line options?
>>
>> Specifically, I would like to have \paper settings go one way for
>> "lilypond --pdf" and another way for "lilypond --svg".
>>
>>
>> Kevin,
>>
>> don't know of a way with inspecting commandline options, but if
>> environment variables will do for your case: I have the following pattern
>> in use to switch between two page layouts that mainly differ in the \paper
>> block
>>
>> myLayout = #(string-append "layout/" (getenv "MY_BASE") 
>> "PageSetup.ily")\include \myLayout
>>
>>
> Not quite what I was hoping for, but, yes, thanks. I believe I can make
> that work reasonably nicely for me. (I can use the environment variable in
> a shell script to choose the CLI options as well as in the wee bit you
> included, effectively achieving the same thing.)


Just an observation that you can set an environment variable for a
particular command on the command line, by preceding the command with
it:

%  MY_BASE=something lilypond file.ly

That will set MY_BASE to "something" in the environment of the lilypond
process.  Still not what you were asking for, but maybe simpler than
using a shell script, and not much different from using a command
option.

-David




Re: Question about custom articulation

2023-01-10 Thread Rip _Mus
Hi,
thank you for all the comments, I'll make these corrections!

Best regards

Il mar 10 gen 2023, 12:28 Jean Abou Samra  ha scritto:

> Le 10/01/2023 à 08:12, Rip _Mus a écrit :
> > Hello,
> > I'm trying to define a new articulation, based on two stencils (above
> > and below the staff), that I wrote.
> > I succeeded in making two distinct articulations. However, the attempt
> > to create a single articulation, which chooses the stencil based on
> > the direction specified in the post-event, failed.
> > Does anyone have any advice for me?
>
>
>
> In the script definition, you put
>
> (stencil . (lAccUpStencil . lAccDownStencil))
>
> which is ignored because a pair is not a valid stencil value.
> (Also, you forgot unquotes, so it's a pair of symbols, not
> a pair of stencils.)
>
> Instead, try using a callback:
>
> (stencil . ,lAccStencil)
>
> after having defined
>
> #(define (lAccStencil grob)
> (if (eqv? UP (ly:grob-property grob 'direction))
> lAccUpStencil
> lAccDownStencil))
>
>
> Another comment: do not do this
>
> #(append! default-script-alist (list ...))
>
> because
>
> - it mutates the built-in default, so even if you put the scriptDefinitions
>change in a \layout local to a \score, it will affect all scores.
>
> - whether append! actually modifies the original list is not specified.
>Example:
>
>
> $ ~/lilies/2.24.0/bin/lilypond scheme-sandbox
> GNU LilyPond 2.24.0 (running Guile 2.2)
> Traitement de
> « /home/jean/lilies/2.24.0/share/lilypond/2.24.0/ly/scheme-sandbox.ly »
> Analyse...
> GNU Guile 2.2.7
> Copyright (C) 1995-2019 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(#{ g100}#)> (define lst (list 'a 'b 'c))
> scheme@(#{ g100}#)> (append! lst '(d e f))
> $1 = (a b c d e f)
> scheme@(#{ g100}#)> lst
> $2 = (a b c d e f)
> scheme@(#{ g100}#)> (define lst2 (list))
> scheme@(#{ g100}#)> (append! lst2 '(d e f))
> $3 = (d e f)
> scheme@(#{ g100}#)> lst2 ;; still empty
> $4 = ()
>
>
> Instead, you should save the result in a variable. Also, do not
> use the mutating append! but the non-mutating append. Even better,
> it's more efficient in Scheme to add things at the beginning
> of a list rather than at the end [1], so make that
>
> #(define my-script-alist
> (cons*
>  `(little-accent-up
> . (
> (stencil . ,lAccUpStencil)
> (toward-stem-shift-in-column . 0.0)
> (padding . 0.20)
> (avoid-slur . around)
> (direction . ,UP)))
>  `(little-accent-down
> . (
> (stencil . ,lAccDownStencil)
> (toward-stem-shift-in-column . 0.0)
> (padding . 0.20)
> (avoid-slur . around)
> (direction . ,DOWN)))
>  `(little-accent
> . (
> (stencil . ,lAccStencil)
> (toward-stem-shift-in-column . 0.0)
> (padding . 0.20)
> (avoid-slur . around)
> (direction . ,UP)))
>  default-script-alist))
>
> \layout {
>\context {
>  \Score
>  scriptDefinitions = #my-script-alist
>}
> }
>
>
> [1]
>
> https://tutoriel-scheme.readthedocs.io/en/latest/listes.html#operations-de-base
> and
>
> https://tutoriel-scheme.readthedocs.io/en/latest/recursivite.html#retour-sur-les-listes
> might help you understand why.
>
> Best,
> Jean
>
>


Re: Question about custom articulation

2023-01-10 Thread Jean Abou Samra

Le 10/01/2023 à 08:12, Rip _Mus a écrit :

Hello,
I'm trying to define a new articulation, based on two stencils (above 
and below the staff), that I wrote.
I succeeded in making two distinct articulations. However, the attempt 
to create a single articulation, which chooses the stencil based on 
the direction specified in the post-event, failed.

Does anyone have any advice for me?




In the script definition, you put

   (stencil . (lAccUpStencil . lAccDownStencil))

which is ignored because a pair is not a valid stencil value.
(Also, you forgot unquotes, so it's a pair of symbols, not
a pair of stencils.)

Instead, try using a callback:

   (stencil . ,lAccStencil)

after having defined

#(define (lAccStencil grob)
   (if (eqv? UP (ly:grob-property grob 'direction))
   lAccUpStencil
   lAccDownStencil))


Another comment: do not do this

#(append! default-script-alist (list ...))

because

- it mutates the built-in default, so even if you put the scriptDefinitions
  change in a \layout local to a \score, it will affect all scores.

- whether append! actually modifies the original list is not specified.
  Example:


$ ~/lilies/2.24.0/bin/lilypond scheme-sandbox
GNU LilyPond 2.24.0 (running Guile 2.2)
Traitement de 
« /home/jean/lilies/2.24.0/share/lilypond/2.24.0/ly/scheme-sandbox.ly »

Analyse...
GNU Guile 2.2.7
Copyright (C) 1995-2019 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(#{ g100}#)> (define lst (list 'a 'b 'c))
scheme@(#{ g100}#)> (append! lst '(d e f))
$1 = (a b c d e f)
scheme@(#{ g100}#)> lst
$2 = (a b c d e f)
scheme@(#{ g100}#)> (define lst2 (list))
scheme@(#{ g100}#)> (append! lst2 '(d e f))
$3 = (d e f)
scheme@(#{ g100}#)> lst2 ;; still empty
$4 = ()


Instead, you should save the result in a variable. Also, do not
use the mutating append! but the non-mutating append. Even better,
it's more efficient in Scheme to add things at the beginning
of a list rather than at the end [1], so make that

#(define my-script-alist
   (cons*
    `(little-accent-up
   . (
   (stencil . ,lAccUpStencil)
   (toward-stem-shift-in-column . 0.0)
   (padding . 0.20)
   (avoid-slur . around)
   (direction . ,UP)))
    `(little-accent-down
   . (
   (stencil . ,lAccDownStencil)
   (toward-stem-shift-in-column . 0.0)
   (padding . 0.20)
   (avoid-slur . around)
   (direction . ,DOWN)))
    `(little-accent
   . (
   (stencil . ,lAccStencil)
   (toward-stem-shift-in-column . 0.0)
   (padding . 0.20)
   (avoid-slur . around)
   (direction . ,UP)))
    default-script-alist))

\layout {
  \context {
    \Score
    scriptDefinitions = #my-script-alist
  }
}


[1] 
https://tutoriel-scheme.readthedocs.io/en/latest/listes.html#operations-de-base
and 
https://tutoriel-scheme.readthedocs.io/en/latest/recursivite.html#retour-sur-les-listes

might help you understand why.

Best,
Jean



OpenPGP_signature
Description: OpenPGP digital signature