Re: Help with some lyrics gymnastics

2024-01-17 Thread Matthew Fong
Thank you again, Thomas. I'm going to try this out this week!

Matt


Re: Help with some lyrics gymnastics

2024-01-15 Thread Matthew Fong
Hello Thomas,

That works splendidly. Thank you. The NullVoice is a new concept to me, and
seems necessary here.

I also found the same LSR example and was working through trying to
understand it.


Many thanks,
mattfong


Re: Help using a Scheme variable in a function

2024-01-06 Thread Matthew Fong
Ah ha! Thank you, David!

\override #`(line-width . ,rubricsWidthSU) does indeed work. I have to be
mindful of the environment I'm using the variable in.


Many thanks,
mattfong

On Sat, Jan 6, 2024 at 3:43 PM David Kastrup  wrote:

> David Kastrup  writes:
>
> > David Kastrup  writes:
> >
> >> Matthew Fong  writes:
> >>
> >>> I tried the following inside the function, and all generate errors. I
> would
> >>> like to use the value of rubricsWidthSU in this override.
> >>>
> >>> \override #'(line-width . \rubricsWidthSU)
> >>> \override #'(line-width . #rubricsWidthSU)
> >>> \override #'(line-width . ,rubricsWidthSU)
> >>
> >> The third one is perfect once you fix the difference between ' ("quote")
> >> and ` ("backquote").  , ("comma") is only heeded within a backquote.
> >
> > Oops, sorry.  The nomenclature is , ("unquote") rather than , ("comma").
>
> Sigh.  And while I am at it: ` ("quasiquote") rather than ` ("unquote").
>
> --
> David Kastrup
>


Re: Help using a Scheme variable in a function

2024-01-06 Thread Matthew Fong
I tried the following inside the function, and all generate errors. I would
like to use the value of rubricsWidthSU in this override.

\override #'(line-width . \rubricsWidthSU)
\override #'(line-width . #rubricsWidthSU)
\override #'(line-width . ,rubricsWidthSU)


Many thanks,
mattfong

On Sat, Jan 6, 2024 at 3:21 PM Matthew Fong  wrote:

> Hello everyone,
>
> I'm feeling somewhat confounded by LilyPond Scheme variables.
>
> I've created some global variables that I want to use in functions so I
> change up some custom spacing only one (as these may vary with staff size)
>
> I defined the following
> #(define kOneStaffUnitInInches 0.0761)
> #(define kContentWidthInches 6.5)
>
> #(define halfInchSU (/ 0.5 kOneStaffUnitInInches))
> #(define contentWidthSU (/ kContentWidthInches kOneStaffUnitInInches))
> #(define rubricsWidthSU (/ (- kContentWidthInches 0.5)
> kOneStaffUnitInInches))
>
> And wrote this function:
> rubricsTest =
> #(define-scheme-function
> (text)
> (markup-list?)
> #{ \markup
> \line {
> \hspace #halfInchSU
> \override #'(line-width . 78.84)
> \wordwrap #text
> }
> #}
> )
>
> \rubricsTest \markuplist { Although it is provided with its own Preface,
> this Eucharistic Prayer may also be used with other Prefaces, especially
> those that present an overall view of the mystery of salvation, such as the
> Common Prefaces. }
>
> -
>
> I can get \hspace to happily use the variable halfInchSU. However, I
> cannot seem to use the variable rubricsWidthSU with \override
> #'(line-width . 78.84).
>
> I must be missing something very simple?
>
>
> Many thanks,
> mattfong
>
>
>
>


Help using a Scheme variable in a function

2024-01-06 Thread Matthew Fong
Hello everyone,

I'm feeling somewhat confounded by LilyPond Scheme variables.

I've created some global variables that I want to use in functions so I
change up some custom spacing only one (as these may vary with staff size)

I defined the following
#(define kOneStaffUnitInInches 0.0761)
#(define kContentWidthInches 6.5)

#(define halfInchSU (/ 0.5 kOneStaffUnitInInches))
#(define contentWidthSU (/ kContentWidthInches kOneStaffUnitInInches))
#(define rubricsWidthSU (/ (- kContentWidthInches 0.5)
kOneStaffUnitInInches))

And wrote this function:
rubricsTest =
#(define-scheme-function
(text)
(markup-list?)
#{ \markup
\line {
\hspace #halfInchSU
\override #'(line-width . 78.84)
\wordwrap #text
}
#}
)

\rubricsTest \markuplist { Although it is provided with its own Preface,
this Eucharistic Prayer may also be used with other Prefaces, especially
those that present an overall view of the mystery of salvation, such as the
Common Prefaces. }

-

I can get \hspace to happily use the variable halfInchSU. However, I cannot
seem to use the variable rubricsWidthSU with \override #'(line-width .
78.84).

I must be missing something very simple?


Many thanks,
mattfong


Re: Inter-staff bar line for ChoirStaff?

2022-03-18 Thread Matthew Fong
Dear Valentine and Jean,

Many thanks for the help and documentation. I think once upon a time Aaron
or someone else gave me the link. Good to have it again.


mattfong

On Fri, Mar 18, 2022 at 3:08 PM Valentin Petzel  wrote:

> Hello Matthew,
>
> and or can be done by (or ...), like (or somthing1 somthing2) (though you
> can
> have any amount of arguments).
>
> But at some points you might want to do something like this:
>
> \version "2.22.2"
>
> #(define spanbars
>'("||" "|." ":|." ".|:" ":|.|:"))
>
> \layout {
>\context {
>  \ChoirStaff
>  \consists Span_bar_engraver
>  \override BarLine.allow-span-bar =
>  #(lambda (grob)
> (member (ly:grob-property grob 'glyph)
> spanbars))
>}
> }
>
> \new ChoirStaff <<
>\new Staff { 1 1 \bar "||" 1 \bar ":|." 1 \bar ".|:" 1 \bar ":|.|:" 1
> \bar
> "|." }
>\new Staff { \repeat unfold 6 c'1 }
>  >>
>
> or if you want to span anything BUT a normal barline you might want to use
>
> (not (equal? (ly:grob-property grob 'glyph) "|"))
>
> instead.
>
> Cheers,
> Valentin
>
> Am Freitag, 18. März 2022, 22:57:33 CET schrieb Matthew Fong:
> > Hello Valentin,
> >
> > Awesome. I've been wanting to learn more Scheme! I just need to figure
> out
> > OR statements to get a final bar!
> >
> >
> > Many thanks,
> > mattfong
> >
> > On Thu, Mar 17, 2022 at 7:11 PM Valentin Petzel 
> wrote:
> > > Hello Matthew,
> > >
> > > if you want you can even automatise this:
> > >
> > > \version "2.22.2"
> > >
> > > \layout {
> > >
> > >\context {
> > >
> > >  \ChoirStaff
> > >  \consists Span_bar_engraver
> > >  \override BarLine.allow-span-bar =
> > >  #(lambda (grob)
> > >
> > > (equal? (ly:grob-property grob 'glyph)
> > >
> > > "||"))
> > >
> > >}
> > >
> > > }
> > >
> > >
> > > \new ChoirStaff <<
> > >
> > >\new Staff { 1 1 \bar "||" 1 }
> > >\new Staff { 1 1 1 }
> > >
> > > Cheers,
> > > Valentin
> > >
> > > Am Freitag, 18. März 2022, 00:44:46 CET schrieb Matthew Fong:
> > > > Dear Jean,
> > > >
> > > > Grazie mille! This is exactly what I was looking for:
> > > > [image: Screen Shot 2022-03-17 at 16.43.13.png]
> > > >
> > > > Many thanks,
> > > > mattfong
> > > >
> > > > On Thu, Mar 17, 2022 at 3:55 PM Jean Abou Samra 
> > >
> > > wrote:
> > > > > Le 17/03/2022 à 23:22, Matthew Fong a écrit :
> > > > > > Hello Jean,
> > > > > >
> > > > > > I only want the bar lines interstaff at the double bar, and not
> at
> > > > > > every measure. The purpose is this helps better visually mark the
> > > > > > end
> > > > > > of a phrase.
> > > > > >
> > > > > > I'm also trying to avoid Mensurstriche layout, since the choir
> > >
> > > doesn't
> > >
> > > > > > seem to like it very much.
> > > > > >
> > > > > >
> > > > > > Many thanks,
> > > > > > mattfong
> > > > >
> > > > > Ah, sorry, I misread completely. You could do
> > > > >
> > > > > \version "2.22.2"
> > > > >
> > > > > \layout {
> > > > >
> > > > >\context {
> > > > >
> > > > >  \ChoirStaff
> > > > >  \consists Span_bar_engraver
> > > > >  \override BarLine.allow-span-bar = ##f
> > > > >
> > > > >}
> > > > >
> > > > > }
> > > > >
> > > > > spanBarHere = \once \override ChoirStaff.BarLine.allow-span-bar =
> ##t
> > > > >
> > > > >
> > > > > \new ChoirStaff <<
> > > > >
> > > > >\new Staff { 1 1 \spanBarHere \bar "||" 1 }
> > > > >\new Staff { 1 1 1 }
>
>


Re: Inter-staff bar line for ChoirStaff?

2022-03-18 Thread Matthew Fong
Hello Valentin,

Awesome. I've been wanting to learn more Scheme! I just need to figure out
OR statements to get a final bar!


Many thanks,
mattfong

On Thu, Mar 17, 2022 at 7:11 PM Valentin Petzel  wrote:

> Hello Matthew,
>
> if you want you can even automatise this:
>
> \version "2.22.2"
>
> \layout {
>\context {
>  \ChoirStaff
>  \consists Span_bar_engraver
>  \override BarLine.allow-span-bar =
>  #(lambda (grob)
> (equal? (ly:grob-property grob 'glyph)
> "||"))
>}
> }
>
>
> \new ChoirStaff <<
>\new Staff { 1 1 \bar "||" 1 }
>\new Staff { 1 1 1 }
>  >>
>
> Cheers,
> Valentin
>
> Am Freitag, 18. März 2022, 00:44:46 CET schrieb Matthew Fong:
> > Dear Jean,
> >
> > Grazie mille! This is exactly what I was looking for:
> > [image: Screen Shot 2022-03-17 at 16.43.13.png]
> >
> > Many thanks,
> > mattfong
> >
> > On Thu, Mar 17, 2022 at 3:55 PM Jean Abou Samra 
> wrote:
> > > Le 17/03/2022 à 23:22, Matthew Fong a écrit :
> > > > Hello Jean,
> > > >
> > > > I only want the bar lines interstaff at the double bar, and not at
> > > > every measure. The purpose is this helps better visually mark the end
> > > > of a phrase.
> > > >
> > > > I'm also trying to avoid Mensurstriche layout, since the choir
> doesn't
> > > > seem to like it very much.
> > > >
> > > >
> > > > Many thanks,
> > > > mattfong
> > >
> > > Ah, sorry, I misread completely. You could do
> > >
> > > \version "2.22.2"
> > >
> > > \layout {
> > >
> > >\context {
> > >
> > >  \ChoirStaff
> > >  \consists Span_bar_engraver
> > >  \override BarLine.allow-span-bar = ##f
> > >
> > >}
> > >
> > > }
> > >
> > > spanBarHere = \once \override ChoirStaff.BarLine.allow-span-bar = ##t
> > >
> > >
> > > \new ChoirStaff <<
> > >
> > >\new Staff { 1 1 \spanBarHere \bar "||" 1 }
> > >\new Staff { 1 1 1 }
>
>


Re: Inter-staff bar line for ChoirStaff?

2022-03-17 Thread Matthew Fong
Dear Jean,

Grazie mille! This is exactly what I was looking for:
[image: Screen Shot 2022-03-17 at 16.43.13.png]

Many thanks,
mattfong

On Thu, Mar 17, 2022 at 3:55 PM Jean Abou Samra  wrote:

>
>
> Le 17/03/2022 à 23:22, Matthew Fong a écrit :
> > Hello Jean,
> >
> > I only want the bar lines interstaff at the double bar, and not at
> > every measure. The purpose is this helps better visually mark the end
> > of a phrase.
> >
> > I'm also trying to avoid Mensurstriche layout, since the choir doesn't
> > seem to like it very much.
> >
> >
> > Many thanks,
> > mattfong
>
>
> Ah, sorry, I misread completely. You could do
>
> \version "2.22.2"
>
> \layout {
>\context {
>  \ChoirStaff
>  \consists Span_bar_engraver
>  \override BarLine.allow-span-bar = ##f
>}
> }
>
> spanBarHere = \once \override ChoirStaff.BarLine.allow-span-bar = ##t
>
>
> \new ChoirStaff <<
>\new Staff { 1 1 \spanBarHere \bar "||" 1 }
>\new Staff { 1 1 1 }
>  >>
>
>
>
>
>


Re: Inter-staff bar line for ChoirStaff?

2022-03-17 Thread Matthew Fong
Hello Jean,

I only want the bar lines interstaff at the double bar, and not at every
measure. The purpose is this helps better visually mark the end of a phrase.

I'm also trying to avoid Mensurstriche layout, since the choir doesn't seem
to like it very much.


Many thanks,
mattfong

On Thu, Mar 17, 2022 at 3:07 PM Jean Abou Samra  wrote:

>
>
> Le 17/03/2022 à 23:03, Matthew Fong a écrit :
> > Dear LilyPonders,
> >
> > I'm using ChoirStaff to typeset some SATB vocal music, but for clarity
> > to the singers, I wanted to extend the double bar so that it is also
> > in between the bar lines. The ChoirStaff doesn't allow this per
> > LilyPond documentation
> > (
> https://lilypond.org/doc/v2.23/Documentation/notation/displaying-staves#grouping-staves
> ).
>
> Then why not use a context type that has this, like StaffGroup?
>
> Jean
>
>


Inter-staff bar line for ChoirStaff?

2022-03-17 Thread Matthew Fong
Dear LilyPonders,

I'm using ChoirStaff to typeset some SATB vocal music, but for clarity to
the singers, I wanted to extend the double bar so that it is also in
between the bar lines. The ChoirStaff doesn't allow this per LilyPond
documentation (
https://lilypond.org/doc/v2.23/Documentation/notation/displaying-staves#grouping-staves
).

I found this code from a few years back, but it doesn't seem to work for
2.22.2.
https://lists.gnu.org/archive/html/lilypond-user/2012-10/msg00088.html

Would anyone have a way to accomplish this?


Many thanks,
mattfong
[image: Screen Shot 2022-03-17 at 15.02.57.png]


Re: Cannot eliminate layout block in score block?

2022-03-13 Thread Matthew Fong
Hello David,

Many thanks for explaining that. Makes complete sense now!


mattfong

On Sat, Mar 12, 2022 at 9:35 PM David Wright 
wrote:

> On Sat 12 Mar 2022 at 20:14:41 (-0800), Matthew Fong wrote:
> > Hello Lilypond friends,
> >
> > I am working on a polyphone piece of music which employs a ChoirStaff,
> and
> > proceeded to make a local layout block in the score a global one.
> >
> > The include to make a *global* layout block works just fine, but if I
> > eliminate the layout block in the score block itself, the music no longer
> > compiles. Please see the comment starting with % [Help].
> >
> > Any ideas why this might be? Other pieces where I have only a single
> voice,
> > I rely only upon the global block from an include, and compules fine
> > without a layout block in the score block.
>
> A \score on its own will produce a PDF.
> Such a \score, with a \midi added, will produce just a MIDI.
> A \score with both \midi and \layout will produce a PDF and a MIDI.
>
> Your score has a \midi and so, without a \layout, no PDF would be produced.
>
> Cheers,
> David.
>


Cannot eliminate layout block in score block?

2022-03-12 Thread Matthew Fong
Hello Lilypond friends,

I am working on a polyphone piece of music which employs a ChoirStaff, and
proceeded to make a local layout block in the score a global one.

The include to make a *global* layout block works just fine, but if I
eliminate the layout block in the score block itself, the music no longer
compiles. Please see the comment starting with % [Help].

Any ideas why this might be? Other pieces where I have only a single voice,
I rely only upon the global block from an include, and compules fine
without a layout block in the score block.

Files are attached.

\score {

\midi {

  \tempo 4 = 130

}

\new ChoirStaff <<

  \new Staff = "CantusPrimus" \with {

 instrumentName = \markup { \bold "Cantus I" }

 shortInstrumentName = "C.I"

  }

  <<

 \new Voice = "CantusPrimus" <<

  \globalVoice

  \CantusPrimusNotes

  >>

  \new Lyrics \lyricsto "CantusPrimus" { \CantusPrimusText }

  >>

.

.

.

*% [Help] Cannot eliminate this layout block (!)*

*  \layout {*

*  } % end layout*

} % end Score



Many thanks,

mattfong


le--lectio_prima-incipit_lamentatio-victoria-new.ly
Description: Binary data


quator-vocibus-layout.ly
Description: Binary data


Re: Notehead substitution and Slur overrides

2022-03-09 Thread Matthew Fong
Hello Jean,

Many thanks for the help -- that works beautifully. It seems besides global
settings, I will need to have some per-score settings.

It appears controlling slurs are more complicated than I thought. Per your
advice, will play with the \vshape feature in 2.23 if I need anything more
custom.


Many thanks,
mattfong

On Wed, Mar 9, 2022 at 3:28 PM Jean Abou Samra  wrote:

> Le 09/03/2022 à 17:13, Matthew Fong a écrit :
> > Dear Jean and LilyPond friends,
> >
> > My apologies for not initially including this, and it took time to get
> > this reduction; At the same time, producing this example code raised
> > additional observations about how the slur overrides work with other
> > variables, which I can use some insight about. Thank you all in advance!
> >
> > Please note in the code, I have marked these observations by a comment
> > starting with: % [Interaction: ... ]. Commenting out noted lines out
> > one at a time changes the Slur override behavior, and it seems rather
> > unexpected.
> >
> > File is attached (/_reduction.ly <http://reduction.ly>/), containing
> > all the functions and the quilismaPathGreciliae PostScript path.
> >
> > *Observations for Slur above first note group without quilisma*
> > 1/ Changing the staff size has an effect on Slur overrides (Slur too
> > close to notes)
> >
> > 2/ Altering the LyricHyphen.minimum-distance has an effect on Slur
> > overrides (Slur too close to notes)
> >
> > 3/ Changing the lyrics has an effect on Slur overrides (Slur too close
> > to notes)
> >
> > 4/ Interaction between Slur override settings
> > a/ The desired result (nicer slur)
> > \override Slur.height-limit = #2.5
> > \override Slur.details.free-head-distance = #1
> > b/ Increasing Slur.height-limit results in Slur *too close* to notes
> > \override Slur.height-limit = #3
> > \override Slur.details.free-head-distance = #1
> > c/ Increasing Slur.details.free-head-distance gives the desired
> > result, similar to (a)
> > \override Slur.height-limit = #3
> > \override Slur.details.free-head-distance = #1.5
> >
> > 5/ Finally, there is the original question about why the Slur above
> > the first note group *with the quilisma* remains unaffected by any
> > Slur overrides
> >
> > *Graphical explanation*
> > /Desired result [image]
> > /
> > Slur too close [image]
> >
> >
> > Many thanks,
> > Matt
>
>
> Thanks for the examples. This seems to work better:
>
>  \override Slur.height-limit = 1
>  \override Slur.details.head-slur-distance-factor = 1
>
> Honestly, I can't explain why. Slur formatting is a very involved
> process. All these parameters only have an indirect influence on
> the slur appearance. They factor into demerits ("ugliness scores")
> that LilyPond computes for a bunch of possible slurs, to pick the
> best one. That's why you are observing all-or-nothing effects: since
> there is a staff line and LilyPond thinks the slur would be ugly
> if it came too close, depending on the specific values of the parameters,
> it will choose one way or the other, to make the slur cross the staff
> line or to make it stay below it. Also, when you change horizontal
> spacing and such, this modifies the set of configurations that
> LilyPond tests in the first place. This is all quite tricky, and
> designed to yield the best results possible using heuristics at
> the expense of not being very straightforward to tweak. Being no
> expert of the particular code, I can't tell you the details of this
> art. If you require specific slur shapes, it is best to use \shape
> to refine the control points precisely. (In 2.23, you also get
> \vshape which provides a visual aid in this process.)
>
> Best,
> Jean
>
>


Re: Notehead substitution and Slur overrides

2022-03-07 Thread Matthew Fong
Dear Jean,

My apologies for not including code. I will get an example out shortly,
along with the quilismaPathGreciliae.


Many thanks,
mattfong

On Sun, Mar 6, 2022 at 11:06 PM Jean Abou Samra  wrote:

> Le 04/03/2022 à 05:17, Matthew Fong a écrit :
> > Hello everyone,
> >
> > I am having trouble understanding why a notehead substitution function
> > would interfere with some slur overrides. Any insight or help would be
> > deeply appreciated.
>
>
> Could you please provide complete code showing the problem?
> It is currently not possible to reproduce it, as the definition
> of quilismaPathGreciliae is not included.
>
> Thanks,
> Jean
>
>


Re: Installing Alternate Music Fonts with Frescobaldi and Homebrew Installation on M1 Mac

2022-02-09 Thread Matthew Fong
Hello Jesse,

On the Mac, to place fonts in the typical location (~/Library/Fonts), you
need to modify the /opt/local/etc/fonts/local.conf file.
I am using MacPorts, which puts /etc in /opt/local; HomeBrew may place it
elsewhere.

The modification is as follows:

In the  section, add

*~/Library/Fonts*


My local.conf file


tejoseph fonts % more local.conf


 
 
  false
 
 


~/.lilypond-fonts.cache-2

*~/Library/Fonts*



Many thanks,
mattfong

On Wed, Feb 9, 2022 at 9:07 AM Mike Andrews  wrote:

> Segmentation fault indicates something seriously wrong in what Lilypond is
> seeing or doing. I don’t have any more to say than that, but it comes from
> 55+ years of fighting computers and software for a living.
>
> __
> Mike Andrews
> udsd...@gmail.com
> Amateur Radio Station W5EGO
> --
> *From:* lilypond-user 
> on behalf of Jesse Wiener 
> *Sent:* Wednesday, February 9, 2022 9:31:35 AM
> *To:* lilypond-user@gnu.org 
> *Subject:* Re: Installing Alternate Music Fonts with Frescobaldi and
> Homebrew Installation on M1 Mac
>
> Hi Valentin,
>
> After much trial and error with other things, I really thought I had it
> figured out when I did it that way. I dragged all the individual otf files
> into the otf folder so it resembled what was already there -- no
> subdirectories or anything.
>
> I tried compiling both using LilyPond directly and using Frescobaldi to no
> avail. And there are no useful details in the error message. I just get
> "Exited with return code 11" in Frescobaldi and "fatal error: failed
> filed:" and then the file name with no additional detail.
>
> I appreciate your time. Thank you!
>
> Best,
> Jesse
>
> On Wed, Feb 9, 2022 at 9:27 AM Valentin Petzel  wrote:
>
> Hello Jesse,
>
> might it be that you are installing the fonts wrongly? The font files
> should directly go into the otf folder, with no subdirectories or whatever.
>
> Valentin
>
> 09.02.2022 15:21:37 Jesse Wiener :
>
> Valentin -- That's exactly the path I've been trying to no avail. I
> tracked down that folder but the fonts just aren't being recognized as
> having been installed.
>
> Jean -- I always have a bit of anxiety that I'm missing something obvious
> when I'm planning on writing to the mailing list and this would appear to
> be such a situation :). I'll look over that thread (which I see now). Thank
> you!
>
> Best,
> Jesse
>
> On Tue, Feb 8, 2022 at 6:34 PM Valentin Petzel 
> wrote:
>
> Hello Jesse,
>
> I cannot say anything for sure (lacking a mac to try this on), but
> theoretically you just need to find the folder homebrew installs the
> packages
> to (according to the internet /usr/local/Cellar), find the folder for
> lilypond
> and and put the fonts into share/lilypond/current/fonts/
>
> Cheers,
> Valentin
>
> Am Mittwoch, 9. Februar 2022, 00:03:34 CET schrieb Jesse Wiener:
> > Hi all,
> >
> > Apologies if this has been covered. I couldn't find anything about it in
> > the archives.
> >
> > I have an M1 mac running Monterey. I use Frescobaldi and my LilyPond
> > install was done with Homebrew. It all works wonderfully well.
> >
> > My question is:
> >
> > Is there some way to install alternate music fonts with this setup?
> > Obviously there's no .app package to put the fonts into, which makes me
> > think that until we have an official LilyPond.app for recent macOS
> > releases, there might be no way around this.
> >
> > But I wanted to put it to the group. Has anyone found a workaround?
> >
> > I did try placing font files into the 'share' folder that Homebrew
> creates
> > but that didn't seem to work. Frescobaldi threw errors.
> >
> > Thank you!
> >
> > Best,
> > Jesse Wiener
>
>
>
> --
> Jesse Wiener
>
>
>
> --
> Jesse Wiener
>


Re: How to add a horizontal line after every third verse?

2021-10-16 Thread Matthew Fong
Dear Valentin,

Confirmed that was the offending line. Warning is fixed. Many thanks for
your support and help!


Pax,
mattfong

On Sat, Oct 16, 2021 at 11:51 AM Valentin Petzel  wrote:

> Hello,
>
> that warning probably comes from some \override
> VerticalAxisGroup.staff-affinity = #center I threw in there for some
> example I think. As the lyrics have staff-affinity top per default we get
> this warning (which basically say if we have some sandwiched contexts the
> lower one should not ask to be placed closer to the upper staff if the
> upper ones ask to be places closer to the lower ones.
>
> But you should be able to simply remove the line to fix the warning.
>
> Cheers,
> Valentin
>
> 16.10.2021 20:39:00 Matthew Fong :
>
> Dear Colin and Valentin,
>
> Confirmed solution works. Also have the same warning.
>
>
> Pax,
> mattfong
>
> On Sat, Oct 16, 2021 at 10:41 AM colin baguley  wrote:
>
>> Well done Valentin - that has worked!
>> Although I do get an error message :-
>> "Drawing systems...
>>
>> warning: staff-affinities should only decrease"
>>
>> But even so it works well
>>
>> Thank you
>> ===
>> Colin Baguley
>> co...@baguley.net
>> ===
>>
>>
>> On Sat, 16 Oct 2021 at 08:52, Valentin Petzel 
>> wrote:
>>
>>> Hello Matthew, hello Colin,
>>>
>>> I suspect that this is caused by the lyrics used to keep the line
>>> separator
>>> alive is too long, as it is not aligned to some voice (although I don’t
>>> get
>>> why this would keep the staff alive). So try doing
>>>
>>> \lineSep \lyricsto someVoice someLyrics
>>>
>>> And see if it solves the problem. If it doesn’t, would it be possible to
>>> append the source file (potentially in a private email if that may cause
>>> any
>>> problems), so that I can try to track down the root?
>>>
>>> Cheers,
>>> Valentin
>>>
>>> Am Samstag, 16. Oktober 2021, 03:23:22 CEST schrieb Matthew Fong:
>>> > Dear Valentin,
>>> >
>>> > I tried your solution, and it appears there is an extra stave that I
>>> cannot
>>> > seem to get rid of (or understand how it is being produced).
>>> Otherwise,
>>> > your code does what I want it to.
>>> >
>>> >
>>> > Many thanks,
>>> > mattfong
>>> >
>>> > On Fri, Oct 15, 2021 at 10:38 AM Valentin Petzel 
>>> wrote:
>>> > > Glad to hear that.
>>> > > If you look at the beginning of the code there are three #(define
>>> ... ...)
>>> > > bits. Change these values to adjust the dash to your liking (length,
>>> > > indent
>>> > > and line thickness).
>>> > >
>>> > > Cheers,
>>> > > Valentin
>>> > >
>>> > > 15.10.2021 14:31:57 colin baguley :
>>> > >
>>> > > THis looks really good - thank you so much.
>>> > > ===
>>> > > Colin Baguley
>>> > > co...@baguley.net
>>> > > ===
>>> > >
>>> > > On Thu, 14 Oct 2021 at 23:28, Valentin Petzel 
>>> wrote:
>>> > >> Hello Matthew,
>>> > >>
>>> > >> Just for instruction: To use my version simply include the part at
>>> the
>>> > >> top
>>> > >> between the %%% (line 1-35) and then add between the Lyrics
>>> contexts you
>>> > >> want
>>> > >> the dash to be
>>> > >>
>>> > >> \lineSep someLyricsToKeepContextAlive
>>> > >>
>>> > >> and add \with \adjustLyricsAboveSeparator to the Lyrics context
>>> directly
>>> > >> above
>>> > >> the separator. So you should have something like this:
>>> > >>
>>> > >> ...
>>> > >> \new Lyrics \with \adjustLyricsAboveSeparator someLyrics
>>> > >> \lineSep someLyrics
>>> > >> \new Lyrics someLyrics
>>> > >> ...
>>> > >>
>>> > >> Cheers,
>>> > >> Valentin
>>
>>


Re: How to add a horizontal line after every third verse?

2021-10-16 Thread Matthew Fong
Dear Colin and Valentin,

Confirmed solution works. Also have the same warning.


Pax,
mattfong

On Sat, Oct 16, 2021 at 10:41 AM colin baguley  wrote:

> Well done Valentin - that has worked!
> Although I do get an error message :-
> "Drawing systems...
>
> warning: staff-affinities should only decrease"
>
> But even so it works well
>
> Thank you
> ===
> Colin Baguley
> co...@baguley.net
> ===
>
>
> On Sat, 16 Oct 2021 at 08:52, Valentin Petzel  wrote:
>
>> Hello Matthew, hello Colin,
>>
>> I suspect that this is caused by the lyrics used to keep the line
>> separator
>> alive is too long, as it is not aligned to some voice (although I don’t
>> get
>> why this would keep the staff alive). So try doing
>>
>> \lineSep \lyricsto someVoice someLyrics
>>
>> And see if it solves the problem. If it doesn’t, would it be possible to
>> append the source file (potentially in a private email if that may cause
>> any
>> problems), so that I can try to track down the root?
>>
>> Cheers,
>> Valentin
>>
>> Am Samstag, 16. Oktober 2021, 03:23:22 CEST schrieb Matthew Fong:
>> > Dear Valentin,
>> >
>> > I tried your solution, and it appears there is an extra stave that I
>> cannot
>> > seem to get rid of (or understand how it is being produced). Otherwise,
>> > your code does what I want it to.
>> >
>> >
>> > Many thanks,
>> > mattfong
>> >
>> > On Fri, Oct 15, 2021 at 10:38 AM Valentin Petzel 
>> wrote:
>> > > Glad to hear that.
>> > > If you look at the beginning of the code there are three #(define ...
>> ...)
>> > > bits. Change these values to adjust the dash to your liking (length,
>> > > indent
>> > > and line thickness).
>> > >
>> > > Cheers,
>> > > Valentin
>> > >
>> > > 15.10.2021 14:31:57 colin baguley :
>> > >
>> > > THis looks really good - thank you so much.
>> > > ===
>> > > Colin Baguley
>> > > co...@baguley.net
>> > > ===
>> > >
>> > > On Thu, 14 Oct 2021 at 23:28, Valentin Petzel 
>> wrote:
>> > >> Hello Matthew,
>> > >>
>> > >> Just for instruction: To use my version simply include the part at
>> the
>> > >> top
>> > >> between the %%% (line 1-35) and then add between the Lyrics contexts
>> you
>> > >> want
>> > >> the dash to be
>> > >>
>> > >> \lineSep someLyricsToKeepContextAlive
>> > >>
>> > >> and add \with \adjustLyricsAboveSeparator to the Lyrics context
>> directly
>> > >> above
>> > >> the separator. So you should have something like this:
>> > >>
>> > >> ...
>> > >> \new Lyrics \with \adjustLyricsAboveSeparator someLyrics
>> > >> \lineSep someLyrics
>> > >> \new Lyrics someLyrics
>> > >> ...
>> > >>
>> > >> Cheers,
>> > >> Valentin
>
>


Re: How to add a horizontal line after every third verse?

2021-10-15 Thread Matthew Fong
Dear Valentin,

I tried your solution, and it appears there is an extra stave that I cannot
seem to get rid of (or understand how it is being produced). Otherwise,
your code does what I want it to.


Many thanks,
mattfong

On Fri, Oct 15, 2021 at 10:38 AM Valentin Petzel  wrote:

> Glad to hear that.
> If you look at the beginning of the code there are three #(define ... ...)
> bits. Change these values to adjust the dash to your liking (length, indent
> and line thickness).
>
> Cheers,
> Valentin
>
> 15.10.2021 14:31:57 colin baguley :
>
> THis looks really good - thank you so much.
> ===
> Colin Baguley
> co...@baguley.net
> ===
>
>
> On Thu, 14 Oct 2021 at 23:28, Valentin Petzel  wrote:
>
>> Hello Matthew,
>>
>> Just for instruction: To use my version simply include the part at the
>> top
>> between the %%% (line 1-35) and then add between the Lyrics contexts you
>> want
>> the dash to be
>>
>> \lineSep someLyricsToKeepContextAlive
>>
>> and add \with \adjustLyricsAboveSeparator to the Lyrics context directly
>> above
>> the separator. So you should have something like this:
>>
>> ...
>> \new Lyrics \with \adjustLyricsAboveSeparator someLyrics
>> \lineSep someLyrics
>> \new Lyrics someLyrics
>> ...
>>
>> Cheers,
>> Valentin
>
>


Test with Rule.pdf
Description: Adobe PDF document


Re: How to add a horizontal line after every third verse?

2021-10-14 Thread Matthew Fong
Thank you all. I will give both options a try and report back.


All the best,
mattfong

On Thu, Oct 14, 2021 at 1:25 PM Valentin Petzel  wrote:

> Hello Colin, hello Matthew,
>
> Consider this method I created for Kira a week ago.
>
> Cheers,
> Valentin


Re: considering getting a new mac that has the new M chip; does Lilypond install/run ok?

2021-09-24 Thread Matthew Fong
Hello Kenneth,

I've installed LilyPong from MacPorts, along with MacTeX on my M1 MacMini.
Alas, it's no faster than my 2019 iMac for compilation. But far more energy
efficient, and no fans at full speed when compiling hundreds of files for
PDF output. It's a wonderful computing experience.


mattfong

On Fri, Sep 24, 2021 at 4:08 PM Kenneth Wolcott 
wrote:

> HI;
>
> I'm considering getting a new mac that has the new M chip; does
> Lilypond install/run ok?
>
> If not, then I'll consider using a Docker container that runs Linux.
>
> Thanks,
> Ken Wolcott
>
>


Re: Adjusting horizontal space from notehead to bar line

2021-08-23 Thread Matthew Fong
Dear Aaron,

Brilliant! That was what was missing!


Many thanks,
mattfong

On Mon, Aug 23, 2021 at 6:23 PM Aaron Hill  wrote:

> On 2021-08-23 4:03 pm, Matthew Fong wrote:
> > Hello Hans, LilyPonders,
> >
> > Thank you! I added the line to my Staff context, and everything worked
> > as
> > expected.
> > \override BarLine.space-alist.next-note = #'(fixed-space . 1.2)
> >
> > I wanted to refine the solution and add space only *after* double-bar
> > lines, but adding the following to my bars doesn't seem to have any
> > effect
> > \once \override BarLine.space-alist.next-note = #'(fixed-space . 1.2)
> >
> > My bars section (separate from note input)
> > \skip 1*16/4 \once \override BarLine.space-alist.next-note =
> > #'(fixed-space
> > . 1.2) \bar "||"
> > \skip 1*16/4 \once \override BarLine.space-alist.next-note =
> > #'(fixed-space
> > . 1.2) \bar "||"
> > \skip 1*16/4 \once \override BarLine.space-alist.next-note =
> > #'(fixed-space
> > . 1.2) \bar "||"
> > \skip 1*8/4 \once \override BarLine.space-alist.next-note =
> > #'(fixed-space
> > . 1.2) \bar "||"
>
> You might need to be specific about context:
>
> \override Staff.BarLine...
>^^
>
> -- Aaron Hill
>


Re: Adjusting horizontal space from notehead to bar line

2021-08-23 Thread Matthew Fong
Hello Hans, LilyPonders,

Thank you! I added the line to my Staff context, and everything worked as
expected.
\override BarLine.space-alist.next-note = #'(fixed-space . 1.2)

I wanted to refine the solution and add space only *after* double-bar
lines, but adding the following to my bars doesn't seem to have any effect
\once \override BarLine.space-alist.next-note = #'(fixed-space . 1.2)

My bars section (separate from note input)
\skip 1*16/4 \once \override BarLine.space-alist.next-note = #'(fixed-space
. 1.2) \bar "||"
\skip 1*16/4 \once \override BarLine.space-alist.next-note = #'(fixed-space
. 1.2) \bar "||"
\skip 1*16/4 \once \override BarLine.space-alist.next-note = #'(fixed-space
. 1.2) \bar "||"
\skip 1*8/4 \once \override BarLine.space-alist.next-note = #'(fixed-space
. 1.2) \bar "||"


Many thanks,
mattfong

On Mon, Aug 23, 2021 at 11:52 AM Hans Aikema 
wrote:

>
>
> On 23 Aug 2021, at 17:42, Matthew Fong  wrote:
>
> 
> Hello fellow Lilyponders,
>
> I'm looking around the documentation on NoteHead to Barline spacing, and
> I'm not finding much? Any pointers will be helpful.
>
> My goal is to add a bit more space from the first note to the last
> Barline, for every measure. It seems a bit too close even with the staff
> size and LyricText size I am using. For example, the F for 'splen' in third
> measure, or the A for 'Life' after the double bar.
>
>
> Many thanks,
> mattfong
>
> 
>
>
> Matthew,
>
> Never played with layout tweaking myself, but gut feel is you should be
> able to achieve extra spacing with modification of the space-alist of the
> barline (spacing for 'first-note' and/or 'next-note')
>
> https://lilypond.org/doc/v2.22/Documentation/internals/barline
>
> kind regards,
> Hans
>


Adjusting horizontal space from notehead to bar line

2021-08-23 Thread Matthew Fong
Hello fellow Lilyponders,

I'm looking around the documentation on NoteHead to Barline spacing, and
I'm not finding much? Any pointers will be helpful.

My goal is to add a bit more space from the first note to the last Barline,
for every measure. It seems a bit too close even with the staff size and
LyricText size I am using. For example, the F for 'splen' in third measure,
or the A for 'Life' after the double bar.


Many thanks,
mattfong

[image: NoteheadSpacingToBarline.png]


Re: Extracting pitch of first note, then assign duration

2021-03-08 Thread Matthew Fong
Hello Silvain,

That's super interesting -- thank you for your link. I will take time to
read through your code. When I have access to a piano sometime, I think
Bach will certainly make the list.


Many thanks,
mattfong


Re: Writing Scheme in Lilypond to control glyph used for custom custos function

2021-03-08 Thread Matthew Fong
Hello Harm,

This is fantastic, thank you for the help. I was working through how I
would do this with case statements, but there are clearly elegant utility
functions I haven't learned about yet.

The only change I made was to reverse the 0 and the 1 in your if statement:
 (if (even? (abs staff-pos)) 1 0)


Many thanks,
mattfong

On Mon, Mar 8, 2021 at 2:55 AM Thomas Morley 
wrote:

> Am Mo., 8. März 2021 um 02:26 Uhr schrieb Matthew Fong  >:
> >
> > Hello everyone,
> >
> >
> > I'm writing a function that places a custos after the double bar to give
> singers an indication of the pitch of their next note. Usually, custos are
> are used within a piece, but in chant, I have verses that are part of new
> scores, and it is helpful to indicate the pitch of the first note.
> >
> >
> > I wanted to custos to be consistent with the intra-piece custos as I
> have set it up, that is,
> >
> >
> > 1/ Notes on the ledger line up until b' use custodes.vaticana.u1 (long
> stem up)
> >
> > 2/ Notes in between the ledger up until b' use custodes.vaticana.u0
> (short stem up)
> >
> > 3/ Notes on the ledger line from b' use ustodes.vaticana.d1 (long stem
> down)
> >
> > 4/ Notes in between the ledger from b' use custodes.vaticana.d0 (short
> stem down)
> >
> >
> > And this should work regardless of the key signature of the piece (since
> things might get transposed).
> >
> >
> > May I get some pointers of how the logic might be coded up?
> >
> >
> > Here is what I have so far, with help from this list, and taken from
> >
> >
> https://lilypond.org/doc/v2.20/Documentation/notation/substitution-function-examples
> >
> >
> > addCustos =
> >
> > #(define-music-function (noteList)
> >
> > (ly:music?)
> >
> > #{
> >
> > \tweak NoteHead.stencil #ly:text-interface::print
> >
> > \tweak NoteHead.font-size #3
> >
> > \tweak NoteHead.text \markup {
> >
> > \musicglyph "custodes.vaticana.u1"
> >
> > }
> >
> > \tweak Stem.stencil ##f
> >
> > $(first (music-pitches noteList)) 4
> >
> > #}
> >
> > )
> >
> >
> >
> > Many thanks,
> > mattfong
>
> Hi,
>
> not sure I correctly understood your conditions...
> Maybe below?
>
> addCustos =
> #(define-music-function (noteList) (ly:music?)
>   #{
> \once \override NoteHead.stencil =
>   #(lambda (grob)
>  (let* ((style (ly:grob-property grob 'style 'vaticana))
> (staff-pos (ly:grob-property grob 'staff-position))
> (glyph
>   (format #f "custodes.~a.~a~a"
> style
> (if (negative? staff-pos) "u" "d")
> (if (even? (abs staff-pos)) 0 1
>(grob-interpret-markup grob
>  (make-musicglyph-markup glyph
>
> \once \override Stem.stencil = ##f
> \once \override Flag.stencil = ##f
> \once \override Dots.stencil = ##f
> $(first (music-pitches noteList)) 4
>   #})
>
>
> mus =
> \relative {
>   a4 b c d e f g a b c d e f g a b c
> }
>
> \new Staff
>   \with { instrumentName = "Test" }
>   $(make-sequential-music
> (map addCustos (extract-named-music mus 'NoteEvent)))
>
> \relative {
>   a4 b c d e f \addCustos g g a b c d e f g a b c
> }
>
> Cheers,
>   Harm
>


Writing Scheme in Lilypond to control glyph used for custom custos function

2021-03-07 Thread Matthew Fong
Hello everyone,


I'm writing a function that places a custos after the double bar to give
singers an indication of the pitch of their next note. Usually, custos are
are used within a piece, but in chant, I have verses that are part of new
scores, and it is helpful to indicate the pitch of the first note.


I wanted to custos to be consistent with the intra-piece custos as I have
set it up, that is,


1/ Notes on the ledger line *up until b'* use custodes.vaticana.u1 (long
stem up)

2/ Notes in between the ledger *up until b'* use custodes.vaticana.u0
(short stem up)

3/ Notes on the ledger line *from b'* use ustodes.vaticana.d1 (long stem
down)

4/ Notes in between the ledger *from b'* use custodes.vaticana.d0 (short
stem down)


And this should work regardless of the key signature of the piece (since
things might get transposed).


May I get some pointers of how the logic might be coded up?


Here is what I have so far, with help from this list, and taken from

https://lilypond.org/doc/v2.20/Documentation/notation/substitution-function-examples


addCustos =

#(define-music-function (noteList)

(ly:music?)

#{

\tweak NoteHead.stencil #ly:text-interface::print

\tweak NoteHead.font-size #3

\tweak NoteHead.text \markup {

\musicglyph "custodes.vaticana.u1"

}

\tweak Stem.stencil ##f

$(first (music-pitches noteList)) 4

#}

)


Many thanks,
mattfong


Re: Extracting pitch of first note, then assign duration

2021-03-07 Thread Matthew Fong
Hello Lucas,

Yes, this works perfectly. I did not know *first* existed!

I stole the example from
https://lilypond.org/doc/v2.20/Documentation/notation/substitution-function-examples

However, I still need to find a way to automagically manage the stem
direction of the custos, since the notes may be transposed. This method
below assigns a glyph manually.

addCustos =
#(define-music-function (noteList)
(ly:music?)
#{
\tweak NoteHead.stencil #ly:text-interface::print
\tweak NoteHead.font-size #3
\tweak NoteHead.text \markup {
\musicglyph "custodes.vaticana.u2"
}
\tweak Stem.stencil ##f
$(first (music-pitches noteList)) 4
#}
)

Many thanks,
mattfong

On Sun, Mar 7, 2021 at 11:54 AM Lukas-Fabian Moser  wrote:

> Hi Matthew,
>
> Am 07.03.21 um 20:03 schrieb Matthew Fong:
> > I am in the process of writing a note replacement function that allows
> > me to place a custos anywhere I might need.
> >
> > I am stuck on writing a function that extracts the pitch of the first
> > note, given a list of notes, and then forcing a duration of 1/4. Any
> > pointers would be appreciated.
> >
> > For example given the list of notes below, I would like a function to
> > output c4.
> > {
> >   \clef treble
> >   c2 d e f
> >   g4 a b c
> > }
> >
> Something like this?
>
> \version "2.22.0"
>
> test = \relative c' {
>\clef treble
>c2 d e f
>g4 a b c
> }
>
> firstnote =
> #(define-music-function (mus dur) (ly:music? ly:duration?)
> #{ $(first (music-pitches test)) $dur #})
>
> \score {
>\firstnote \test 8
> }
>
> Lukas
>
>


Extracting pitch of first note, then assign duration

2021-03-07 Thread Matthew Fong
Hello everyone,

I am in the process of writing a note replacement function that allows me
to place a custos anywhere I might need.

I am stuck on writing a function that extracts the pitch of the first note,
given a list of notes, and then forcing a duration of 1/4. Any pointers
would be appreciated.

For example given the list of notes below, I would like a function to
output c4.
{
  \clef treble
  c2 d e f
  g4 a b c
}


Many thanks,
mattfong


Re: Setting Gregorian chant: Note spacing for two note neumes seem to depend on length of lyric text

2020-12-12 Thread Matthew Fong
Hello Aaron, everyone,

I finally resolved this issue without the use of any additional hacks. It
was necessary to set
\override SpacingSpanner.common-shortest-duration = #(ly:make-moment 1/4)

This 'squishes' everything together.


Many thanks,
mattfong

On Wed, Oct 21, 2020 at 8:07 PM Matthew Fong  wrote:

> Hello Aaron,
>
> In fact, I did try that early on. It fixed the note spacings for every
> line, except the last line. Deeper into the hole with this spacing stuff
> 
>
> I did notice that for pieces with more systems, messing with the scaling
> of the final Amen would have no impact. I have to change the *first*
> multi-note neume to use a denominator of 8 or 16, rather than the
> denominator of 5, and everything magically snaps to. So I duplicated the
> syllable function and use a larger denominator value, and gave it a name so
> I could spot where I use the work-around.
>
>
> Many thanks,
> mattfong
>
> On Wed, Oct 21, 2020 at 3:30 PM Aaron Hill 
> wrote:
>
>> On 2020-10-20 12:07 pm, Matthew Fong wrote:
>> > I've been a little puzzled by a LilyPond layout issue. I apologize in
>> > advance for the long example, so I have included the input .ly files,
>> > and
>> > sample output. The files will require some commenting and uncommenting
>> > of
>> > appropriate sections.
>> >
>> > Many thanks in advances for any insights.
>> >
>> > *Issue*
>> > Two-and-more note neume spacing using \syllable function is affected by
>> > some interaction of the *first* syllable, and the *final* Amen. It
>> > seems
>> > like LilyPond can squeeze the notes much closer together, as is seen
>> > when
>> > \syllable is not used at all (but does not result in consistent note
>> > spacing).
>>
>> Sorry, I do not have much time to dig in further.
>>
>> I notice one difference is the system count.  Have you tried forcing the
>> system count to three to see if LilyPond opts for tighter spacing?
>>
>> 
>> \paper { system-count = 3 }
>> 
>>
>> I suspect that spacing may be just at a cusp where it could fit to three
>> systems but LilyPond decides to throw in a fourth system.  Thus then the
>> notes are forced to space further apart to fill the extra system.
>>
>> Just a thought.
>>
>>
>> -- Aaron Hill
>>
>


Re: Scheme help request: How can else of an if-statement be made to do nothing?

2020-12-11 Thread Matthew Fong
Hello Aaron,

This makes sense, and the let statement is something I was missing (!)


mattfong

On Fri, Dec 11, 2020 at 12:54 PM Aaron Hill 
wrote:

> On 2020-12-11 12:30 pm, Matthew Fong wrote:
> > Hello Aaron,
> >
> >> .< Oh boy, that is *simple*. I went off the deep end on this, trying
> >> to
> > make another variable that would get assigned the color. That clearly
> > is
> > not the way Scheme works. The inline conditional is a thing of beauty.
> >
> > Looks like I need to spend more time studying Scheme syntax.
>
> Defining a variable would make sense if you needed the value in a few
> places, since that would cut down on redundant expressions.  But even if
> you only needed the value once, it sometimes makes sense to use
> variables to help keep other expressions simpler.  The \markup below is
> arguably easier to follow without the embedded Scheme expression:
>
> 
> print-if-defined =
> #(define-void-function
>(foo sym text)
>((boolean? #f) symbol? markup?)
>(let ((color (if foo '(0.8 0.2 0.2) '(0.2 0.8 0.2
> (if (defined? sym)
> (add-text #{ \markup \with-color #color #text #}
>
> symA = "Something"
>
> \print-if-defined symB "Text" % hidden
> \print-if-defined symA "Text" % shown, green
> \print-if-defined ##t symA "Text" % shown, red
> 
>
> NOTE: LilyPond's parser is able to interpret "symA" as a symbol on its
> own without needing to escape to Scheme syntax by writing #'symA.  Just
> something to keep in mind as I think it results in cleaner usage.
>
>
> -- Aaron Hill
>


Re: Scheme help request: How can else of an if-statement be made to do nothing?

2020-12-11 Thread Matthew Fong
Hello Aaron,

>.< Oh boy, that is *simple*. I went off the deep end on this, trying to
make another variable that would get assigned the color. That clearly is
not the way Scheme works. The inline conditional is a thing of beauty.

Looks like I need to spend more time studying Scheme syntax.


Many thanks,
mattfong

On Fri, Dec 11, 2020 at 12:07 PM Aaron Hill 
wrote:

> On 2020-12-11 10:43 am, Matthew Fong wrote:
> > Hello everyone,
> >
> > Resurrecting an old thread. I've been trying my hand in Scheme
> > programming,
> > via small examples on the project I'm working on.
> >
> > I wanted to extend the variable list to this function Harm wrote, to
> > take
> > an extra boolean variable, which is pretty trivial. The boolean is
> > meant to
> > change the color of the text depending if it's true or false. But I am
> > not
> > clear on how to define the color using the boolean. The trivial way to
> > do
> > it is adding a conditional under the first if, and duplicate all the
> > code
> > except the color. Is there a proper Scheme-ish way to do this?
> > (Admittingly, I have not caught on to Scheme just yet -- my brain tends
> > to
> > work with Python)
> >
> > print-if-defined =
> > #(define-void-function (sym text) (symbol? markup?)
> >   (if (defined? sym)
> >   (add-text #{ \markup \with-color #'(0.8 0.2 0.2) #text #})))
> >
> > symA = "Something"
> >
> > \print-if-defined #'symB "Text"
> > \print-if-defined #'symA "Text"
>
> Unless I am missing something from your specific use case, you should
> only need to nest another (if ...) expression in place of the actual
> color:
>
> 
> print-if-defined =
> #(define-void-function (foo sym text) ((boolean? #f) symbol? markup?)
>(if (defined? sym)
>(add-text #{ \markup \with-color
>  #(if foo '(0.8 0.2 0.2) '(0.2 0.8 0.2))
>  #text #})))
>
> symA = "Something"
>
> \print-if-defined #'symB "Text" % hidden
> \print-if-defined #'symA "Text" % shown, green
> \print-if-defined ##t #'symA "Text" % shown, red
> 
>
>
> -- Aaron Hill
>
>


Re: Scheme help request: How can else of an if-statement be made to do nothing?

2020-12-11 Thread Matthew Fong
Hello everyone,

Resurrecting an old thread. I've been trying my hand in Scheme programming,
via small examples on the project I'm working on.

I wanted to extend the variable list to this function Harm wrote, to take
an extra boolean variable, which is pretty trivial. The boolean is meant to
change the color of the text depending if it's true or false. But I am not
clear on how to define the color using the boolean. The trivial way to do
it is adding a conditional under the first if, and duplicate all the code
except the color. Is there a proper Scheme-ish way to do this?
(Admittingly, I have not caught on to Scheme just yet -- my brain tends to
work with Python)

print-if-defined =
#(define-void-function (sym text) (symbol? markup?)
  (if (defined? sym)
  (add-text #{ \markup \with-color #'(0.8 0.2 0.2) #text #})))

symA = "Something"

\print-if-defined #'symB "Text"
\print-if-defined #'symA "Text"


Many thanks,
mattfong


Re: Stanza Collision

2020-12-06 Thread Matthew Fong
Hello Fr Samuel,

It sounds like we are solving almost the same issue with note entry, and
Aaron Hill created a function which basically scales note values so that
they group together nicely. And the clutter from manual scaling is removed
entirely.

However, I am using fixed time (1/4). And to 'force' the spacing, I also
set \override SpacingSpanner.common-shortest-duration = #(ly:make-moment
1/4. This does mean that tweaking lyric spacing becomes necessary,
i.e. \override LyricSpace.minimum-distance = #1, or pushing the final bar
out further programmatically with a suggestion Kieren
provided: \once\override Staff.BarLine.extra-spacing-width = #'(-1 . 0)

The solution Aaron provided me is located in this thread:
https://lists.gnu.org/archive/html/lilypond-user/2020-10/msg00083.html

And if you want to retain rhythmic signs (such as a dot in the final note
of a phrase)
https://lists.gnu.org/archive/html/lilypond-user/2020-10/msg00120.html

Here's a sample of note entry with multi-note neumes (I've aliased the
function to mnn, or multinote neume)
chantNotes.mode-II_cd-d-de-c-def-fe-de-e = \relative c' {
% 1
\mnn { c4( d) } \mnn { d4( e) } c \mnn { d( d e) } f \mnn { f( e) }
\mnn { d( e) } e
\divisioMinima

% 2
g \mnn { g( f) } e \mnn { f( e) } d \mnn { e( d) } \mnn { c( d) } d
\divisioMinor

% 3
c \mnn { d( g) } f \mnn { f( e) } d \mnn { d( e) } \mnn { d( c) } c
\divisioMinima

% 4
c d e \mnn { f( e) } d \mnn { e( d) } \mnn { c( d) } d
}

Sample output is attached.


Many thanks,
mattfong


On Sun, Dec 6, 2020 at 12:21 PM Kieren MacMillan <
kieren_macmil...@sympatico.ca> wrote:

> Hi there,
>
> > It tightens the spacing between notes which are inside a slur so that
> the musical sense is clear without the usual bow (though, it’s a separate
> setting to actually omit the bow).  Attached are two versions of the same
> antiphon: the first uses the usual bow for slurs, the second uses the
> Slur_spacing_engraver instead.  Both are compiled from the same source
> (except for consisting the Slur_spacing_engraver and "\omit”ing the bow).
> >
> > I’m deliberately avoiding the suggestion in the manual on using a fixed
> time and tuplets because I feel that construction makes the source for the
> notes really difficult to enter and read because of all the interspersed
> durations (and the calculations necessary to figure them out).  By using
> the Slur_spacing_engraver I eliminate the need to worry about the durations
> at all and simply slur notes that belong to the same syllable  (which is
> normal practice anyway).
>
> I think an engraver like that is the right approach. The last piece of the
> solution, as I see it, is to take the syllable attached to the [first note
> of the] slur/melisma, add the "*" with some padding to the left, then reset
> the X-offset or self-alignment-X so that the syllable stays in the correct
> position relative to the note.
>
> Making this happen is currently above my Scheme pay grade, and I don’t
> have the time right now to put into it… but maybe Aaron can add that on to
> his solution without much trouble?
>
> Apologies!
> Kieren.
> 
>
> Kieren MacMillan, composer (he/him/his)
> ‣ website: www.kierenmacmillan.info
> ‣ email: kie...@kierenmacmillan.info
>
>
>


Re: Controlling bar to note spacing on final measure

2020-12-05 Thread Matthew Fong
Dear Kieren,

Thank you for the suggestions. Now I have another knob to study and play
with!
https://lilypond.org/doc/v2.20/Documentation/notation/layout-properties

My solution:
AmenBars = {
\skip 1*2/4
\once\revert Score.BarLine.stencil
\once\override Staff.BarLine.extra-spacing-width = #'(-1 . 0)
\bar "||"
}


Many thanks,
mattfong

On Sat, Dec 5, 2020 at 8:04 AM Kieren MacMillan <
kieren_macmil...@sympatico.ca> wrote:

> Hi Matthew,
>
> > Would there be a programmatic way to control the spacing of the final
> bar to the final note?
>
> If I understand correctly, all of the BarLine spacing-alist parameters
> control spacing *after* the barline.
>
> > At the moment, I just use s4 or s4. just to add a tiny bit of space so
> it doesn't feel as cramped.
>
> Well, as always, there are lots of different ways to clothe this
> particular cat…
>
> 1. spacers (as you’ve done)
>
> 2. increase the BarLine.extra-spacing-width [backwards]
>
> 3. increase the NoteHead.extra-spacing-width [forwards]
>
> 4. apply Score.NonMusicalPaperColumn.padding
>
> etc.
>
> Each has pros and cons.
> Ultimately, I prefer something other than adding a spacer… but YMMV.
>
> Hope that helps!
> Kieren.
> 
>
> Kieren MacMillan, composer (he/him/his)
> ‣ website: www.kierenmacmillan.info
> ‣ email: kie...@kierenmacmillan.info
>
>


Controlling bar to note spacing on final measure

2020-12-05 Thread Matthew Fong
Hello everyone,

Would there be a programmatic way to control the spacing of the final bar
to the final note? At the moment, I just use s4 or s4. just to add a tiny
bit of space so it doesn't feel as cramped. I do have the following
override enabled to compact the spacing of the notes for chant, which
really does make a difference in that final bar

\override SpacingSpanner.common-shortest-duration = #(ly:make-moment 1/4)

I am using \time 1/4.

I dug around the engraver documentation and found this, but it deals with
breaks.
http://lilypond.org/doc/v2.19/Documentation/source/Documentation/internals/barline


Many thanks,
mattfong


Re: Control of score visibility based on variables

2020-12-05 Thread Matthew Fong
Hello Lukas,

Many thanks for the clarification. My apologies for the belated reply since
my week got quite busy. I understand your explanation: You can also use
the question mark in the variable name, which confused me for a moment.

I think I was mixing information I read previously about predicates in
LilyPond, and thought myself restricted to the list here:
http://lilypond.org/doc/v2.20/Documentation/notation/predefined-type-predicates

I could also modify your to use a boolean explicitly:
scoreIf = #(define-void-function (some-condition score) (boolean? ly:score?)
 (if some-condition (add-score score)))

But I'm really no Scheme expert. Still hacking my way through.


Many thanks,
mattfong

On Thu, Dec 3, 2020 at 8:45 AM Lukas-Fabian Moser  wrote:

> Hi Matthew,
>
> Am 03.12.20 um 01:50 schrieb Matthew Fong:
> > ... and I will have use of question? Didn't know about that!
>
> In fact, that's just an arbitrary name for a variable! (And, to be
> honest, I wasn't completely happy with my choice.)
>
> So, the following would work just the same:
>
> scoreIf = #(define-void-function (some-condition score) (scheme? ly:score?)
>  (if some-condition (add-score score)))
>
> I would have liked to use "condition" or "cond", but these are reserved
> words in Guile, if I'm not mistaken. Maybe "print-it" would be a nice
> name: "if print-it (add-score score)" seems to be quite self-explanatory.
>
> As for the ? in "question?": By convention, names ending in "?" are used
> for "predicates", that is, functions returning only #t or #f as values.
> I seem to remember that some people extend this convention and use the ?
> also for variables that should contain boolean values (#t/#f), and
> that's what I did here.
>
> Lukas
>
>


Re: Control of score visibility based on variables

2020-12-02 Thread Matthew Fong
... and I will have use of question? Didn't know about that!

On Wed, Dec 2, 2020 at 1:49 PM Matthew Fong  wrote:

> Hello Wim and Lukas,
>
> Many thanks for chiming in. I do like the cleaner solutions. At some point
> in the future, I will turn my work over to someone else, and they get to
> figure out some of these details!
>
>
> mattfong
>
> On Wed, Dec 2, 2020 at 5:16 AM Lukas-Fabian Moser  wrote:
>
>> Hi Matthew,
>>
>> > I lifted an idea from your solution. I was looking for the
>> > if-statement, and didn't know the syntax for doing so. My
>> > solution looks like:
>> >
>> > isAmenFPO = ##t
>> >
>> > $(if (eq? isAmenFPO #t)
>> > #{
>> > \score { ...
>> > } % end score
>> > #}
>> > )
>>
>> Perhaps easier with a bit of syntactic sugar:
>>
>> \version "2.21.80"
>>
>> myFlag = ##t
>>
>> scoreIf = #(define-void-function (question? score) (scheme? ly:score?)
>> (if question? (add-score score)))
>>
>> myScore = \score {
>>{ a4 b }
>> }
>>
>> mySecondScore = \score {
>>{ c' d' }
>> }
>>
>> myThirdScore = \score {
>>{ e' f' }
>> }
>>
>> \scoreIf \myFlag \myScore
>> \scoreIf ##t \mySecondScore
>>
>> % Compilation toggles every second...
>>
>> \scoreIf #(even? (current-time)) \myThirdScore
>>
>> Lukas
>>
>>
>>


Re: Control of score visibility based on variables

2020-12-02 Thread Matthew Fong
Hello Wim and Lukas,

Many thanks for chiming in. I do like the cleaner solutions. At some point
in the future, I will turn my work over to someone else, and they get to
figure out some of these details!


mattfong

On Wed, Dec 2, 2020 at 5:16 AM Lukas-Fabian Moser  wrote:

> Hi Matthew,
>
> > I lifted an idea from your solution. I was looking for the
> > if-statement, and didn't know the syntax for doing so. My
> > solution looks like:
> >
> > isAmenFPO = ##t
> >
> > $(if (eq? isAmenFPO #t)
> > #{
> > \score { ...
> > } % end score
> > #}
> > )
>
> Perhaps easier with a bit of syntactic sugar:
>
> \version "2.21.80"
>
> myFlag = ##t
>
> scoreIf = #(define-void-function (question? score) (scheme? ly:score?)
> (if question? (add-score score)))
>
> myScore = \score {
>{ a4 b }
> }
>
> mySecondScore = \score {
>{ c' d' }
> }
>
> myThirdScore = \score {
>{ e' f' }
> }
>
> \scoreIf \myFlag \myScore
> \scoreIf ##t \mySecondScore
>
> % Compilation toggles every second...
>
> \scoreIf #(even? (current-time)) \myThirdScore
>
> Lukas
>
>
>


Re: Control of score visibility based on variables

2020-12-01 Thread Matthew Fong
Hello Vaughan,

I lifted an idea from your solution. I was looking for the
if-statement, and didn't know the syntax for doing so. My solution looks
like:

isAmenFPO = ##t

$(if (eq? isAmenFPO #t)
#{
\score { ...
} % end score
#}
)


Many thanks,
mattfong


On Tue, Dec 1, 2020 at 7:15 AM Matthew Fong  wrote:

> Hello Vaughan,
>
> Many thanks for this. I haven't read up using books. This seems like it
> will do the trick!
>
>
> mattfong
>
> On Mon, Nov 30, 2020 at 8:22 PM Vaughan McAlley 
> wrote:
>
>> On Tue, 1 Dec 2020 at 04:08, Matthew Fong  wrote:
>> >
>> > Hello everyone,
>> >
>> > I have multiple scores in my LilyPond file, and I was wondering if
>> there is a programmatic way to selectively hide and show scores based on
>> variables, or would this have to be done at the note and lyrics level?
>> >
>> >
>> > Many thanks,
>> > mattfong
>>
>> Hi Matthew,
>>
>> I used something like the attached file for a big eight-movement work…
>>
>> Cheers,
>> Vaughan
>>
>>
>>


Re: Control of score visibility based on variables

2020-12-01 Thread Matthew Fong
Hello Vaughan,

Many thanks for this. I haven't read up using books. This seems like it
will do the trick!


mattfong

On Mon, Nov 30, 2020 at 8:22 PM Vaughan McAlley 
wrote:

> On Tue, 1 Dec 2020 at 04:08, Matthew Fong  wrote:
> >
> > Hello everyone,
> >
> > I have multiple scores in my LilyPond file, and I was wondering if there
> is a programmatic way to selectively hide and show scores based on
> variables, or would this have to be done at the note and lyrics level?
> >
> >
> > Many thanks,
> > mattfong
>
> Hi Matthew,
>
> I used something like the attached file for a big eight-movement work…
>
> Cheers,
> Vaughan
>
>
>


Control of score visibility based on variables

2020-11-30 Thread Matthew Fong
Hello everyone,

I have multiple scores in my LilyPond file, and I was wondering if there is
a programmatic way to selectively hide and show scores based on variables,
or would this have to be done at the note and lyrics level?


Many thanks,
mattfong


Re: Line spacing (leading) of verses in a hymn

2020-11-27 Thread Matthew Fong
Hello Aaron,

This is clear now. Many thanks! And works really well.


mattfong

On Fri, Nov 27, 2020 at 5:10 PM Aaron Hill  wrote:

> On 2020-11-27 4:28 pm, Matthew Fong wrote:
> > Hello Aaron,
> >
> > With respect to the scale factor of 5 that you are using. Is that
> > depending
> > on staff size?
> >
> > I'm using #(layout-set-staff-size 18) at the moment.
>
> Yes, my comment mentioned the default staff space as 5pt.  That is a
> 20pt staff size divided by 4 based on the standard 5-line staff symbol.
>
> If you know you have a fixed staff size of 18pt, you could just
> calculate the distance by hand.  24/9 should be it, unless I flubbed my
> math.  But if you don't feel like doing any manual computation...
>
> 
>\override VerticalAxisGroup.nonstaff-nonstaff-spacing =
>  #(lambda (grob)
>(define (pt n)
>  (* n (ly:output-def-lookup (ly:grob-layout grob) 'pt)))
>`((basic-distance . ,(pt 12))
>  (minimum-distance . ,(pt 12))
>  (padding . 0) (stretchability . 0)))
> 
>
>
> -- Aaron Hill
>


Re: Line spacing (leading) of verses in a hymn

2020-11-27 Thread Matthew Fong
Hello Aaron,

With respect to the scale factor of 5 that you are using. Is that depending
on staff size?

I'm using #(layout-set-staff-size 18) at the moment.


Many thanks,
mattfong

On Fri, Nov 27, 2020 at 4:11 PM Matthew Fong  wrote:

> Hello Aaron,
>
> That did the trick, setting the minimum-distance. I haven't been using
> these settings, but clearly they interact. Will play around some more.
>
>
> Many thanks,
> mattfong
>
> On Fri, Nov 27, 2020 at 3:09 PM Aaron Hill 
> wrote:
>
>> On 2020-11-27 2:56 pm, Matthew Fong wrote:
>> > Hello Aaron,
>> >
>> > Ah, I didn't dig deeply enough!
>> >
>> https://lilypond.org/doc/v2.20/Documentation/notation/flexible-vertical-spacing-within-systems#within_002dsystem-spacing-properties
>> >
>> https://lilypond.org/doc/v2.20/Documentation/notation/flexible-vertical-spacing-within-systems#spacing-of-non_002dstaff-lines
>> >
>> > Your example and the documentation are in perfect accord. And I played
>> > around with it. However, when I plug it into my LilyPond file, it
>> > *compresses* considerably (!) Please see attached picture. I put all my
>> > Lyrics settings into your example and it still works as expected.
>>
>> That would be my mistake.  I forgot to also set minimum-distance so that
>> it does not compress.  My example works only because there is no
>> pressure to reduce spacing.
>>
>> Use the same value for basic-distance and minimum-distance, and it
>> should work.
>>
>>
>> -- Aaron Hill
>>
>


Re: Line spacing (leading) of verses in a hymn

2020-11-27 Thread Matthew Fong
Hello Aaron,

That did the trick, setting the minimum-distance. I haven't been using
these settings, but clearly they interact. Will play around some more.


Many thanks,
mattfong

On Fri, Nov 27, 2020 at 3:09 PM Aaron Hill  wrote:

> On 2020-11-27 2:56 pm, Matthew Fong wrote:
> > Hello Aaron,
> >
> > Ah, I didn't dig deeply enough!
> >
> https://lilypond.org/doc/v2.20/Documentation/notation/flexible-vertical-spacing-within-systems#within_002dsystem-spacing-properties
> >
> https://lilypond.org/doc/v2.20/Documentation/notation/flexible-vertical-spacing-within-systems#spacing-of-non_002dstaff-lines
> >
> > Your example and the documentation are in perfect accord. And I played
> > around with it. However, when I plug it into my LilyPond file, it
> > *compresses* considerably (!) Please see attached picture. I put all my
> > Lyrics settings into your example and it still works as expected.
>
> That would be my mistake.  I forgot to also set minimum-distance so that
> it does not compress.  My example works only because there is no
> pressure to reduce spacing.
>
> Use the same value for basic-distance and minimum-distance, and it
> should work.
>
>
> -- Aaron Hill
>


Line spacing (leading) of verses in a hymn

2020-11-27 Thread Matthew Fong
Hello everyone!

I hope everyone who celebrated Thanksgiving had a wonderful time.

My question is how is the line spacing (leading) controlled for the verses
in a hymn? The specifications I have are a 10pt font for the lyrics, with a
12pt leading (text baseline to text baseline spacing). I've attached a
picture below.

After some searching on the Internet, and looking at the LyricsText
engraver, I was not able to find
anything; VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding
definitely was not it.

For lyric font size control, I'm using this gem:
https://lists.gnu.org/archive/html/lilypond-user/2015-05/msg00744.html

For setting the lyric text, I'm using nested parallel sections, as outlined
in
http://lilypond.org/doc/v2.19/Documentation/notation/techniques-specific-to-lyrics#lyrics-and-repeats

And the code of interest
http://lilypond.org/doc/v2.19/Documentation/39/lily-fd652fdf.ly


Many thanks,
mattfong


Re: Setting Gregorian chant: Note spacing for two note neumes seem to depend on length of lyric text

2020-10-21 Thread Matthew Fong
Hello Aaron,

In fact, I did try that early on. It fixed the note spacings for every
line, except the last line. Deeper into the hole with this spacing stuff


I did notice that for pieces with more systems, messing with the scaling of
the final Amen would have no impact. I have to change the *first*
multi-note neume to use a denominator of 8 or 16, rather than the
denominator of 5, and everything magically snaps to. So I duplicated the
syllable function and use a larger denominator value, and gave it a name so
I could spot where I use the work-around.


Many thanks,
mattfong

On Wed, Oct 21, 2020 at 3:30 PM Aaron Hill  wrote:

> On 2020-10-20 12:07 pm, Matthew Fong wrote:
> > I've been a little puzzled by a LilyPond layout issue. I apologize in
> > advance for the long example, so I have included the input .ly files,
> > and
> > sample output. The files will require some commenting and uncommenting
> > of
> > appropriate sections.
> >
> > Many thanks in advances for any insights.
> >
> > *Issue*
> > Two-and-more note neume spacing using \syllable function is affected by
> > some interaction of the *first* syllable, and the *final* Amen. It
> > seems
> > like LilyPond can squeeze the notes much closer together, as is seen
> > when
> > \syllable is not used at all (but does not result in consistent note
> > spacing).
>
> Sorry, I do not have much time to dig in further.
>
> I notice one difference is the system count.  Have you tried forcing the
> system count to three to see if LilyPond opts for tighter spacing?
>
> 
> \paper { system-count = 3 }
> 
>
> I suspect that spacing may be just at a cusp where it could fit to three
> systems but LilyPond decides to throw in a fourth system.  Thus then the
> notes are forced to space further apart to fill the extra system.
>
> Just a thought.
>
>
> -- Aaron Hill
>


Re: Scheme: Syntax for storing a variable in an alist

2020-10-18 Thread Matthew Fong
Hello Aaron,

This makes sense. I'll need to be more watchful of mixing Scheme and
LilyPond syntax. That's why I couldn't find anything about dot notation the
guile manual!

Thank you for the snippet. That is helpful should I need to nest any deeper.

Many thanks,
mattfong

On Sun, Oct 18, 2020 at 10:13 PM Aaron Hill 
wrote:

> On 2020-10-18 5:36 pm, Matthew Fong wrote:
> > Hello everyone,
> >
> > I am likely in over my head with nesting pairs. I read the
> > documentation
> > link from Jean, and I don't completely understand the internal
> > representation of this nesting in scheme.
> >
> > dictHymn.HymnOne.ID = "210"
> > dictHymn.HymnOne.Meter = "8.8.8.8"
> > dictHymn.HymnTwo.ID = "344"
> > dictHymn.HymnTwo.Meter = "12.12.12.8"
> >
> > Would it be something like:
> > ( ( HymnOne . (( ID . 210 ) ( Meter . "8.8.8.8" )) )
> >   ( HymnTwo . (( ID . 344 ) ( Meter . "12.12.12.8" )) ) )
>
> Yes, it ends up being an alist of alists.
>
>
> > assoc-get doesn't seem to work here with the syntactic sugar, likely
> > because I may not understand how nested pairs work.
> > dictHymnValue = #(ly:assoc-get 'ID dictHymn.HymnOne "error")
> > \markup \dictHymnValue
>
> The dot notation I showed is part of LilyPond syntax, not Scheme.
>
> ly:assoc-get does not support nested alists directly, so you need to
> explicitly perform multiple lookups:
>
> (NOTE: lily-library.scm defines an alias for ly:assoc-get omitting the
> ly: prefix.)
>
> 
> \markup #(assoc-get 'ID (assoc-get 'HymnOne dictHymn '()) "error")
> \markup #(assoc-get 'Tune (assoc-get 'HymnTwo dictHymn '()) "error")
> \markup #(assoc-get 'Meter (assoc-get 'HymnThree dictHymn '()) "error")
> 
>
> If you end up nesting alists more deeply, it can be cumbersome to do all
> of the individual assoc-get calls.  Here's a recursive wrapper that
> accepts a list of keys to lookup one after the other:
>
> 
> #(define (assoc-get* key alist . args)
>(if (and (list? key) (not (null? (cdr key
>  (apply assoc-get* (cdr key) (assoc-get (car key) alist '()) args)
>  (apply assoc-get (if (pair? key) (car key) key) alist args)))
>
> foo.one.two.three.four = "!"
> \markup #(assoc-get* '(one two three four) foo "?")
> \markup #(assoc-get* '(one two five six seven) foo "?")
> 
>
>
> -- Aaron Hill
>


Re: Scheme: Syntax for storing a variable in an alist

2020-10-18 Thread Matthew Fong
Maybe I ought to avoid such complexity. I constructed an example in guile,
and it's unclear how I access data for n hymns arranged this way. Scheme is
definitely not like Python.

guile> ( define b '((1 . '((11 . "aa") (22 . "bb") (33 . "cc")))
 (2 . '((44 . "dd") (55 . "ee") (66 . "ff")))
 (3 . '((77 . "gg") (88 . "hh") (99 . "ii")))
 )
)
guile> b
((1 quote ((11 . "aa") (22 . "bb") (33 . "cc"))) (2 quote ((44 . "dd") (55
. "ee") (66 . "ff"))) (3 quote ((77 . "gg") (88 . "hh") (99 . "ii"
guile> (list? b)
#t
guile> (list b)
(((1 quote ((11 . "aa") (22 . "bb") (33 . "cc"))) (2 quote ((44 . "dd") (55
. "ee") (66 . "ff"))) (3 quote ((77 . "gg") (88 . "hh") (99 . "ii")
guile> (car b)
(1 quote ((11 . "aa") (22 . "bb") (33 . "cc")))
guile> (cdr b)
((2 quote ((44 . "dd") (55 . "ee") (66 . "ff"))) (3 quote ((77 . "gg") (88
. "hh") (99 . "ii"
guile> (car (car b))
1
guile> (car (cdr b))
(2 quote ((44 . "dd") (55 . "ee") (66 . "ff")))
guile>


Many thanks,
mattfong

On Sun, Oct 18, 2020 at 5:36 PM Matthew Fong  wrote:

> Hello everyone,
>
> I am likely in over my head with nesting pairs. I read the documentation
> link from Jean, and I don't completely understand the internal
> representation of this nesting in scheme.
>
> dictHymn.HymnOne.ID = "210"
> dictHymn.HymnOne.Meter = "8.8.8.8"
> dictHymn.HymnTwo.ID = "344"
> dictHymn.HymnTwo.Meter = "12.12.12.8"
>
> Would it be something like:
> ( ( HymnOne . (( ID . 210 ) ( Meter . "8.8.8.8" )) )
>   ( HymnTwo . (( ID . 344 ) ( Meter . "12.12.12.8" )) ) )
>
> assoc-get doesn't seem to work here with the syntactic sugar, likely
> because I may not understand how nested pairs work.
> dictHymnValue = #(ly:assoc-get 'ID dictHymn.HymnOne "error")
> \markup \dictHymnValue
>
>
> Many thanks,
> mattfong
>
> On Sun, Oct 18, 2020 at 3:35 PM David Kastrup  wrote:
>
>> Jean Abou Samra  writes:
>>
>> > Le 18/10/2020 à 22:10, Matthew Fong a écrit :
>> >
>> >> Hello Aaron and Jean,
>> >>
>> >> Many thanks for pointing out the finer points of syntax of Scheme
>> >> vs. LilyPond.
>> >>
>> >> I appreciate the Scheme quoting reference, and the syntactic
>> >> sugar. Still so much more to learn here!
>> >
>> > You live and learn; I learnt about the synctactic sugar just today.
>>
>> Lots of syntactic sugar came into being in the last few versions.  This
>> particular bit has been around a while.
>>
>> commit 59d1c295b6c6ebe9410362cc365349bd458b0bcf
>> Author: Joe Neeman 
>> Date:   Tue Dec 22 21:44:56 2009 -0800
>>
>> Add nested properties setting to \paper blocks.
>>
>> Though this would have needed writing
>>
>> var #'prop #'prep = ...
>>
>> instead of
>>
>> var.prop.prep = ...
>>
>> at that time.  The availability of the latter syntax was probably an
>> unintended side effect of
>>
>> commit 864ce06c432a62191773b0d59401348c9b51568c
>> Author: David Kastrup 
>> Date:   Mon Oct 8 17:52:36 2012 +0200
>>
>> Allow property and grob paths to be constructed from strings
>>
>> This allows use of either
>> \override Accidental color = #red
>> or
>> \override Accidental.color = #red
>> (in addition to existing forms), both for context modifications or for
>> property overrides in music, the latter with optional leading context
>> spec defaulting to Bottom. .  The same holds for reverts.
>>
>> which would peg this as 2.17.6 (quite later than I would have thought).
>> I think that this assignment-level syntax only got formalised later on.
>>
>> --
>> David Kastrup
>>
>


Re: Scheme: Syntax for storing a variable in an alist

2020-10-18 Thread Matthew Fong
Hello everyone,

I am likely in over my head with nesting pairs. I read the documentation
link from Jean, and I don't completely understand the internal
representation of this nesting in scheme.

dictHymn.HymnOne.ID = "210"
dictHymn.HymnOne.Meter = "8.8.8.8"
dictHymn.HymnTwo.ID = "344"
dictHymn.HymnTwo.Meter = "12.12.12.8"

Would it be something like:
( ( HymnOne . (( ID . 210 ) ( Meter . "8.8.8.8" )) )
  ( HymnTwo . (( ID . 344 ) ( Meter . "12.12.12.8" )) ) )

assoc-get doesn't seem to work here with the syntactic sugar, likely
because I may not understand how nested pairs work.
dictHymnValue = #(ly:assoc-get 'ID dictHymn.HymnOne "error")
\markup \dictHymnValue


Many thanks,
mattfong

On Sun, Oct 18, 2020 at 3:35 PM David Kastrup  wrote:

> Jean Abou Samra  writes:
>
> > Le 18/10/2020 à 22:10, Matthew Fong a écrit :
> >
> >> Hello Aaron and Jean,
> >>
> >> Many thanks for pointing out the finer points of syntax of Scheme
> >> vs. LilyPond.
> >>
> >> I appreciate the Scheme quoting reference, and the syntactic
> >> sugar. Still so much more to learn here!
> >
> > You live and learn; I learnt about the synctactic sugar just today.
>
> Lots of syntactic sugar came into being in the last few versions.  This
> particular bit has been around a while.
>
> commit 59d1c295b6c6ebe9410362cc365349bd458b0bcf
> Author: Joe Neeman 
> Date:   Tue Dec 22 21:44:56 2009 -0800
>
> Add nested properties setting to \paper blocks.
>
> Though this would have needed writing
>
> var #'prop #'prep = ...
>
> instead of
>
> var.prop.prep = ...
>
> at that time.  The availability of the latter syntax was probably an
> unintended side effect of
>
> commit 864ce06c432a62191773b0d59401348c9b51568c
> Author: David Kastrup 
> Date:   Mon Oct 8 17:52:36 2012 +0200
>
> Allow property and grob paths to be constructed from strings
>
> This allows use of either
> \override Accidental color = #red
> or
> \override Accidental.color = #red
> (in addition to existing forms), both for context modifications or for
> property overrides in music, the latter with optional leading context
> spec defaulting to Bottom. .  The same holds for reverts.
>
> which would peg this as 2.17.6 (quite later than I would have thought).
> I think that this assignment-level syntax only got formalised later on.
>
> --
> David Kastrup
>


Re: Scheme: Syntax for storing a variable in an alist

2020-10-18 Thread Matthew Fong
Hello Aaron and Jean,

Many thanks for pointing out the finer points of syntax of Scheme vs.
LilyPond.

I appreciate the Scheme quoting reference, and the syntactic sugar. Still
so much more to learn here!


Many thanks,
mattfong

On Sun, Oct 18, 2020 at 12:58 PM Aaron Hill 
wrote:

> On 2020-10-18 12:42 pm, Matthew Fong wrote:
> > Hello everyone,
> >
> > I am having a bit of an issue storing a variable in an alist, and I was
> > wondering if you all could point out what I am doing wrong. If I write
> > the
> > string directly, there's no issue retrieving it ...
> >
> > my-alist = #'((1  . "A") (2 . "B") (3 . "C"))
> > value = #(ly:assoc-get 2 my-alist " error")
> > \markup \value
> >
> > hymnID = "210"
> > hymnMeter = "8.8.8.8"
> > hymnAlist = #'(("ID" . \hymnID ) ("Meter" . \hymnMeter ))
> > hymnValue = #(ly:assoc-get "ID" hymnAlist "error")
> > \markup \hymnValue
>
> Jean already covered the bit about quasi-quoting.
>
> But there is no need to do this as you can store values in an alist
> using dot syntax in LilyPond:
>
> 
> hymn.id = "643"
> hymn.meter = "6 6 11 6 6 11 D"
> \markup #(ly:assoc-get 'id hymn "no value")
> \markup #(ly:assoc-get 'tune hymn "no value")
> 
>
> \hymn automatically is an alist.
>
>
> -- Aaron Hill
>
>


Scheme: Syntax for storing a variable in an alist

2020-10-18 Thread Matthew Fong
Hello everyone,

I am having a bit of an issue storing a variable in an alist, and I was
wondering if you all could point out what I am doing wrong. If I write the
string directly, there's no issue retrieving it ...

my-alist = #'((1  . "A") (2 . "B") (3 . "C"))
value = #(ly:assoc-get 2 my-alist " error")
\markup \value

hymnID = "210"
hymnMeter = "8.8.8.8"
hymnAlist = #'(("ID" . \hymnID ) ("Meter" . \hymnMeter ))
hymnValue = #(ly:assoc-get "ID" hymnAlist "error")
\markup \hymnValue


Many thanks,
mattfong


Re: Scheme help request: How can else of an if-statement be made to do nothing?

2020-10-17 Thread Matthew Fong
Thanks for the pointer, Harm.

Matt

On Sat, Oct 17, 2020 at 13:14 Thomas Morley 
wrote:

> Am Sa., 17. Okt. 2020 um 22:09 Uhr schrieb John Schlomann
> :
> >
> > Harm,
> >
> > You used a function or macro called add-text. I can't seem to find it in
> any LilyPond or Guile manual. What is that?
> >
> > John
>
> Hi John,
>
> you'll find it in lily-library.scm
>
> Cheers,
>   Harm
>


Re: Scheme help request: How can else of an if-statement be made to do nothing?

2020-10-17 Thread Matthew Fong
Hello Jean and Thomas,

Thank you -- both solutions are insightful and useful in future solutions.

I did not know about empty stencils, and I read about a void-function
earlier, but was not entirely sure how to utilize it.


Many thanks,
mattfong

On Sat, Oct 17, 2020 at 10:49 AM Thomas Morley 
wrote:

> Am Sa., 17. Okt. 2020 um 19:39 Uhr schrieb Jean Abou Samra <
> j...@abou-samra.fr>:
> >
> > Hi,
> >
> > Le 17/10/2020 à 19:27, Matthew Fong a écrit :
> >
> > > Hello Richard,
> > >
> > > I just discovered your explanation is in fact the case, and also
> > > concluded cond wouldn't work either.
> > >
> > > I might have to settle for an empty markup block for now.
> >
> > The point of interpret-markup is to turn a markup into a stencil, so I'd
> > use empty-stencil:
> >
> > \version "2.20.0"
> >
> > #(define-markup-command (print-if-defined layout props sym text)
> >  (symbol? markup?)
> >(if (defined? sym)
> >(interpret-markup layout props
> >  #{ \markup \with-color #'(0.8 0.2 0.2) #text #})
> >empty-stencil))
> >
> > symA = "Something"
> >
> > \markup {
> >\print-if-defined #'symA "Text"
> >\print-if-defined #'symB "More text"
> > }
> >
> > Best,
> > Jean
> >
> >
>
> An empty stencil will still be spaced (unless removed by other
> markup-commands).
> Why not a void-function?
>
> print-if-defined =
> #(define-void-function (sym text) (symbol? markup?)
>   (if (defined? sym)
>   (add-text #{ \markup \with-color #'(0.8 0.2 0.2) #text #})))
>
> symA = "Something"
>
> \print-if-defined #'symB "Text"
> \print-if-defined #'symA "Text"
>
> Cheers,
>   Harm
>


Re: Scheme help request: How can else of an if-statement be made to do nothing?

2020-10-17 Thread Matthew Fong
Hello Richard,

I just discovered your explanation is in fact the case, and also concluded
cond wouldn't work either.

I might have to settle for an empty markup block for now.


Many thanks,
mattfong

On Sat, Oct 17, 2020 at 9:55 AM Richard Shann 
wrote:

> On Sat, 2020-10-17 at 09:34 -0700, Matthew Fong wrote:
> > Hello everyone,
> >
> > No less than 10 minutes after, I discovered I skipped the section on
> > cond. That solves everything!
>
> I think you are missing something here: the if macro in Scheme does not
> require an else expression
>
> (if a b)
>
> is fine, b will be evaluated if a is not #f
>
> your real problem is that the invocation of the procedure PrintDefined
> will still evaluate to something even when you "do nothing" in the case
> where the else expression would be evaluated. Your \markup will barf if
> the invocation of \PrintDefined evaluates to something that \markup is
> not expecting.
>
> Richard
>
>
> >
> >
> > Many thanks,
> > mattfong
> >
> > On Sat, Oct 17, 2020 at 9:27 AM Matthew Fong 
> > wrote:
> > > Hello everyone,
> > >
> > > I've been digging into guile/scheme and LilyPond, and it doesn't
> > > appear that else-statements can be empty. Any pointers would be
> > > appreciated in advance.
> > >
> > > For the example below, I would prefer the else-statement here to do
> > > nothing, rather than print an empty markup: \markup { "" }, as
> > > doing so creates a small, but observable change in vertical
> > > spacing.
> > >
> > > % Print markup if a symbol is defined
> > > #(define-markup-command (PrintIfDefined layout props sym text)
> > > (symbol? markup?)
> > > (if (defined? sym)
> > > ;; Do this if true
> > > (interpret-markup layout props
> > > #{ \markup \with-color #'(0.8 0.2 0.2) #text #})
> > >
> > > ;; How do I do nothing here? (empty statement preferred)
> > > (interpret-markup layout props
> > > #{ \markup "" #})
> > > )
> > > )
> > >
> > > printInfo = 1
> > > \markup \PrintIfDefined #'printInfo "Print this if symbol printInfo
> > > is defined"
> > >
> > >
> > > Many thanks,
> > > mattfong
> > >
> > >
>


Re: Scheme help request: How can else of an if-statement be made to do nothing?

2020-10-17 Thread Matthew Fong
Hello everyone,

No less than 10 minutes after, I discovered I skipped the section on cond.
That solves everything!


Many thanks,
mattfong

On Sat, Oct 17, 2020 at 9:27 AM Matthew Fong  wrote:

> Hello everyone,
>
> I've been digging into guile/scheme and LilyPond, and it doesn't appear
> that else-statements can be empty. Any pointers would be appreciated in
> advance.
>
> For the example below, I would prefer the else-statement here to do
> nothing, rather than print an empty markup: \markup { "" }, as doing so
> creates a small, but observable change in vertical spacing.
>
> % Print markup if a symbol is defined
> #(define-markup-command (PrintIfDefined layout props sym text) (symbol?
> markup?)
> (if (defined? sym)
> ;; Do this if true
> (interpret-markup layout props
> #{ \markup \with-color #'(0.8 0.2 0.2) #text #})
>;; How do I do nothing here? (empty statement preferred)
>(interpret-markup layout props
>#{ \markup "" #})
> )
> )
>
> printInfo = 1
> \markup \PrintIfDefined #'printInfo "Print this if symbol printInfo is
> defined"
>
>
> Many thanks,
> mattfong
>
>


Scheme help request: How can else of an if-statement be made to do nothing?

2020-10-17 Thread Matthew Fong
Hello everyone,

I've been digging into guile/scheme and LilyPond, and it doesn't appear
that else-statements can be empty. Any pointers would be appreciated in
advance.

For the example below, I would prefer the else-statement here to do
nothing, rather than print an empty markup: \markup { "" }, as doing so
creates a small, but observable change in vertical spacing.

% Print markup if a symbol is defined
#(define-markup-command (PrintIfDefined layout props sym text) (symbol?
markup?)
(if (defined? sym)
;; Do this if true
(interpret-markup layout props
#{ \markup \with-color #'(0.8 0.2 0.2) #text #})
   ;; How do I do nothing here? (empty statement preferred)
   (interpret-markup layout props
   #{ \markup "" #})
)
)

printInfo = 1
\markup \PrintIfDefined #'printInfo "Print this if symbol printInfo is
defined"


Many thanks,
mattfong


Re: Markup in left and right margins

2020-10-15 Thread Matthew Fong
Hello Aaron,

Wowsers -- I am dense. That completely makes sense. And it is simple!


Many thanks,
mattfong

On Thu, Oct 15, 2020 at 6:46 PM Aaron Hill  wrote:

> On 2020-10-15 6:03 pm, Matthew Fong wrote:
> > Many thanks for the solution of translation. I'm toying around with it
> > right now, and had a question:
> > I am possible misunderstanding the solution, and using the abs-override
> > incorrectly. I cannot seem to place a comment string next to the stave.
>
> The code I showed was purely to demonstrate that you *could* move things
> outside the margins.  But it was not prescriptive.  In practice, take a
> simpler route:
>
> 
> \version "2.20.0"
>
> \paper {
>#(set-paper-size "a6landscape")
>top-margin = 1.5\cm bottom-margin = 3\cm
>left-margin = 2\cm right-margin = 2.5\cm
>indent = 0 ragged-right = ##f
> }
>
> loremIpsum =
> \markup
>\override #'(baseline-skip . 2.5)
>\smaller \left-column {
>  \line { Lorem ipsum dolor sit amet, }
>  \line { consectetur adipscing elit. }
>}
>
> \markup
>% Collapse dimensions so the \markup takes no space.
>\with-dimensions-from \null
>
>% Move the \markup further into the left margin.
>\translate #'(-1 . 0)
>
>% Adjust alignment of \markup to top-right corner.
>\general-align #X #RIGHT
>\general-align #Y #UP
>
>% The \markup itself.
>\rotate #90 \with-color #red \loremIpsum
>
> % NOTE:
> % The \fill-line { \null ... } pattern is useful for
> % aligning content to the right margin automatically.
>
> \markup \fill-line { \null
>% Collapse dimensions so the \markup takes no space.
>\with-dimensions-from \null
>
>% Move the \markup further into the right margin.
>\translate #'(1 . 0)
>
>% Adjust alignment of \markup to top-left corner.
>\general-align #X #LEFT
>\general-align #Y #UP
>
>% The \markup itself.
>\rotate #-90 \with-color #blue \loremIpsum
> }
>
> \new Staff \fixed c'' {
>c1^\markup \with-color #green \loremIpsum
> }
> 
>
> Given the above approach, there is no need to mess about with "absolute"
> measurements.  Staff space units are generally pretty nice to work with
> anyway.
>
>
> -- Aaron Hill


Re: Markup in left and right margins

2020-10-15 Thread Matthew Fong
Hello Andrew,

Yes, in fact, I was considering rotating the content. There isn't much
room, but just enough to get a few words sideways.



Hello Aaron,

Many thanks for the solution of translation. I'm toying around with it
right now, and had a question:
I am possible misunderstanding the solution, and using the abs-override
incorrectly. I cannot seem to place a comment string next to the stave.
Here is my sample code.

\paper {

   paper-width = 8\cm

   paper-height = 6\cm

   top-margin = 1\cm

   bottom-margin = 1\cm

   left-margin = 1.5\cm

   right-margin = 2.5\cm

   tagline = ##f

}


\layout { indent = 0 ragged-right = ##t }


\new Staff \relative c' {

  c'1^"Comment"

}


\markup \overlay {

   \abs-translate #(cons (ly:cm -1.5) 0)

   \abs-override #(cons 'line-width (ly:cm 4))

   \with-color #'(0.8 0.3 0.2)

   \rotate #90 "This is a test"

}



Many thanks,
mattfong

On Thu, Oct 15, 2020 at 3:23 AM Aaron Hill  wrote:

> On 2020-10-15 2:53 am, Andrew Bernard wrote:
> > Hi Matthew,
> >
> > A good question. But I would have thought that margins are exactly
> > that - margins. I don't think LilyPond was ever conceived to support
> > marginal annotations and complex print formatting. Wouldn't you have
> > to narrow your content in whatever way so as to create left or right
> > vertical space and simply add it there, so, inside the margins? But I
> > am sure all the TeX experts on the list will chime in.
>
> Nothing prevents you from \translating \markup outside the normal
> bounds.
>
> NOTE: The following code requires some helper functions in order to
> specify absolute dimensions in \markup.  A real-world usage probably
> should be querying the values directly from \paper to eliminate
> redundancy.
>
> 
> \version "2.20.0"
>
> #(define-markup-command
>(abs-override layout props arg rest)
>(pair? markup?)
>(let* ((sym (car arg))
>   (val (cdr arg))
>   (scl (ly:output-def-lookup layout 'output-scale)))
>  (interpret-markup layout props
>(markup #:override (cons sym (/ val scl)) rest
>
> #(define-markup-command
>(abs-translate layout props arg rest)
>(pair? markup?)
>(let* ((x (car arg))
>   (y (cdr arg))
>   (scl (ly:output-def-lookup layout 'output-scale)))
>  (interpret-markup layout props
>(markup #:translate (cons (/ x scl) (/ y scl)) rest
>
> \paper {
>paper-width = 8\cm
>paper-height = 5\cm
>top-margin = 1\cm
>bottom-margin = 1\cm
>left-margin = 1.5\cm
>right-margin = 2.5\cm
>tagline = ##f
> }
>
> visualizeBounds =
> #(define-scheme-function
>(text)
>(markup?)
>#{
>  \markup
>\override #'(thickness . 1.5)
>\fill-line {
>  \overlay {
>\lower #0.5 \draw-line #'(0 . 1)
>\arrow-head #X #LEFT ##f
>\draw-line #'(2 . 0)
>  }
>  #text
>  \overlay {
>\lower #0.5 \draw-line #'(0 . 1)
>\arrow-head #X #RIGHT ##f
>\draw-line #'(-2 . 0)
>  }
>}
>#})
>
> \markup \smaller \column {
>\fill-line { paper: \concat { 5cm \char ##xd7 8cm } }
>\fill-line { left-margin: 1.5cm }
>\fill-line { right-margin: 2.5cm }
>\vspace #0.5
> }
>
> \markup \overlay {
>\abs-translate #(cons (ly:cm -1.5) 0)
>\abs-override #(cons 'line-width (ly:cm 1.5))
>\with-color #'(0.8 0.3 0.2)
>\visualizeBounds left
>
>\with-color #'(0.2 0.8 0.4)
>\visualizeBounds normal
>
>\abs-translate #(cons (ly:cm 4) 0)
>\abs-override #(cons 'line-width (ly:cm 2.5))
>\with-color #'(0.2 0.5 0.8)
>\visualizeBounds right
> }
> 
>
>
> -- Aaron Hill


Markup in left and right margins

2020-10-14 Thread Matthew Fong
Hello everyone,

Would anyone know if there is a way to add mark-up in the left and right
margins of the page. There are footnotes and headers for the bottom and top
of the page, respectively.

For example, I might want to add notes in the margins, rather than in the
music.


Many thanks,
mattfong


Re: No ledger for custodes beyond 5-line staff

2020-10-13 Thread Matthew Fong
Thank you, Aaron! This definitely works-around the bug. Looking forward to
a fix in future LilyPond versions.

On Tue, Oct 13, 2020 at 2:11 AM Werner LEMBERG  wrote:

>
> >> I was engraving a piece of chant in modern notation recently, and
> >> discovered that none of the custodes will draw a ledger for middle
> >> C (C4) or A5, notes beyond the 5-line staff. These notes do occur
> >> in chant and polyphony.  [...]
> >
> > Perhaps this: [...]
> >
> > The above hack does nothing more than add a fake NoteHead that
> > overlaps the Custos grob so that the LedgerLineSpanner does its
> > magic.
>
> Thanks for the workaround code!  Anyway, I consider this a bug; it
> should be added to the tracker.
>
>
> Werner
>
>


Re: Gregorian chant/Mensural notation: No ledger for custodes beyond 5-line staff

2020-10-12 Thread Matthew Fong
Hi everyone,

I posted this to bug-lilyp...@gnu.org.

I tried the code snippet at lilybin.com, and both versions there produce
the same result as the latest stable version 2.20.


Many thanks,
mattfong

On Sat, Oct 10, 2020 at 9:50 AM Matthew Fong  wrote:

> Hello fellow LilyPonders,
>
> I was engraving a piece of chant in modern notation recently, and
> discovered that none of the custodes will draw a ledger for middle C (C4)
> or A5, notes beyond the 5-line staff. These notes do occur in chant and
> polyphony.
>
> Is there a workaround for this? Or have I missed something fundamental?
>
> \layout { ragged-right = ##t }
>
> \new Staff \with { \consists "Custos_engraver" } \relative c' {
>   \override Staff.Custos.neutral-position = #4
>
>   \override Staff.Custos.style = #'vaticana
>   c'1^"vaticana" \break
>   c,1 \break
>   a''1
> }
>
>
> Many thanks,
> mattfong
>
>
>


Gregorian chant/Mensural notation: No ledger for custodes beyond 5-line staff

2020-10-10 Thread Matthew Fong
Hello fellow LilyPonders,

I was engraving a piece of chant in modern notation recently, and
discovered that none of the custodes will draw a ledger for middle C (C4)
or A5, notes beyond the 5-line staff. These notes do occur in chant and
polyphony.

Is there a workaround for this? Or have I missed something fundamental?

\layout { ragged-right = ##t }

\new Staff \with { \consists "Custos_engraver" } \relative c' {
  \override Staff.Custos.neutral-position = #4

  \override Staff.Custos.style = #'vaticana
  c'1^"vaticana" \break
  c,1 \break
  a''1
}


Many thanks,
mattfong


custodes-no-ledger.pdf
Description: Adobe PDF document


Re: Setting Gregorian chant: Note spacing for two note neumes seem to depend on length of lyric text

2020-10-08 Thread Matthew Fong
Hello Aaron,

Thanks for pointing out the many ways LilyPond can accomplish something.
Going to play around with those options!


Many thanks,
mattfong

On Wed, Oct 7, 2020 at 6:11 PM Aaron Hill  wrote:

> On 2020-10-07 11:03 am, Matthew Fong wrote:
> > I suppose I could also use markup on the note if it's
> > a graphical articulation?
>
> I can think of four ways to decorate a note:
>
> 
> \version "2.20.0"
>
> decoMarkup = \markup \circle \normalsize \normal-text !
> decoDynamic = #(make-dynamic-script decoMarkup)
> decoFingering = \finger \decoMarkup
> decoScript = \tweak stencil #ly:text-interface::print
>   \tweak text \decoMarkup
>   \staccato
>
> {
>\override TextScript.color = #'(0.9 0.4 0.3)
>\override Script.color = #'(0.9 0.8 0.3)
>\override Fingering.color = #'(0.3 0.8 0.4)
>\override DynamicText.color = #'(0.3 0.6 0.9)
>\set fingeringOrientations = #'(left)
>4 \decoScript ^\decoMarkup \decoDynamic
> }
> 
>
> TextScript is the most straightforward, although it may require tweaking
> to get its positioning as desired.  DynamicText aligns differently by
> default, so it might be better candidate; however, it assumes the
> \dynamic font style which would require use of \normal-text to
> counteract.
>
> Fingering and Script are both interesting because they naturally can
> exist within the staff lines while still avoiding collisions with other
> elements.  Fingering both assumes the \number font style and a smaller
> font size; so you may need to use both \normal-text and \normalsize, as
> demonstrated in the example above.
>
> Customizing Script involves hijacking an existing articulation, so it is
> the least "clean" of the options.  Note that each articulation has its
> own preferred spacing and alignment, so you may need to play around a
> bit to find one that matches your needs.
>
>
> -- Aaron Hill


Re: Setting Gregorian chant: Note spacing for two note neumes seem to depend on length of lyric text

2020-10-07 Thread Matthew Fong
Hello Aaron,

You're quite right. I don't need to alter the note duration in the scope --
it's simply a graphical articulation I wish to add, like the tenuto.

I actually do prefer the first solution. The second one for falsobordone
(or current problem). I suppose I could also use markup on the note if it's
a graphical articulation?


Many thanks,
mattfong

On Wed, Oct 7, 2020 at 10:06 AM Aaron Hill  wrote:

> On 2020-10-07 8:44 am, Matthew Fong wrote:
> > Hello Aaron,
> >
> > I did find an issue with your syllable function. It seems to swallow up
> > dots, that is, if I take your sample code
> > \syllable { a'\( \melisma c'' b'\tenuto \melismaEnd }
> >
> > and add a dot, it is ignored. I am playing around with an episema vs.
> > dot.
> > \syllable { a'4.\( \melisma c'' b'\tenuto \melismaEnd }
>
> The dot is part of the duration, which is overridden by \syllable.  In
> fact, \syllable completely ignores any durations that might be
> specified.  The intention here is that \syllable is fully responsible
> for defining duration, so as a user you would be advised not to include
> any durations within the music expression.
>
> Do you need the actual rhythmic Dot or simply a dot-shaped articulation?
>
> 
>
> Another way of looking at the problem is for a function to manage
> scaling provided music of arbitrary length to fit within the measure.
> This is a significantly easier task from the engineering perspective, as
> LilyPond provides all the building blocks:
>
> 
> \version "2.20.0"
>
> fitTo =
> #(define-music-function
>(duration music)
>(ly:duration? ly:music?)
>(ly:music-compress music
>  (ly:moment-div
>(ly:duration-length duration)
>(ly:music-length music
>
> { \time 1/4 \hide Staff.BarLine \omit Stem \omit Flag
>\fitTo 4 { a'4\( c'' b'4*3\tenuto }
>\fitTo 4 { a'2 b'2*4\) }
>\fitTo 4 { a'4. c''8-> a'4_( b'4*2) }
>\fitTo 4 { b'\breve } }
> \addlyrics {
>lor -- _ _ em _ i -- _ _ psum
> }
> 
>
> The results above are similar to earlier examples I posted in terms of
> spacing and clumping of notes.  The added bonus is that different note
> heads are possible, as \syllable only outputs quarter notes.  Of course,
> I had to \omit Flag due to the presence of an eighth note in the third
> note group.
>
> \syllable is still much nicer from the user's perspective, as one can
> safely think in terms of pitch only.  The above example required me as
> the user to manually compute the durations of notes so that they would
> scale properly and be consistent from measure to measure.  Try changing
> the "2*4" in the second note group to "2*3" or "2*5" and note how the
> entire spacing of the piece is impacted.
>
>
> -- Aaron Hill
>


Re: Setting Gregorian chant: Note spacing for two note neumes seem to depend on length of lyric text

2020-10-07 Thread Matthew Fong
Hello Aaron,

I did find an issue with your syllable function. It seems to swallow up
dots, that is, if I take your sample code
\syllable { a'\( \melisma c'' b'\tenuto \melismaEnd }

and add a dot, it is ignored. I am playing around with an episema vs. dot.
\syllable { a'4.\( \melisma c'' b'\tenuto \melismaEnd }


Many thanks,
mattfong

On Mon, Oct 5, 2020 at 12:48 PM Matthew Fong  wrote:

> Holy smokes. This is a thing of beauty.
>
> Thank you Aaron! Not everything notation can be automated away, and I'm
> fine with the flexibility this offers.
>
> Many thanks,
> mattfong
>
> On Mon, Oct 5, 2020 at 11:32 AM Aaron Hill 
> wrote:
>
>> On 2020-10-05 10:35 am, Matthew Fong wrote:
>> > Hello Aaron,
>> >
>> > Thank you for your help. That does make sense to me and works out quite
>> > well -- I don't yet have a grasp how various commands and settings are
>> > actually working in LilyPond. I found another example in the LilyPond
>> > documentation that shows the internal representation. Where do I find
>> > this
>> > for input I want to inspect further?
>> >
>> http://lilypond.org/doc/v2.20/Documentation/extending/doubling-a-note-with-slurs-_0028example_0029
>> >
>> > I tested your syllable function with tweaks (like changing a notehead
>> > to a
>> > quilisma), and expressive marks like a tenuto. It appears the current
>> > code
>> > doesn't handle them (this is getting into advanced territory much more
>> > quickly than I expected).
>>
>> Argh... I feared you might want to go in that direction.  Simple runs of
>> pitches are rarely enough.  :/
>>
>> Here's a more generalized approach that modifies durations, preserving
>> other events and properties:
>>
>> 
>> \version "2.20.0"
>>
>> syllable =
>> #(define-music-function
>>(notes)
>>(ly:music?)
>>;; Adjust this number to support longer runs of notes.
>>(define denominator 5)
>>(let ((dur (ly:make-duration 2 0 1 denominator))
>>  (count 0)
>>  (last '()))
>>  (for-some-music
>>(lambda (m)
>>  (if (music-is-of-type? m 'rhythmic-event)
>>(begin
>>  (set! count (1+ count))
>>  (set! last m)
>>  (ly:music-set-property! m 'duration dur)
>>  #t)
>>#f))
>>notes)
>>  (if (ly:music? last)
>>(ly:music-set-property! last
>>  'duration
>>  (ly:make-duration 2 0
>>(- denominator (1- count))
>>denominator)))
>>  notes))
>>
>> redNotes = \override NoteHead.color = #red
>> { \time 1/4 \hide Staff.BarLine \omit Stem
>>\syllable { a'\( \melisma c'' b'\tenuto \melismaEnd }
>>\syllable { \redNotes a' b'\) \undo \redNotes }
>>\syllable { \breathe \[ a' c''\accent a'_( b') \] }
>>\syllable { b'\espressivo } }
>> \addlyrics {
>>lor -- em _ i -- _ _ psum
>> }
>> 
>>
>> There is much more flexibility at the cost of no longer automatically
>> adding \melisma/\melisaEnd nor Slurs.  In fact, the example shows a
>> PhrasingSlur starting in one "syllable" ending in the following.
>>
>> NOTE: This function does not handle chords properly.
>>
>>
>> -- Aaron Hill
>>
>


Re: Setting Gregorian chant: Note spacing for two note neumes seem to depend on length of lyric text

2020-10-05 Thread Matthew Fong
Holy smokes. This is a thing of beauty.

Thank you Aaron! Not everything notation can be automated away, and I'm
fine with the flexibility this offers.

Many thanks,
mattfong

On Mon, Oct 5, 2020 at 11:32 AM Aaron Hill  wrote:

> On 2020-10-05 10:35 am, Matthew Fong wrote:
> > Hello Aaron,
> >
> > Thank you for your help. That does make sense to me and works out quite
> > well -- I don't yet have a grasp how various commands and settings are
> > actually working in LilyPond. I found another example in the LilyPond
> > documentation that shows the internal representation. Where do I find
> > this
> > for input I want to inspect further?
> >
> http://lilypond.org/doc/v2.20/Documentation/extending/doubling-a-note-with-slurs-_0028example_0029
> >
> > I tested your syllable function with tweaks (like changing a notehead
> > to a
> > quilisma), and expressive marks like a tenuto. It appears the current
> > code
> > doesn't handle them (this is getting into advanced territory much more
> > quickly than I expected).
>
> Argh... I feared you might want to go in that direction.  Simple runs of
> pitches are rarely enough.  :/
>
> Here's a more generalized approach that modifies durations, preserving
> other events and properties:
>
> 
> \version "2.20.0"
>
> syllable =
> #(define-music-function
>(notes)
>(ly:music?)
>;; Adjust this number to support longer runs of notes.
>(define denominator 5)
>(let ((dur (ly:make-duration 2 0 1 denominator))
>  (count 0)
>  (last '()))
>  (for-some-music
>(lambda (m)
>  (if (music-is-of-type? m 'rhythmic-event)
>(begin
>  (set! count (1+ count))
>  (set! last m)
>  (ly:music-set-property! m 'duration dur)
>  #t)
>#f))
>notes)
>  (if (ly:music? last)
>(ly:music-set-property! last
>  'duration
>  (ly:make-duration 2 0
>(- denominator (1- count))
>denominator)))
>  notes))
>
> redNotes = \override NoteHead.color = #red
> { \time 1/4 \hide Staff.BarLine \omit Stem
>\syllable { a'\( \melisma c'' b'\tenuto \melismaEnd }
>\syllable { \redNotes a' b'\) \undo \redNotes }
>\syllable { \breathe \[ a' c''\accent a'_( b') \] }
>\syllable { b'\espressivo } }
> \addlyrics {
>lor -- em _ i -- _ _ psum
> }
> 
>
> There is much more flexibility at the cost of no longer automatically
> adding \melisma/\melisaEnd nor Slurs.  In fact, the example shows a
> PhrasingSlur starting in one "syllable" ending in the following.
>
> NOTE: This function does not handle chords properly.
>
>
> -- Aaron Hill
>


Re: Setting Gregorian chant: Note spacing for two note neumes seem to depend on length of lyric text

2020-10-05 Thread Matthew Fong
Hello Aaron,

Thank you for your help. That does make sense to me and works out quite
well -- I don't yet have a grasp how various commands and settings are
actually working in LilyPond. I found another example in the LilyPond
documentation that shows the internal representation. Where do I find this
for input I want to inspect further?
http://lilypond.org/doc/v2.20/Documentation/extending/doubling-a-note-with-slurs-_0028example_0029

I tested your syllable function with tweaks (like changing a notehead to a
quilisma), and expressive marks like a tenuto. It appears the current code
doesn't handle them (this is getting into advanced territory much more
quickly than I expected).
Sample input I attempted: \syllable { a' \noteQuilisma c'' b'_\tenuto }

where
noteQuilisma =
#(define-music-function (note) (ly:music?)
#{
\tweak NoteHead.stencil #ly:text-interface::print
\tweak NoteHead.text \markup {
\scale #'(0.24 . 0.24)
\override #'(filled . #t)
\path #0.0 #quilismaPathGreciliae
}
\tweak NoteHead.X-offset #0
\tweak Stem.stencil ##f
#note
#}
)


Many thanks,
mattfong

On Mon, Oct 5, 2020 at 9:50 AM Aaron Hill  wrote:

> (Adding mailing list back to thread...)
>
> On 2020-10-05 9:07 am, Matthew Fong wrote:
> > I'm dissecting your syllable code and have a question for you: How do I
> > create a similar list using a slur instead of a melisma? I found this
> > documentation, but not sure how to use it
> > http://lilypond.org/doc/v2.19/Documentation/internals/slurevent
>
> SlurEvents end up as articulations of a NoteEvent, whereas the \melisma
> command is essentially shorthand for \set melismaBusy = ##t.  See below
> for how both can be handled.
>
>
> > I understand that using a melisma is quite handy, but for clarity for
> > the
> > singer, adding slurs is another strong visual indicator of the
> > grouping.
>
> With that in mind, the function I provided can be enhanced to support
> both unslurred and slurred melismata:
>
> 
> \version "2.20.0"
>
> syllable =
> #(define-music-function
>(style pitches)
>((symbol? #f) ly:music?)
>(let* ((pitches (music-pitches pitches))
>   (count (length pitches)))
>  (make-sequential-music
>(append-map
>  (lambda (index pitch)
>(let* ((denom 5) ;; NOTE: Adjust this as needed. <<==
>   (initial? (= index 1))
>   (final? (= index count))
>   (numer (if final? (- denom (1- count)) 1))
>   (music '()))
>  (set! music
>(list (make-music 'NoteEvent
>  'pitch pitch
>  'duration (ly:make-duration 2 0 numer denom
>  (if (or initial? final?)
>(if (eq? style 'slurred)
>  (ly:music-set-property! (car music) 'articulations
>(list (make-span-event 'SlurEvent
>(if initial? START STOP
>  (set! music (append music (list
>(if initial? melisma melismaEnd))
>  music))
>  (iota count 1)
>  pitches
>
> { \time 1/4 \hide Staff.BarLine \omit Stem
>\syllable { a' c'' b' }
>\syllable { a' b' }
>\syllable slurred { a' c'' a' b' }
>\syllable { b' } }
> \addlyrics { lor -- em i -- psum }
> 
>
> Note that if you wanted the default behavior to be slurred, change the
> type predicate from (symbol? #f) to (symbol? 'slurred).  Then you can
> simply specify any other symbol (such as "unslurred") to opt for the
> original \melisma/\melismaEnd approach.
>
> I could see LigatureBrackets as another option, although their handling
> is even more peculiar.
>
>
> -- Aaron Hill
>


Re: Setting Gregorian chant: Note spacing for two note neumes seem to depend on length of lyric text

2020-10-04 Thread Matthew Fong
Hello Aaron,

Many thanks for bearing with my error. I do see in the list archives that I
have sent out my question three times -- I will certainly apply patience
here. This has been a tremendously useful group.

I will implement the your suggestions and feedback. There seem to be many
ways to accomplish the same thing in LilyPond, but understanding the
internals sees to be key. I just have to start loving to write some scheme!


Many thanks,
mattfong

On Sun, Oct 4, 2020 at 5:13 PM Aaron Hill  wrote:

> On 2020-10-04 2:17 pm, Matthew Fong wrote:
> > (I apologize if I've posted multiple times -- I am not seeing my post
> > at
> > all.)
>
> Three times, in fact.  The mailing list server is not running as a
> top-priority service.  Sometimes you can post something and get a copy
> back nearly right away; other times it can take the better part of a
> day.  Patience is definitely a virtue here, especially considering folks
> on this list are not always able to respond the same day.
>
>
> > I am setting Gregorian chant in modern notation, using an example from
> > the
> > LilyPond online documentation on transcribing Gregorian chant located
> > at
> >
> >
> http://lilypond.org/doc/v2.20/Documentation/notation/working-with-ancient-music_002d_002dscenarios-and-solutions
> >
> >
> > I have two questions:
> >
> > 1/ For the two note neumes, it appears the not their spacing is
> > dependent
> > upon the length of the lyric text below (easily seen in the tie length)
>
> I disagree with the approach the NR demonstrates.  The problem is that
> it subdivides each measure (read: melisma) equally for each pitch.  This
> ultimately results in the spreading out of two-note melismata compared
> to three- or four-note versions.
>
> Instead, one should be scaling notes so that the final pitch of the
> melisma is significantly longer than the leading notes.  This asks the
> spacing engine to allocate more of the measure length toward that final
> note which results in the desired clumping of notes.
>
> Consider:
>
> 
> \version "2.20.0"
>
> { \time 1/4 \hide Staff.BarLine \omit Stem
>a'4*1/5 \melisma c'' b'4*3/5 \melismaEnd
>a'4*1/5 \melisma b'4*4/5 \melismaEnd
>a'4*1/5 \melisma c'' a' b'4*2/5 \melismaEnd
>b'4 }
> \addlyrics { lor -- em i -- psum }
> 
>
> By using quarter notes only, you don't have to mess about with \omitting
> Beams or Flags.  And scaling notes rather than using \times or \tuplet
> obviates needing \omit TupletBrackets and TupletNumbers.
>
> Explicit \melisma and \melismaEnd ensure that notes are grouped without
> needing to use Slurs.  Lyrics then are much easier to enter as you
> likely will never need to use the "_" placeholder lyric syllable.
>
> In the above example, I assume that no melismata will need more than
> five notes, so I am scaling all leading notes to be 1/5 of a quarter
> note.  The final note is scaled to the remaining length.
>
> You can wrap up much of this into a utility function:
>
> 
> \version "2.20.0"
>
> syllable =
> #(define-music-function
>(pitches) (ly:music?)
>(let* ((pitches (music-pitches pitches))
>   (count (length pitches)))
>  (make-sequential-music
>(append-map
>  (lambda (index pitch)
>(let* ((denom 5)
>   (initial? (= index 1))
>   (final? (= index count))
>   (numer (if final? (- denom (1- count)) 1))
>   (music '()))
>  (set! music
>(list (make-music 'NoteEvent
>  'pitch pitch
>  'duration (ly:make-duration 2 0 numer denom
>  (if initial? (set! music (append music (list melisma
>  (if final? (set! music (append music (list melismaEnd
>  music))
>  (iota count 1)
>  pitches
>
> { \time 1/4 \hide Staff.BarLine \omit Stem
>\syllable { a' c'' b' }
>\syllable { a' b' }
>\syllable { a' c'' a' b' }
>\syllable { b' } }
> \addlyrics { lor -- em i -- psum }
> 
>
>
> > 2/ For these multi-note (melismatic) neumes, is it possible to center
> > the
> > lyric text below, like the single note neumes? \override
> > LyricText.self-alignment-X = #CENTER does not seem to do the trick.
>
> For normal LyricTexts, that is how you would set the alignment.  When
> multiple LyricTexts are part of a melisma, the alignment is changed to
> whatever lyricMelismaAlignment is \set to:
>
> 
> % ...
> \addlyrics {
>\set lyricMelismaAlignment = #CENTER
>lor -- em i -- psum
> }
&

Setting Gregorian chant: Note spacing for two note neumes seem to depend on length of lyric text

2020-10-04 Thread Matthew Fong
Hello LilyPonders,

I am setting Gregorian chant in modern notation, using rhw example from the
LilyPond online documentation on transcribing Gregorian chant located at
http://lilypond.org/doc/v2.20/Documentation/notation/working-with-ancient-music_002d_002dscenarios-and-solutions

I have two questions
1/ For the two note neumes, it appears the not their spacing is dependent
upon the length of the lyric text below (easily seen in the tie length)
In code example, compile with \override Lyrics.LyricText.X-extent
*commented out*: See words in the first stanza "things", and in the second
stanza "grace", "health", "warmth"

If I take the suggestion in the documentation "to avoid that syllables of
different width (such as “-ri” and “-rum”) spread the syllable note groups
unevenly apart, the 'X-extent property of the LyricText object may be set
to a fixed value," this results in the *consistent* note spacing I am
looking for, but lyrics text collides with each other.
In code example, compile with \override Lyrics.LyricText.X-extent
*uncommented*: See words in the first stanza "things", and in the second
stanza "grace", "health", "warmth"

2/ For these multi-note (melismatic) neumes, is it possible to center the
lyric text below, like the single note neumes? \override
LyricText.self-alignment-X = #CENTER does not seem to do the trick.

%
% Reduction
% Minimum code for dependency on note spacing on length of lyric text / how
to center lyric under multiple notes
%
reduction = \relative c' {
  \time 1/4
%  \override Lyrics.LyricText.X-extent  = #'(0 . 3)
  \repeat unfold 2 {
f4 e4 d4 e8( d8) c4 d8( e8) e4 e4
g4 g16( a16 b16 a16) g8( f8) g8( a8) g4 f8( e8) d8( e8) e4
f4 e4 d4 e8( d8) c4 \tuplet 3/2 {d8( e8 f8)} d4 d4
d4 f4 e4 g8( a8) g4 f8( e8) d8( e8) e4
  }
}

reductionLyr = \lyricmode {
  \set stanza = #"1."
  To you be -- fore the close of light,
  Cre -- a -- tor of all things, we pray:
  Be our pro -- tec -- tor, keep us safe
  in your un -- fail -- ing clem -- en -- cy.

  \set stanza = " 2."
  Grant us the grace of health and strength,
  re -- new our warmth and joy of life;
  and let your ra -- diant light dis -- pel
  the dread -- ed dark -- ness of the night.
}
\score {
  \new Staff <<
\new Voice = "chant" \reduction
\new Lyrics = "one" \lyricsto "chant" \reductionLyr
  >>
  \layout {
ragged-last = ##t
indent = 0\mm

\context {
  \Staff
  \remove "Time_signature_engraver"
%  \override BarLine.X-extent = #'(-1 . 1)
  \hide Stem
  \hide Beam
  \hide BarLine
  \hide TupletNumber
}

\context {
  \Score
  \remove "Bar_number_engraver"
}

\context {
  \Lyrics
  \override LyricText.self-alignment-X = #CENTER
}
  }
}


Many thanks,
Matt