Re: Tunable Context Properties

2024-05-06 Thread Fr. Samuel Springuel
Thanks Aaron.  That worked very well.

Of course, the minute I get a solid solution, the desired result gets changed 
on me: now we’re looking at only numbering the first line.  Fortunately that’s 
an easy enough change to make.  Well, I’ll keep this solution in my back pocket 
for the inevitable request to change back to it at some point.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Markuplist and formatted text

2024-05-04 Thread Fr. Samuel Springuel
I’m printing out attribution information in which the title of a work from 
which the text was translated is in italics.  Attached is an example of the my 
results before I started this thread.  The comma after “Sponsa Christi” is in 
italics (as you suggested was the more normal typographic practice) because it 
was inside the \italic command (and directly attached to “Christi”.  I was 
looking to turn it upright since the comma isn’t part of the title of the 
original sequence.

The wrapping in this case is being handled by a modified \wordwrap-field, which 
was based on a discussion on the mailing list 6 years ago: 
https://www.mail-archive.com/lilypond-user@gnu.org/msg131928.html.  At the time 
I hadn’t considered the possibility of punctuation that I didn’t want formatted 
in the same way as the text it would be “attached” to, and recent work had me 
exploring that possibility.  If need be, I can post that tool in it’s current 
form, but in creating my MWE I tried to use standard LilyPond commands as much 
as possible, and would rely on applying it to my non-standard command myself 
(which I have done for the solution that has been posted using \wordwrap-lines).

I’ll point out that at this point the \wordwrap-lines solution works (now that 
I understand where it’s allowed to make wrapping decisions), at this point my 
questions are purely about understanding your (David’s) comments about 
\wordwrap-string.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ

> On May 4, 2024, at 1:31 PM, David Kastrup  wrote:
> 
> "Fr. Samuel Springuel"  writes:
> 
>> Okay, so then I need to break up the string to create separate markups
>> (except in the critical location around the italics text:
>> 
>> \version "2.24.3"
>> 
>> \markuplist \wordwrap-lines { test test test test test test test test
>> test test test test test test test test test test test test test test
>> test test test test \concat { \italic { "italic text" }"," } test test
>> test test test test test test test test test test test test test test
>> test test test test test test test }
>> 
>> I can’t seem to get \wordwrap-string to work in this context (even
>> after switching \markuplist to \markup).  It barfs if \concat is
>> inside of it (unrecognized escape string) and if it’s put inside
>> \concat, then it only applies to the immediate string, not the
>> resulting concatenated whole.
> 
> What is the actual problem you are trying to solve here?
> 
> -- 
> David Kastrup



Ordinary_Time_Sundays.pdf
Description: Adobe PDF document


Re: Markuplist and formatted text

2024-05-04 Thread Fr. Samuel Springuel
Okay, so then I need to break up the string to create separate markups (except 
in the critical location around the italics text:

\version "2.24.3"

\markuplist \wordwrap-lines { test test test test test test test test test test 
test test test test test test test test test test test test test test test test 
\concat { \italic { "italic text" }"," } test test test test test test test 
test test test test test test test test test test test test test test test test 
}

I can’t seem to get \wordwrap-string to work in this context (even after 
switching \markuplist to \markup).  It barfs if \concat is inside of it 
(unrecognized  escape string) and if it’s put inside \concat, then it only 
applies to the immediate string, not the resulting concatenated whole.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ

> On May 4, 2024, at 1:13 PM, David Kastrup  wrote:
> 
> "Fr. Samuel Springuel"  writes:
> 
>> Word wrapping does not appear to be functioning in this solution:
>> 
>> \version "2.24.3"
>> 
>> \markuplist \wordwrap-lines {\concat { "test test test test test test
>> test test test test test test test test test test test test test test
>> test test test test test test test test test test test test test
>> "\italic { "italic text" }", test test test" }}
>> 
>> The text just runs of the page to the right.
> 
> That is as intended.  \wordwrap-lines breaks between individual markups,
> and you only have one.
> 
> You probably want \wordwrap-string (there is no \wordwrap-string-lines
> though that would give you a markup list).
> 
> -- 
> David Kastrup




Re: Markuplist and formatted text

2024-05-04 Thread Fr. Samuel Springuel
Word wrapping does not appear to be functioning in this solution:

\version "2.24.3"

\markuplist \wordwrap-lines {\concat { "test test test test test test test test 
test test test test test test test test test test test test test test test test 
test test test test test test test test test "\italic { "italic text" }", test 
test test" }}

The text just runs of the page to the right.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ

> On May 4, 2024, at 11:30 AM, Jean Brefort  wrote:
> 
> Try this:
> \markuplist \wordwrap-lines {\concat { "test test test "\italic { "italic 
> text" }", test test test" }}
> 
> Le samedi 04 mai 2024 à 11:18 -0400, Fr. Samuel Springuel a écrit :
>> How do I get the comma (which is not italicized) attached to the
>> italics text just before it?
>> 
>> \version "2.24.3"
>> 
>> \markuplist \wordwrap-lines { test test test \italic { italic text },
>> test test test }
>> 
>> ✝✝
>> Fr. Samuel, OSB
>> (R. Padraic Springuel)
>> St. Anselm’s Abbey
>> 4501 South Dakota Ave, NE
>> Washington, DC, 20017
>> 202-269-2300
>> (c) 202-853-7036
>> 
>> PAX ☧ ΧΡΙΣΤΟΣ
>> 
>> 
> 




Markuplist and formatted text

2024-05-04 Thread Fr. Samuel Springuel
How do I get the comma (which is not italicized) attached to the italics text 
just before it?

\version "2.24.3"

\markuplist \wordwrap-lines { test test test \italic { italic text }, test test 
test }

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Tunable Context Properties

2024-05-04 Thread Fr. Samuel Springuel
I’m using the vocalName and shortVocalName context properties in Lyrics and for 
a particular project, I always set them to be the same thing (i.e. so that the 
verse numbers appear on every line).  Right now, that means putting two “\set” 
commands in each Lyrics context in order to set both properties.  I’m looking 
to simplify this and thus am looking for two things:

1) Can I establish that shortVocalName should default to vocalName at the top 
level of the file (effectively placing it where I can transport it over to my 
format file)?

2) Can I automate the numbering so that I don’t have to manually number the 
verses?  I’ve seen http://lsr.di.unimi.it/LSR/Item?id=543, but this has two 
problems: one, the counter increments each time the markup is printed, which is 
problematic for verse numbers which should stay the same within a verse, no 
matter how many times it is printed, and only increment between verses.  Two, 
it introduces a spurious space after the counter that I don’t know how to get 
rid of.

My MnonWE (with the counter in place):

\version "2.24.0"

% This is where my \include "format.ily" would go.

#(define counter-alist '())

#(define-markup-command (counter layout props name) (string?)
  "Increases and prints out the value of the given counter named @var{name}.
  If the counter does not yet exist, it is initialized with 1."
  (let* ((oldval (assoc-ref counter-alist name))
 (newval (if (number? oldval) (+ oldval 1) 1)))
  (set! counter-alist (assoc-set! counter-alist name newval))
  (interpret-markup layout props
(markup (number->string newval)

music = { c c c c | \break c c c c | \break c c c c }

verseI = \lyricmode { a a a a a a a a a a a a }

verseII = \lyricmode { b b b b b b b b b b b b }

verseIII = \lyricmode { c c c c c c c c c c c c c }


\new Staff
<<
\new Voice = "mel" { \music }
\new Lyrics \lyricsto "mel" { 
\set vocalName = \markup { \counter #"versenumber". }
\set shortVocalName = \markup { \counter #"versenumber". } 
\verseI }
\new Lyrics \lyricsto "mel" { 
\set vocalName =\markup { \counter #"versenumber". }
\set shortVocalName = \markup { \counter #"versenumber". }
\verseII }
\new Lyrics \lyricsto "mel" { 
\set vocalName = \markup { \counter #"versenumber". }
\set shortVocalName = \markup { \counter #"versenumber". }
\verseIII }
>>


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




English Note names alternatives

2024-04-06 Thread Fr. Samuel Springuel
I just discovered that in English, there’s a shorter way to name notes that 
would normally be specified with “-sharp” or “-flat”: “s” and “f”.  E.g. 
“f-sharp” can be written as “fs” and “b-flat” can be written as “bf”.

However, I noticed that this is not documented in the Music Glossary: 
https://lilypond.org/doc/v2.24/Documentation/music-glossary/pitch-names. Only 
the “-sharp” and “-flat” name are mentioned there.  Is there a reason this 
behavior is not documented?  It is certainly much easier to type the shorter 
name than the longer one but I don’t want to rely on something that might break 
unexpectedly.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Lilypond-book-preamble introducing page break after custom header

2023-03-15 Thread Fr. Samuel Springuel
The attached file compiles differently under 2.22 and 2.24: 2.24 introduces a 
page break that isn’t present in 2.22.  This is causing some havoc in my 
lyluatex tool chain.  Any idea what’s causing the problem and how to fix it?

convert-ly doesn’t change anything in the file when upgrading the version.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


Alan-Rees-OSB.ly
Description: Binary data


Re: Determining requested output files

2023-02-20 Thread Fr. Samuel Springuel


> On Feb 20, 2023, at 7:33 AM, Jean Abou Samra  wrote:
> 
> (Adding back the list)

Sorry about losing the list.

> 
> Le dimanche 19 février 2023 à 12:46 -0500, R. Padraic Springuel a écrit :
> 
>> It’s part of my system for having make automatically figure out dependencies 
>> when running LilyPond: 
>> https://github.com/rpspringuel/lilypond_make/tree/GNUmake_dependencies
>> The changes to the backend require some updates to the system to work with 
>> 2.24. 
>> 
> I see that you also have a branch where you ask LilyPond what it has 
> generated after it has generated it. What about doing something much simpler: 
> always call LilyPond with -o emptydir, where emptydir is an empty directory, 
> and move the files afterwards. Then you know exactly what has been generated 
> without having to ask LilyPond.
> 

Hadn’t thought of that, but it might be a workable idea.  I actually use the 
system exemplified on that other branch for my own work because, as is pointed 
out in the article linked in the README on that branch, once you know the 
dependency file is out of date, you know that the score itself is out of date 
and so can safely build both at the same time.  I’m already using a SED script 
to add the midi file to the dependency list, so it shouldn’t be too difficult 
to modify that to replace some default placeholder (that LilyPond itself puts 
in the dly file) with a proper list of the actually generated files.

The one thing I don’t like is that the dly file that LilyPond produces as part 
of its run won’t be usable under this strategy without the SED modifications in 
the make recipe, but I suppose that’s just me picking nits rather than a real 
problem for someone using the system.


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Determining requested output files

2023-02-18 Thread Fr. Samuel Springuel
I have the following scheme function which I used on versions 2.22 and earlier 
which determined the requested output files for a lilypond run:

#(define target-extensions (cond ((equal? (ly:get-option 'backend) 'svg) (list 
"svg"))
 ((equal? (ly:get-option 'backend) 'scm) (list 
"scm"))
 ((equal? (ly:get-option 'backend) 'ps) 
(uniq-list (sort-list (ly:output-formats) string

Re: Conditional Definitions

2023-02-18 Thread Fr . Samuel Springuel
After some searching, I’ve found that Scheme has the define-once construct 
which does exactly what I was looking for

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ

> On Feb 15, 2023, at 2:54 PM, Fr. Samuel Springuel  
> wrote:
> 
> I recently upgraded from 2.22 to 2.24 and have run into some problems with 
> one of my tools.  The tool is set up to define some some stuff (in the 
> example attached below I’ve narrowed it down to be just a color), but only if 
> that thing is not already defined.  The reason for this is because the 
> definitions are in included files.  There’s a master style file which defines 
> everything and then a variant style file where only some things are defined 
> (the things that are different from the master style file).  The master style 
> file is included explicitly in the source files, while the variant style file 
> is included automatically by lyluatex if certain conditions are met in the 
> document, and that inclusion happens before the contents of the source file.  
> This means I have to prevent a redefinition rather than exploit it.  I was 
> doing this just fine in 2.22, but 2.24 complains about definition being 
> wrapped in a conditional.  I believe this has to do with the switchover in 
> Guile versions, but I don’t know enough about Guile to figure out how to fix 
> it (and no, convert-ly does not help here).
> 
> Attached is my MWE.
> 
> ✝✝
> Fr. Samuel, OSB
> (R. Padraic Springuel)
> St. Anselm’s Abbey
> 4501 South Dakota Ave, NE
> Washington, DC, 20017
> 202-269-2300
> (c) 202-853-7036
> 
> PAX ☧ ΧΡΙΣΤΟΣ
> 




Conditional Definitions

2023-02-15 Thread Fr. Samuel Springuel
I recently upgraded from 2.22 to 2.24 and have run into some problems with one 
of my tools.  The tool is set up to define some some stuff (in the example 
attached below I’ve narrowed it down to be just a color), but only if that 
thing is not already defined.  The reason for this is because the definitions 
are in included files.  There’s a master style file which defines everything 
and then a variant style file where only some things are defined (the things 
that are different from the master style file).  The master style file is 
included explicitly in the source files, while the variant style file is 
included automatically by lyluatex if certain conditions are met in the 
document, and that inclusion happens before the contents of the source file.  
This means I have to prevent a redefinition rather than exploit it.  I was 
doing this just fine in 2.22, but 2.24 complains about definition being wrapped 
in a conditional.  I believe this has to do with the switchover in Guile 
versions, but I don’t know enough about Guile to figure out how to fix it (and 
no, convert-ly does not help here).

Attached is my MWE.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


aster_test.ily
Description: Binary data


Re: Recitative in Chant music

2022-10-28 Thread Fr. Samuel Springuel
My mostly automated solution for recited notes is attached.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ

recite.ily
Description: Binary data

> On Oct 28, 2022, at 6:06 AM, Vladimír Slávik  
> wrote:
> 
> Hi Michael,
> Admittedly I'm not that good with lilypond and then I'm familiar mostly with 
> Roman catholic music as written here (cz), but perhaps that can help you a 
> bit with the direction.
> 
> What I have seen done in psalms and thus do in these situations is make the 
> recitative note a breve. So I make the whole thing a cadenza, then use 
> explicit lengths for all the lyrics, and have a breve there. See below for an 
> example.
> 
> The one thing that is not really a given, just a convention in the literature 
> I have seen, is that it's a breve. You could just use another quarter for the 
> "long part" and the lyrics and it's all the same to Lilypond.
> 
> Arguably typing in all the lengths for all the lyrics is a lot of work, but 
> personally I've found that preferable to littering the lyrics with directives 
> to alter lengths. I have also never (never, ever) succeeded in making the 
> lilypond "guessing" right for the lyrics lengths.
> 
> If you make the whole work a cadenza, you have to also mark the bar ends 
> manually.
> 
> To make the chord show "only at the beginning", you need to align the lyrics 
> left. You can do it once for each breve, but following my approach of "not 
> littering the data with programming", I just align everything.
> 
> Others will perhaps help correct if there's anything wrong with this 
> approach? For me, it worked well this far :-)
> 
> Best,
> Vladimir
> 
> 
> \version "2.18.2"
> 
> \layout {
> \context {
> \Lyrics
> \consists "Bar_engraver"
> \consists "Separating_line_group_engraver"
> \hide BarLine
> \override LyricText.self-alignment-X = #LEFT
> }
> }
> 
> noTime = \override Staff.TimeSignature #'stencil = ##f
> 
> right_hand = \relative c' {
> \key c \major
> \clef treble
> \language "deutsch"
> \noTime
> \autoBeamOff
> \accidentalStyle forget
> \cadenzaOn
> 
>c4 d4 e\breve e4 f2 f4~ e2 \bar "|"
> 
>%(...more music)
> 
> \cadenzaOff
> }
> 
> words = \lyricmode {
> \set stanza = "1. "
> Some4 words4 "that have something real"\breve -- ly4 long2 he4 -- re.2
> 
> %(... more lyrics)
> }
> 
> staff = \new PianoStaff <<
> \new Staff \right_hand
> \new Lyrics \words
> %(...)
> >>
> 
> \score {
> \staff
> }
> 
> Note that this is a simplified example, so might not compile as-is.
> 
> 
> 
> Dne 25.10.2022 v 23:45 thedoctor81877--- via LilyPond user discussion 
> napsal(a):
>> Hi,
>> 
>> I have another question pleae. I have typeset several Orthodox liturgical 
>> music chant settings. Before, I would type out every sylable of the music 
>> even where there is a "recitative" (several word on the same chord.
>> 
>> However, I have a score somone had sent me, that, for the recitative parts, 
>> prints only the chord at the beginning of the recitative, and the chord at 
>> the end. For the exmample I was sent, only the altoWords line.
>> 
>> But, I am not sure how to use this, and am working on mastering it; and 
>> could use some help please. Here is part of what I have:
>> 
>> sopMusic = \relative c'' {
>>   % Music follows here.
>>   \set Timing.measureLength = #(ly:make-moment 13/4)
>>   g'4 g a2(b) g4 g g a b c2 \bar""
>>   \set Timing.measureLength = #(ly:make-moment 2/4)
>>   b4 b \bar""
>>   \set Timing.measureLength = #(ly:make-moment 5/4)
>>   a2 g2 \bar""
>> }
>> 
>> altoMusic = \relative c'' {
>>   \set Timing.measureLength = #(ly:make-moment 13/4)
>>   d4 d fs2(g) g4 g g g g g2 \bar""
>>   \set Timing.measureLength = #(ly:make-moment 2/4)
>>   g4 g \bar""
>>   \set Timing.measureLength = #(ly:make-moment 4/4)
>>   fs2 d2 \bar""
>> }
>> 
>> altoWords = \lyricmode {
>>   When the stone __ had been sealed by the Jews,
>>   \once \override LyricText.self-alignment-X = #LEFT
>>   while_the_soldiers_were_guar -- ding_Thy_most -- pure
>>   \once \override LyricText.self-alignment-X = #CENTER
>>   Bo -- dy.
>>   \once \override LyricText.self-alignment-X = #LEFT
>> 
>> 
>> }
>> 
>> So. the recitative should have:
>> 
>> "While the soldiers .. most-pure"
>> 
>> and Bod--y for the last two half-notes. Also, I seem to have 2 extra g4 in 
>> the alto line for the recitative.
>> 
>> I am not sure how to change and adress this; I have been trying to change 
>> the underlines and such in the lyrics but to no avail.
>> 
>> 
>> 
>> Thanks,
>> 
>> Michael D
>> 
>> -- 
>> Sent with Tutanota, enjoy secure & ad-free emails.
> 
> 
> 



Re: Differentiate between including and direct compiling a file

2021-11-08 Thread Fr. Samuel Springuel


> On Aug 7, 2021, at 3:54 PM, Aaron Hill  wrote:
> 
> Perhaps something like this:
> 
> 
> \version "2.22.0"
> 
> ifCompiledDirectly =
> #(define-scheme-function (scm) (scheme?)
>  (let ((file (car (ly:input-file-line-char-column (*location*)
>   (if (member file (command-line)) scm)))
> 
> \ifCompiledDirectly \markup "Compiled directly..."
> \ifCompiledDirectly \score { { b'4 4 2 } }
> 
> 
> The logic is simple: check to see if the command-line arguments contain the 
> name of the file being processed.

Is there a way to apply this to variable definitions?  I.e. have a variable be 
defined only if the file is being compiled directly?

Alternatively, is there a way to force LilyPond to stop reading a file at a 
certain point (i.e. some equivalent to TeX’s `\endinput`) that could be used in 
combination with the negative of this so that the example occurs after this 
command?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Markup functions and punctuation in lyrics

2021-11-06 Thread Fr. Samuel Springuel
I’ve done some work to clean up my code and also modified the interface to be 
fairly intuitive and non-intrusive.  Hopefully I’ll have some time this week to 
integrate this into my project, but if anyone sees anything that could be 
improved, I’d love to hear about it.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ



gender-test.ly
Description: Binary data


Re: Markup functions and punctuation in lyrics

2021-11-04 Thread Fr. Samuel Springuel
On Nov 2, 2021, at 11:26 PM, Aaron Hill  wrote:
> 
> Okay, would text replacement be viable as opposed to writing a bunch of 
> individual functions?

That does sound nice.  There would need to be some helper functions to handle 
the formatting issue that Jean pointed out, but I can get that mostly to work.

Attached is a basic mock-up of this strategy.  The one hangup that I ran into 
is that \replace doesn’t work directly on lyrics, so I had to use the \paper 
version.  Beyond that, it seems to be working, but I’ll happily take any 
critiques on the coding style before I start working this into a final version.


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


gender-test.ly
Description: Binary data


Re: how to engrave an arpeggio based on a chord of differing length notes?

2021-05-15 Thread Fr. Samuel Springuel
> On 15 May, 2021, at 7:39 PM, Kenneth Wolcott  wrote:
> 
> Hello;
> 
>  I have an interesting engraving problem I haven't seen before
> (example png file attached).
> 
>  I understand how to handle the tuplet, the crescendo, the
> decrescendo and the general polyphony, even the arpeggio.
> 
>  However, the arpeggio is based on a half note and a dotted half
> note.  How to handle that?

Are you sure it’s an appregio and not a quarter rest?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: ANN: Frescobaldi 3.1.3

2021-01-06 Thread Fr . Samuel Springuel
> On 5 Jan, 2021, at 5:22 PM, Davide Liessi  wrote:
> 
> If you are running macOS 11, I would be grateful if you could test the
> application and report the results.

I can confirm that basic operations seem to work.  Will report back as I use 
further.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




\with-dimensions partially

2020-12-26 Thread Fr. Samuel Springuel
Is there a way to set the horizontal dimensions of a markup to 0 while leaving 
the vertical dimensions alone?

I’ve got the following as a start, but it zeros both X and Y dimensions.  
Ideally I’d like the second argument to be computed automatically:

Cantor = \markup \with-dimensions #'(0 . 0) #'(0 . 0) {\italic Cantors:}


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Mass file linting

2020-12-18 Thread Fr. Samuel Springuel
On 17 Dec, 2020, at 4:27 PM, David Menéndez Hurtado  
wrote:

> pip install python-ly
> ly "reformat" input.ly > output.ly
> 
> That runs exactly the same that Frescobaldi does. More documentation: 
> https://pypi.org/project/python-ly/
> 

I should probably smack my forehead over this.  I already had python-ly 
installed on my system, indicating I’ve probably used it before.



> On 18 Dec, 2020, at 11:29 AM, Knute Snortum  wrote:
> 
> For changing a group of files, I would try:
> 
>ly --in-place reformat *.ly
> 
> This will modify the files in place and give you a backup of the file
> with the filename suffixed with a "~".

Works like a charm for mass file linting.  Though I did have to set the 
indent-width variable to 4 in order to match my usual settings.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Mass file linting

2020-12-17 Thread Fr. Samuel Springuel
I’ve developed a large collection of music files over several years have 
recently noticed that there are some stylistic formatting deviations in some of 
them and so I’m looking for a tool that will check all my files for these 
problems (and ideally fix them).  I can do this in Frescobaldi using 
Tools->Code Formatting->Format, but I’m looking for a command-line option that 
I can use to fix my files en masse (and eventually incorporate into a check-in 
hook on my git repositories to prevent this from happening again).  Does anyone 
have any suggestions for how to pull this off?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Stanza Collision

2020-12-10 Thread Fr. Samuel Springuel
> On 6 Dec, 2020, at 3:55 PM, Matthew Fong  wrote:
> 
> 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. 
> 
> ...
> 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

This removes some of the clutter, but not all.  You’ve still got both the \mnn 
function and the slurs applied to the notes.  My goal is to eliminate the 
clutter entirely and get the entry down to something like:

> chantNotes.mode-II_cd-d-de-c-def-fe-de-e = \relative c' {
> % 1
> c( d) d( e) c d( d e) f f( e) d( e) e
> \divisioMinima




> On 6 Dec, 2020, at 3:20 PM, Kieren MacMillan  
> wrote:
> 
> 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.

This has me thinking and I’ve come up with the attached to start.  It attaches 
the asterisk to the next syllable, but still needs work on the spacing.  
Perhaps my brain just isn’t working at the moment, but how do I go about 
tweaking the spacing from inside the aster function?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


slur spacing.ly
Description: Binary data


Re: Combining custom bar line with standard elements

2020-12-06 Thread Fr. Samuel Springuel
> On 6 Dec, 2020, at 1:47 PM, Thomas Morley  wrote:
> 
> Ok, then my initial understanding
>> Iiuc, you want to change thick-thickness and font-size for barlines 
>> containing "[" or "]".
> was wrong. You rather want a different thick-thickness for the thick
> line in bracket-barlines and for the thick-barline.
> Since the same procedure, make-thick-bar-line, is per default used for
> both, we need to define own bar-line-printing-procedures, reassigning
> them the relevant glyphes.
> For this purpose I look at (new invented)
> BarLine.details.bracket-thick-thickness to distuingish it from default
> thick-thickness.
> This will cause a programming error _if_ compiled with -dcheck-internal-types:
> programming error: Grob `BarLine' has no interface for property `details'
> For now you can ignore it, imho.
> 
> Leading to (slightly modified copies from bar-line.scm):


Thank you.  That’s doing the job in context.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Stanza Collision

2020-12-06 Thread Fr. Samuel Springuel
> On 6 Dec, 2020, at 12:00 PM, Kieren MacMillan  
> wrote:
> 
> I’m hoping to avoid the Slur_spacing_engraver entirely.  ;)
> What does it do exactly?
> 

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).


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


The_Lord_loved_him.pdf
Description: Adobe PDF document


The_Lord_loved_him.pdf
Description: Adobe PDF document


Re: Combining custom bar line with standard elements

2020-12-06 Thread Fr. Samuel Springuel
> On 6 Dec, 2020, at 6:39 AM, Thomas Morley  wrote:
> 
> \layout {
>  \context {
>\Staff
>\override BarLine.before-line-breaking =
>#(lambda (grob)
>  (let ((glyph (ly:grob-property grob 'glyph)))
>(if (and (string? glyph)
> (or (string-contains glyph "[")
> (string-contains glyph "]")))
>(begin
> (ly:grob-set-property! grob 'thick-thickness 2)
> (ly:grob-set-property! grob 'font-size -4)
>  }
> }
> 
> \defineBarLine "[" #'("" "[" "")
> \defineBarLine "]" #'("]" "" "")
> \defineBarLine "]." #'("]." "" "")
> 
> global = { \key f \major }
> 
> music = {
>  g' f' e' d' \bar "["
>  f' g' a' g' \bar "|"
>  f' e' c' d' \bar "]."
> }
> 
> \new Staff
> <<
>\new Voice = "mel" { \global \music }
>>> 
> 

The problem there is that the final bar line (the “.” Element) is also thinned. 
 I want only the “]” element to be thinned.  All other elements of the bar line 
should retain their default thickness.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Stanza Collision

2020-12-06 Thread Fr. Samuel Springuel
> On 6 Dec, 2020, at 10:37 AM, Kieren MacMillan  
> wrote:
> 
> Where is the asterisk supposed to sit?
> 
> Horizontal: Just to the right of the last cantor-only word? Just to the left 
> of the first choir word? Centred between those words?

Closer to just left of the first choir word.  There can be some “springiness” 
in its placement for spacing reasons, so long as it doesn’t collide with the 
words on either side and there is some clear whitespace around it (i.e. I’d 
like to avoid a “word*word” look).

> Vertical: Centered? On the text baseline?

In the usual place with respect to the text baseline for an asterisk.  That can 
vary from font to font, but usually is such that the top of the asterisk glyph 
is level with the top of they typical capital letter.

> When I start with this really simple snippet, it seems (as I understand it) 
> that we’re already close:

Said simple snippet demonstrates that the default position for an asterisk 
placed by \set stanza is indeed right where I want it to be.  The problem is 
that when the Slur_spacing_engraver is used, that positioning is no longer 
respected, leading to the collisions.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Stanza Collision

2020-12-05 Thread Fr. Samuel Springuel
> On 5 Dec, 2020, at 1:46 PM, Kieren MacMillan  
> wrote:
> 
> Hi there,
> 
>> I’m still working on getting my modified slur spacing issues worked out and 
>> have yet to come up with a solution for the collision between \set stanza = 
>> "*"
> 
> I honestly can’t understand what you’re trying to achieve…   =\
> 
> Having done a lot of work with Schenker graphs — which have a lot of the same 
> issues and "look & feel" as chants — perhaps if you can explain it a little 
> better, I can help figure out a better way to accomplish what you’re 
> attempting.

This all started with me trying to imitate a particular chant style:

https://lists.gnu.org/archive/html/lilypond-user/2020-03/msg00290.html

Aaron kindly provided the Slur_spacing_engraver to accomplish this:

https://lists.gnu.org/archive/html/lilypond-user/2020-03/msg00320.html

This is working fine for my hymns, but when I tried using it with the 
antiphons, which have an asterisk in them to indicate when the choir joins the 
cantor, the spacing around said asterisk is too tight in some cases.  In the 
attached files the "Blessed be God" antiphon is fine but in the "Let the mind” 
the asterisk collides with the words just before it.

I’ve tried changing the various parameters in the Slur_spacing_engraver to 
solve this, but changing those parameters have undesirable side-effects (mostly 
the desired spacing changes on the slurred notes gets wrecked).  So now I’m 
thinking that perhaps just a crude addition of space might be the easiest way 
to do this.

>> Are there other ways of inserting space into the lyrics (that will move the 
>> notes above to preserve relative alignment) that I haven’t tried?
> 
> There’s the obvious manual way:
> 
> words = \lyricmode {
>  Some \set stanza = "*"
>  \tweak self-alignment-X #-0.25 \markup \concat { words \hspace #2 } \set 
> stanza = "*"
>  t \set stanza = "*"
>  go longword \set stanza = "*" un -- der notes
> }
> 
> But I still feel like if I knew better what you were trying to do, I could 
> figure out a programmatic way to handle it.

This does work, but if you could figure out a programmatic way to solve this, I 
would greatly appreciate that.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


Blessed_be_God.pdf
Description: Adobe PDF document


Let_the_mind.pdf
Description: Adobe PDF document


Combining custom bar line with standard elements

2020-12-05 Thread Fr. Samuel Springuel
I have a couple of customized bar lines defined and have come across an 
instance where I want to combine them with a standard bar line element.  
However, my naive attempts aren’t working as expected.  My first attempt 
resulted in the bar line simple disappearing; in the second the customization 
disappeared.  How can I make the combination while still preserving my 
customization?

\version "2.20.0"
\language "english"

\layout {
\context {
\Staff
\override BarLine.before-line-breaking =
#(lambda (grob)
 (let ((glyph-name (ly:grob-property grob 'glyph-name)))
 (if (member glyph-name '("[" "]"))
 (begin
  (ly:grob-set-property! grob 'thick-thickness 2)
  (ly:grob-set-property! grob 'font-size -4)
  )
 )
 )
 )
}
}

\defineBarLine "[" #'("" "[" "")
\defineBarLine "]" #'("]" "" "")
\defineBarLine "]." #'("]." "" "")

global = { \key f \major }

music = {
g' f' e' d' \bar "["
f' g' a' g' \bar "|"
f' e' c' d' \bar "]."
}

\new Staff
<<
\new Voice = "mel" { \global \music }
>>


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Stanza Collision

2020-12-01 Thread Fr. Samuel Springuel
I’m still working on getting my modified slur spacing issues worked out and 
have yet to come up with a solution for the collision between \set stanza = "*" 
and the words when a slur occurs on either side of the asterisk.  (You’ll note 
that the first asterisk in the MWE doesn’t have any problems as the syllables 
around it have no slurs.)  At this point, I’m wondering if there isn’t just 
some sort of manual way to say “insert additional space here” that won’t effect 
the alignment of the lyrics and the notes.

I’ve tried overriding with the padding and X-offset properties of StanzaNumber, 
but while I can use these to push the asterisk around with these (and even get 
rid of the collision all together with StanzaNumber.padding = #0), they don’t 
create more space for the asterisk to occupy.  Playing with X-extent doesn’t 
seem to do anything.

I also tried overriding LyricsText.X-offset on the syllables on either side of 
the asterisk, but that broke the alignment between the Lyrics and its note.  
Playing with X-extent doesn’t seem to do anything.

Are there other ways of inserting space into the lyrics (that will move the 
notes above to preserve relative alignment) that I haven’t tried?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


slur spacing.ly
Description: Binary data


Partially formatting syllables in lyrics

2020-11-21 Thread Fr. Samuel Springuel
How can I apply italics to part of a syllable in the lyrics context?  When I 
use the method I usually use to apply italics, it automatically creates a new 
syllable:

#(ly:set-option 'relative-includes #t)
\version "2.20.0"

\new Staff
<<
\new Voice = "mel" { c' c' }
\new Lyrics \lyricsto "mel" { \lyricmode { hat\override 
Lyrics.LyricText.font-shape = #'italic (s) \revert Lyrics.LyricText.font-shape 
show } }
>>


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Spacing of systems while using lyluatex

2020-08-25 Thread Fr. Samuel Springuel
> On 25 Aug, 2020, at 3:20 PM, Jacques Menu  wrote:
> 
> Hello,
> 
> I’m using Mac TexLive 2020 with all updates.
> TeXShop proposes only Lilypond and Lilypond-LaTeX as reasonable-looking 
> engines.
> 

Neither of these are correct for use with lyluatex.

> 
> \documentclass[12pt,a4paper]{article}
> 
> \usepackage{lyluatex}
> 
> % -
> \begin{document}
> % -
>  
> \begin{lilypond} 
> \version "2.20.0"
> 
> music = \relative {
>   c d e
> }
> 
> \score {
>   \new ChoirStaff \with {
> instrumentName = "2 Fl."
>   } 
>   <<
>   \new Staff {
>   \transpose c c' \music 
>   }
>   \new Staff {
>   \clef bass
>   \music
>   }
>   >> 
> }
> \end{lilypond}
> 
> % -
> \end{document}
> % -
> 
> 
> leads to:
> 
> 

For a document like this you need to use a LuaLaTeX engine which has the 
`--shell-escape` option enabled.  TeXShop does not ship with such an engine 
(not even in the “Inactive” folder).  You will need to add it yourself.  You 
can do this yourself, but the Gregorio project makes such engines available 
along with a script that will install them for you: 
https://github.com/gregorio-project/gregorio/tree/master/contrib/TeXShop

Download both engine files and the auto-configure.command script to the same 
folder and then run the script by double clicking on it in the Finder.


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Automatic lyric extenders

2020-08-18 Thread Fr. Samuel Springuel
> On 17 Aug, 2020, at 5:27 PM, Jon Arnold  wrote:
> 
> Hi all-
> 
> I was trying to find if it was possible to do lyric extensions automatically, 
> and found this thread: 
> http://lilypond.1069038.n5.nabble.com/Automatic-Lyric-Extenders-td198194.html
> 
> Did anything ever come of this project? The workaround in that thread throws 
> an error for me.
> 
> I have a project where I'm trying to make it flexible to change whether I tie 
> a note or not for later, and want to avoid having to go back in to do the 
> lyric extenders if I choose to tie.
> 
> Thanks!
> 
> Jon

So far as I can tell, this hasn’t made it into LilyPond core yet (as was 
suggested in the linked thread), so I’m still using the solution in that thread 
(having run it through convert-ly to update it).  I’ve attached what I’m using 
below.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


autoextenders.ily
Description: Binary data


Re: Arguments before functions

2020-07-20 Thread Fr. Samuel Springuel
> On 19 Jul, 2020, at 4:32 PM, David Kastrup  wrote:
> 
> I don't see that you can fix this with a music function,

That’s what I thought, I just wanted to make sure.

> but of course
> you can process the complete music expression and then modify any note
> before a \bar "|".

I hadn’t thought of that, but since it would still involve modifications to the 
source (to add the function which modifies the whole source) I figure I’m 
probably better off with functions that only affect the notes I’m interested in 
changing in the long run.

> On 19 Jul, 2020, at 4:43 PM, Aaron Hill  wrote:
> 
> Rather than try to work around the plumbing of LilyPond, might I suggest the 
> following:
> 
> 
> ...
> 
> 
> This approach allows you to create a template of sorts for individual notes.  
> Above is an example usage to aid with pointing, supporting the middle of a 
> phrase and the final tone.

Interesting approach.  My idea was to define functions which apply the 
transformations directly and then have place holder functions in the music 
which are defined using \etc:



\version "2.20.0"

episema = #(define-music-function (note-event) (ly:music?)
   "Add an tenuto ArticulationEvent to the articulations of 
`note-event',
which is supposed to be a NoteEvent expression.  This simulates 
the 
episema."
   (set! (ly:music-property note-event 'articulations)
 (cons (make-music 'ArticulationEvent
   'articulation-type "tenuto")
 (ly:music-property note-event 'articulations)))
   note-event)

dotted = #(define-music-function (note) (ly:music?)
  "Add a dot to the duration of note."
  (withMusicProperty 'duration (ly:make-duration 2 1) note)
  )

final = \dotted \etc
middle = \episema \etc

\fixed c' { \cadenzaOn a4 g \middle b g8[ f] g4_( \final c') \bar "|” }




In this case switching what appears in the music is a matter of changing the 
definitions of the aliases.

I think both approaches accomplish the job, so it’s probably a matter of taste 
as to which to choose.  Yours does have the distinct advantage of making more 
use of LilyPond syntax and is more compact as a result.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Arguments before functions

2020-07-19 Thread Fr. Samuel Springuel
Is there a way for a music function to operate on the note that precedes it?

I’m transcribing chant and have lots of music where I transcribed the note just 
before the bar as a quarter note (the same as other non-reciting notes in the 
measure):

{ \cadenzaOn g'1 c'4 f'  \bar "|" }


I’ve been asked now to lengthen the note just before the bar by making it into 
a dotted quarter:

{ \cadenzaOn g'1 c'4 f'4.  \bar "|" }

What I’d like to know is if there’s a way that I can modify the \bar function 
so that it automatically changes the duration of the note just before it, or if 
I have to break out the text replacement tools to modify all my source files.

As a further complication, the dotted quarter notation hasn’t been settled yet, 
as there are some arguing for making it a quarter with a tenuto and others for 
a half note, so I’d really like a function that allows me to switch between 
those three options (dotted quarter, quarter with tenuto, or half note) 
relatively easily.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Naming RFC: Properties, property sets, presets

2020-07-13 Thread Fr. Samuel Springuel
Reply received off-list.  Copying to list for record:

> On 13 Jul, 2020, at 10:58 AM, Urs Liska  wrote:
> 
> Hi Samuel,
> 
> Am Montag, den 13.07.2020, 10:00 -0400 schrieb Fr. Samuel Springuel:
>> So, if I've taken in the whole conversation, then the situation you
>> have is as follows:
> 
> I'd say about 95% (and nothing of the 5% is essential).
> 
>> 
>> 1) property sets define a list of properties and give them default
>> values (so that you never have a valid property without a current
>> value)
> 
> Correct, plus a type predicate.
> 
>> 
>> 2) a “preset” can change the values of properties in a property set,
>> but *cannot create new properties*.  In this case the “preset” is a
>> reusable local definition for the values of the properties in the
>> property set.
> 
> Correct. More specifically: a subset ranging from zero to all
> properties.
> 
>> 
>> 
>> Further your inheritance rules look something like this (where you go
>> down the list until you find a value for the property in question):
>> 
>> 1) local property setting (done in a \with block)
>> 2) value of the property from the named “preset”
>> 3) if the named “preset” has a parent, then the value of the property
>> from the parent
>> 4) recurse #3 on the parent until you run out of parents
>> 5) the default value given to the property when the property set was
>> created
> 
> Correct, except tha in 5) it is the current value of the property,
> either from when the property set was created or to what it has been
> changed with \setProperty.
> 
>> 
>> If you get to the end of the list without finding a value for the
>> property, then you necessarily have an invalid property (i.e. one
>> which has not been defined).
>> 
> 
> That's sort-of true but not what actually happens.
> 
> When \myFunction is called the first thing it does (this is part of the
> with-property-set macro, neither the function's programmer nor the
> function's user see that) is populating an alist with all properties
> from the property set, using the rules you outlined above.
> 
> When code in the function wants to access a property value it calls the
> implicitly created function (property '), which looks up
> this flat alist, and raises a warning if the function programmer
> mistakenly asked for an invalid property (so to determine invalid
> properties you don't have that "lookup ladder").
> 
> When a user passes a property in a \with block that is not defined in
> the property set this value is ignored and a warning issued. So here
> also no recursive lookup is done.
> 
> However, from the POV of what we're discussing here you got it
> completely right.
> 
>>> On 13 Jul, 2020, at 1:38 AM, Urs Liska 
>>> wrote:
>>> 
>>> My favourites so far are "configuration" and "flavor".
>> 
>> Given the above, I would go with “configuration.”  I also would
>> suggest that “default” be a restricted name which refers exclusively
>> to the set of values given to the properties when the property set is
>> created.  I.e. it should not be possible for the user to define a
>> configuration named “default” because it already exists (it’s defined
>> by \definePropertySet).  Changing the default configuration is only
>> possible using the \setProperty function.  This is syntactically
>> cumbersome, but it serves to emphasize what the values given at the
>> time of a property set’s creation actually are.
> 
> I don't think this is too cumbersome. In fact I had already settled
> with not requesting "presets" as part of a \with block but as an
> optional symbol? argument, and this lends itself pretty good to
> "default" being the default value for that argument.
> 
> This could mean something like this:
> 
> \definePropertyConfiguration \with {
>  color = #(rgb-color 1 .4 .2)
> }  analysis.frames style-one 
> 
> or (actually simpler)
> 
> \definePropertyConfiguration analysis.frames.style-one 
> `#((color .
> ,darkgreen)
>   (thickness . 2))
> 
> and uses like
> 
> % use a property configuration plus local overrides
> \frame style-one \with { y-upper = 12 } c'
> 
> or 
> 
> % use implicit "default" configuration plus local overrides
> \frame style-one \with { y-upper = 12 } c'
> 
> or
> 
> % just use tha current default (original values or modifications)
> \frame { c' d' e' }
> 
> Maybe I'll go with this. In any case: this will be the first time when
> this stuff gets properly documented, at least for now from end-user
> perspective.
> 
> Best
> Urs
> 
>> 
>> ✝✝
>> Fr. Samuel, OSB
>> (R. Padraic Springuel)
>> St. Anselm’s Abbey
>> 4501 South Dakota Ave, NE
>> Washington, DC, 20017
>> 202-269-2300
>> (c) 202-853-7036
>> 
>> PAX ☧ ΧΡΙΣΤΟΣ


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Naming RFC: Properties, property sets, presets

2020-07-13 Thread Fr. Samuel Springuel
So, if I've taken in the whole conversation, then the situation you have is as 
follows:

1) property sets define a list of properties and give them default values (so 
that you never have a valid property without a current value)

2) a “preset” can change the values of properties in a property set, but 
*cannot create new properties*.  In this case the “preset” is a reusable local 
definition for the values of the properties in the property set.


Further your inheritance rules look something like this (where you go down the 
list until you find a value for the property in question):

1) local property setting (done in a \with block)
2) value of the property from the named “preset”
3) if the named “preset” has a parent, then the value of the property from the 
parent
4) recurse #3 on the parent until you run out of parents
5) the default value given to the property when the property set was created

If you get to the end of the list without finding a value for the property, 
then you necessarily have an invalid property (i.e. one which has not been 
defined).

> On 13 Jul, 2020, at 1:38 AM, Urs Liska  wrote:
> 
> My favourites so far are "configuration" and "flavor".

Given the above, I would go with “configuration.”  I also would suggest that 
“default” be a restricted name which refers exclusively to the set of values 
given to the properties when the property set is created.  I.e. it should not 
be possible for the user to define a configuration named “default” because it 
already exists (it’s defined by \definePropertySet).  Changing the default 
configuration is only possible using the \setProperty function.  This is 
syntactically cumbersome, but it serves to emphasize what the values given at 
the time of a property set’s creation actually are.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Naming RFC: Properties, property sets, presets

2020-07-12 Thread Fr. Samuel Springuel
> On 12 Jul, 2020, at 9:38 AM, Urs Liska  wrote:
> 
> 
> \definePreset \with {
>  thickness = 3
>  Y-position = 2
> } my-function.appearance default
> 
> \definePreset \with {
>  parent = default
>  color = #green
> } my-function.appearance style-one
> 
> \definePreset \with {
>  parent = default
>  color = #magenta
> } my-function.appearance style-two
> 
> Using it the properties included in the preset are used while others
> keep the current global value. Additionally arbitrary properties can be
> overridden locally:
> 
> {
>  \myFunction \with {
>preset = style-two
>label = "Foo"
>thickness = 2 % properties from presets can be overridden too
>  } c'
> }
> 

To me this looks like a property set with inheritance rules.  Frankly, I would 
suggest implementing a unified notation and not have two separate concepts that 
need naming.  Unless there’s some fundamental reason why a “preset” without a 
parent is different from a “property set” that I’m missing.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Forced lyric hyphen

2020-07-11 Thread Fr. Samuel Springuel
Thank you both.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Forced lyric hyphen

2020-07-11 Thread Fr. Samuel Springuel
Is there a tweak/override that can be applied which will force a particular 
lyric hyphenEvent to always appear show its hyphen (moving lyrics/notes around 
if needed)?  I’m trying to deal with hyphenated words (“loving-kindness” in 
this particular example) and the hyphenEvent hyphen disappears under some 
circumstances if I use it exclusively and manually inserting a text hyphen into 
one of the syllables makes for an inconsistent double hyphen in others:


\version "2.20.0"

\new Staff
<<
\new Voice = "mel" { g' g' g' g' }
\new Lyrics \lyricsto "mel" { lov -- ing -- kind -- ness }
>>

\new Staff
<<
\new Voice = "mel" { g'( f') g'( f') g'( f') g'( f') }
\new Lyrics \lyricsto "mel" { lov -- ing- -- kind -- ness }
>>


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




LSR contributor access

2020-07-08 Thread Fr. Samuel Springuel
I’m trying to sign-up for the LSR in order to contribute a snippet.  However, 
even though I apparently successfully complete the “New element” form, I remain 
unable to login.  Is there some sort of lag in when registrations become active 
or is there some other problem going on?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Possible Feature Request?

2020-06-11 Thread Fr. Samuel Springuel
Right now we have ly:source-files which contains a list of all input files 
which have been opened up to the point of it’s call, but there is, so far as I 
can tell, no equivalent for output files.  How difficult would it be to add 
such a scheme function/list?

As I see it, LilyPond obviously knows the name of each file it writes to at the 
time of the write operation (regardless of the kind of file it’s writing), so 
it ought to be possible to simply have it store said name in a list (perhaps 
with a check to make sure it’s unique if LilyPond writes to the same file 
multiple times) either just before or just after the write operation.  
Temporary/intermediate files would not need to be added to the list (if 
LilyPond knows they are temporary/intermediate at the time of the write) or 
could be removed from the list as part of the clean-up operations that remove 
the files themselves.

Of course I’m entirely speculating without having examined the source to look 
for the various write operations.  Could one of the developers with more 
knowledge of the source be so kind as to reality-check this idea?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-06-09 Thread Fr. Samuel Springuel
> On 9 Jun, 2020, at 5:54 AM, Matt Wallis  wrote:
> 
> I found 
> https://lists.gnu.org/archive/html/lilypond-user/2020-05/msg00148.html very 
> interesting.
> It describes how to get lilypond to print out dependencies. Have you looked 
> into this?

That’s from the start of this thread and I’m making use of it in the 
with-deps.ly file (and in parse-only.ly on the GNUmake_dependencies branch).  I 
don’t use it exactly as it was originally presented in that message because the 
format wasn’t make-freindly, but ly:source-files is the starting point for 
generating the list of prerequisites.

> Be clear about the difference between = and :=. You are using = when := would 
> work fine.

That’s a good point.  I’m carrying over some bad practices from the original 
Makefile example in the documentation and should clean that up as much as 
possible.

> Put everything that moves (!) into a variable. For example, I'd have
> 
> PDF_DIR := PDF/
> 
> Include the backslash when you define a directory (as above). This is a habit 
> I've got into and now rely on. It helps me.

Can you elaborate on this?  Why would this be better than what I’ve got?



✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-06-06 Thread Fr. Samuel Springuel
I have now updated the repository I posted earlier 
(https://github.com/rpspringuel/lilypond_make) to contain two additional 
branches:

GNUmake_dependencies: Implements dependency generation as described in the 
GNUmake manual

mad-scientist_dependencies: Implements dependency generation as described in 
the article that Matt linked.  Right now I’ve used a simple sed script in the 
recipe to add the midi file to the targets of the dly file generated by 
LilyPond, but I haven’t given up on a more general solution.

Comments from anyone willing to look these over and play around with them are 
greatly appreciated.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-05-27 Thread Fr. Samuel Springuel
> On 26 May, 2020, at 6:13 PM, David Wright  wrote:
> 
> Because of the inability to collate multiple MIDI files, I've always
> renamed them. I tee the log into a nonce file, which I grep for their
> names in a postprocessing script. (I then trash the log unless there
> was an error code, in which case I leave it, renaming it foo.error.)

I’m beginning to think that this may be the way to go.  The article that Matt 
linked makes some good points about when dependency files actually need to be 
updated.  I hadn’t considered those points before and they lead to something 
different from what the GNUMake manual suggests as far as building the 
dependency files.  Implementing those ideas will require me to rework some of 
what I’ve been doing, but also would open up the possibility to do things like 
analyze the stderr from the compilation for messages which clearly identify the 
output.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-05-26 Thread Fr. Samuel Springuel
> On 26 May, 2020, at 12:09 PM, Timothy Lanfear  wrote:
> 
> Maybe this code can give some hints on how to decide if midi is being 
> produced.

That’s the first code I’ve seen that’s been able to definitively show when a 
midi file is being produced.  Thank you.

Now, there is the issue of it being inside the book block, which makes it 
harder to incorporate into something like parse-only.ly (which generally 
operates either before or after all input is read), but at least it gives me a 
starting point for something to play with.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-05-26 Thread Fr. Samuel Springuel
> On 26 May, 2020, at 6:18 AM, Matt Wallis  wrote:
> 
> For C/C++, there is an excellent discussion of the issues about automatically 
> producing dependencies and dealing with them in make:
> 
> http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
> 
> I think much of this is relevant to lilypond too. There's even a section 
> entitled "Dependencies for non C files".
> 
> With regard to wanting to avoid typesetting when you want to produce only the 
> dependencies, this section discusses how to set up a makefile to use 
> dependency information that is created as a side-effect of compilation:
> 
> http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#combine
> 
> I know I would find it useful if some of the dependency generation flags 
> (-MMD, -MF, -MP, -MF , see 
> https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html) available on 
> C/C++ preprocessor were implemented in lilypond. The work discussed in this 
> thread might be paving a path towards that.

I hadn’t seen that article before, but I’ve started reading it and can 
definitely see that there are some possibilities there.  I’m going to take the 
time to pursue this and see how I can adapt my process.


> Lilypond can produce multiple output files:
> 
> One difference between C/C++ compilers and lilypond is that where a C 
> compiler produces exactly one .o file for each .c file, lilypond can generate 
>  several output files e.g. .pdf and .midi, but there are other examples too - 
> I sometimes produce a separate .png for each page of a score. And I expect 
> that the set of output files may depend on the lilypond command line options, 
> and not just on the .ly file on which it is being run.
> 
> Is there a way to get lilypond to output this list of targets, analogous to 
> the ly:source-files capability?
> 
> I think in most cases, the issues around multiple targets can be ignored but 
> there may be some cases where a full solution would need to handle them ... 
> more thought required.

I’ve already accounted for this in my most recent version of parse-only.ly.  
It’s not as straight forward as ly:source-files but by looking at 
(ly:get-option 'backend), (ly:get-option 'aux-files), (ly:parser-output-name) 
and (ly:output-formats), it is possible to determine which output files 
lilypond is going to produce (except for the midi, I have yet to find any 
option or function which will indicate that a midi is being produced).  The 
applicable code is:

% Construct list of target extensions
% We look at which backend is being used and what formats have been requested 
to determine this list
% Since some backends cause the list of formats to be ignored, we check that 
first, only looking at the
% formats if the backend would allow that.
#(define target-extensions (cond ((equal? (ly:get-option 'backend) 'svg) (list 
"svg"))
 ((equal? (ly:get-option 'backend) 'scm) (list 
"scm"))
 ((equal? (ly:get-option 'backend) 'ps) 
(uniq-list (sort-list (ly:output-formats) string

Re: Identify included files

2020-05-25 Thread Fr. Samuel Springuel
> On 25 May, 2020, at 3:12 PM, Wols Lists  wrote:
> 
> So. Am I correct in thinking that, if you change one .ily file, you need
> to rebuild the entire makefile? WHY?

> And it means if put a new include into
> dynamics.ily, I just need to create/update the line for dynamics.ily,
> and everything that depends on it will rebuild if I run the "make" command.

Not the entire makefile, just the dly files (which are only partial makefiles) 
which depend on that ily file.  This is necessary to take care of your later 
issue automatically.  By making the dly files depend on the same files which 
the associate pdf file depends on make will automatically check for changes to 
the number of included files.

> partTrombone.ly voiceTrombone.ily
>   :


This is not a valid statement for make (even if coerced into the correct 
syntax).  While partTrombone.ly may include voiceTrombone.ily, it does not 
actually depend on it.  Dependency in make implies one thing is required to 
*create* the other, not that they cannot be used independently (which is what 
you appear to mean by “virtual object”).

Each dly file looks like this:

target.dly target.pdf : target.ly include_1.ily include_2.ily 
path/to/include_3.ily

The separator (:) splits the targets (the files which can be built) from their 
prerequisites (the files needed to do the building).  If make determines that 
any target doesn’t exist or is out-of-date, then it will rebuild the target.  
That’s all that’s in a single dly file, so it does not constitute a complete 
makefile.  Instead it is read into the master makefile, which also contains the 
rules for building both dly files and pdf files.

The master makefile looks like the one I posted earlier in this thread.  It co  
ntains the rules for building dly files and pdf files.  Both of these are 
pattern rules.  This means that one rule tells make how to build all dly files 
from a ly (and parse-init.ly) file and another tells it how to build all pdf 
files from a ly file.

Perhaps a working example will be more productive than a purely theoretical 
discussion.  Here’s a repository that I built using code from the documentation:

https://github.com/rpspringuel/lilypond_make

Right now it just tries to actualize the example from 
http://lilypond.org/doc/v2.21/Documentation/usage/make-and-makefiles (using 
content taken from 
http://lilypond.org/doc/v2.21/Documentation/snippets/staff-notation#staff-notation-orchestra-choir-and-piano-template).
  I had to make a few changes to make it work on my system, but I tried to make 
those changes be as system-agnostic as possible.  If you’ll accept that this is 
a working representation of the makefile example from the documentation, then 
I’ll go about showing how it gets modified to use the system that I’ve worked 
out.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Changing slur behavior

2020-05-25 Thread Fr. Samuel Springuel
> On 25 May, 2020, at 1:01 PM, Shane Brandes  wrote:
> 
> Increase the spacing-increment on line twenty. I tried a value of 2 and it 
> worked fine.
> 
> regards,
> 
> Shane

Yep, playing with that parameter allowed me to tweak the note spacing to 
prevent the collisions.  I also found that by tweaking a couple of the other 
parameters I could get a spacing effect that I liked even better.  Thanks for 
that.

However, I’ve found another problem, this time related to \set stanza in the 
lyrics.  Seems that the width of the text set that way is not being accounted 
for.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


slur spacing.ly
Description: Binary data


Re: Identify included files

2020-05-25 Thread Fr. Samuel Springuel
On 25 May, 2020, at 12:46 PM, David Wright  wrote:

> But it seems to me that your OP had the makings of an A/B problem.
> You originally asked for a script that worked in the forward
> direction: a list of top-level file's dependencies, for constructing
> DEP. Having got LP to perform that with DK's method, it turns out
> your goal is something different: to discover all the top-level files
> that need to be recompiled when you edit an arbitrary \include file.

Not really an A/B problem in that I’m not changing the end goal.  I needed (and 
asked) about A (constructing the list of dependencies) because solving A was 
the prerequisite for getting make to do B (figuring out which scores needed to 
be recompiled when I changed a source file).  While I briefly toyed with the 
idea of doing B myself (and indeed, had a proof of concept bash script), 
Jacques pointing to make just made it clear to me that B was already solved by 
make, provided I solved A in a make-friendly way.

> That means that, having edited a mid- to low-level source file in your
> library, you have to search every DEP to see whether that file is
> mentioned. This includes those of the "someone" who uses your library.
> And all those DEPs must be kept up-to-date if the search is to be
> performed correctly.

That’s true, but this is something make can do automatically given a rule which 
defines how to create the DEPs.  Since such a rule already exists for doing 
this with CC -M (and is in the gnumake manual: 
https://www.gnu.org/software/make/manual/html_node/Automatic-Prerequisites.html#Automatic-Prerequisites),
 it was fairly trivial for me to adapt that.

> The idea behind my later script was: given "some simple rules in your
> source layout" and the constituency of your LP sources, the backwards
> search for reverse dependencies can be carried out any time any source
> file is altered, without the need to keep DEP files up-to-date,
> because it greps the active set of files.

If I’m understanding you correctly, your point is that A doesn’t need to be 
solved at all, if you’re willing to solve B in a totally different fashion 
(i.e. not use make).  And I would say that that is true.  But it means ignoring 
the tools that are already at my disposal.  While I’m all for learning new 
things, I hate spending time doing things that someone else has already done if 
I can use their work.

> 
> Given a top-level .ly file and DK's code, I don't see how you
> would avoid any of the recompilng required when you use DK's
> output. The last line of the script says
> 
>#(format #t "~{~a\n~^~}" (ly:source-files))
> 
> How do you use source files without recompiling them—that's what 's
> perplexed me all along in this thread. All I've tried to do is give
> an idea for finding a list of current top-level files that \include an
> arbitrary, specific file. Anyone, with assistance from LP, can make
> this as hard as they like for themselves.

I think this is where you’ve missed something.  When using DK’s code as the 
init file (or my later version, which make the output more make-friendly), 
LilyPond **does not actually typeset the music.**  All it does is read through 
the files to construct ly:source-files and then output that list to stdout.  It 
is the equivalent, in some sense, of the -M option for a CC (which is where the 
whole analogy got started).  cc -M sample.c does not create sample.o, it 
outputs the list of files that sample.o depends on.  Likewise lilypond --init 
parse-only.ly sample.ly does not create sample.pdf, it outputs the list of 
files that sample.pdf depends on.  In both cases we’re using the compiler’s (cc 
or lilypond) already existing knowledge of how to read its source and find the 
mentioned includes, but instead of telling it to use that knowledge to create 
the target (the object file or pdf), we’re telling it to use that knowledge to 
create the dependency list.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Changing slur behavior

2020-05-25 Thread Fr. Samuel Springuel
I’ve come back to this after a bit and have found a deal breaker of a problem: 
when the slur spans over notes which go both up and down, the note heads after 
the turn around collide.  See attached example.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


slur spacing.ly
Description: Binary data


Re: Identify included files

2020-05-24 Thread Fr. Samuel Springuel
> On 23 May, 2020, at 7:34 PM, David Wright  wrote:
> 
> If you follow some simple rules in your source layout, constructing
> such a list might be most straightforward to do in the shell, using
> grep.

It’s not quite as straight-forward as you seem to think:

1) You haven’t accounted for the possibility of multiple folders with varying 
levels of hierarchy.  The changed file might be in ../ relative to one file, 
../../ relative to another, ../some/dir/levels relative to a third and other 
possible variations.  It might also be specified /with/an/absolute/path in some 
files.  All of that complicates the search string for grep.

2) You haven’t accounted for -I options when lilypond is called.  Some of the 
files included might not be in the same directory tree at all.  You’ll need 
access to the list of -I options with which lilypond is called in order to 
properly identify all the possible top-of-tree/ folders.  You might be able to 
extract what -I flags a particular project has that are specific to it by 
examining some file in the project folders, but what do you do if that 
information is stored in a personal shell script or alias setup that catches 
all lilypond calls and makes sure certain -I flags are added (as might be 
common for someone using openLilyLib or with a personal library of formatting 
snippets)?  Now your shell script has to go analyze your personal shell script 
or shell profile.

3) What about the relative-includes option?  If an included file includes other 
files, where are these files located?  Is the given path relative to the 
current file or to the top-level file?  Our grep search string is getting even 
more complicated to account for this.

Sure, your ideas would probably catch most cases, and it would be possible to 
write a shell script that accounted for these complications.  But you’re 
duplicating a whole lot of work that’s already been done.  LilyPond itself 
already knows how to deal with these factors to find the included files (either 
because it’s built-in or because you’ve already told it what to do when you 
configured your system).  Why reinvent this wheel in a shell script if LilyPond 
can be made to output what it already knows for you?


Another issue: How are you keeping track of which files have changed (and thus 
should seed your script)?  If you recompile frequently after only changing a 
file or two, it’s fairly easy, but what if the change you’re working on takes 
several days to (either due to complexity or restricted time) or touches a 
whole bunch of files?  Are you supposed to manually remember all those changes? 
 Or maybe you’re planning on querying your version control system (you are 
using one, right?) for that information?  As a last resort, you might also look 
at modified times on the pdfs (if they exist) and the source files.

Of course, given a proper list of file dependencies, make will do all this work 
for you.  That’s what it is for.  Pair make with a LilyPond based tool which 
can determine dependencies automatically and it becomes even simpler because 
the system is self-updating.

Now, I will grant you, that if LilyPond could not be convinced to output what 
it knows about file dependencies (and the Frescobaldi project hadn’t written 
python-ly which has the include_args() command in the ly.slexer module), then I 
probably would have written a shell script like you describe to get the 
dependencies information (or, more likely, to just do the recompiling itself 
and not bothered with make at all).  However, once David K. showed that it was 
possible for LilyPond to output that information (and even better, without 
going through all the work necessary to produce a score at the same time) it 
makes the most logical sense to me to use that rather than start from scratch 
with a shell script (or start from include_args() in python-ly to write a 
Python script).

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-05-22 Thread Fr. Samuel Springuel
> On 21 May, 2020, at 9:08 PM, David Wright  wrote:
> 
> Look¹, I'm not the one making this analogy. I'm trying to make any
> sense of it, and why this "dependency file" is being built.

Well, perhaps it’s time to drop the analogy then and work with an example.  For 
reference sake, let’s use the makefile example in the documentation:

http://lilypond.org/doc/v2.21/Documentation/usage/make-and-makefiles

In that file you’ve got the following section which lists file dependencies:

# The dependencies of the movements.
$(piece)I.pdf: $(piece)I.ly $(notes)
$(piece)II.pdf: $(piece)II.ly $(notes)
$(piece)III.pdf: $(piece)III.ly $(notes)
$(piece)IV.pdf: $(piece)IV.ly $(notes)

# The dependencies of the full score.
$(piece).pdf: $(piece).ly $(notes)

# The dependencies of the parts.
$(piece)-cello.pdf: $(piece)-cello.ly cello.ily
$(piece)-horn.pdf: $(piece)-horn.ly horn.ily
$(piece)-oboes.pdf: $(piece)-oboes.ly oboe.ily
$(piece)-viola.pdf: $(piece)-viola.ly viola.ily
$(piece)-violinOne.pdf: $(piece)-violinOne.ly violinOne.ily
$(piece)-violinTwo.pdf: $(piece)-violinTwo.ly violinTwo.ily

As I see it, there are two problems with this section:

1) None of these dependencies mention symphonyDefs.ily.  If I make any changes 
to it (say I change the paper size from A4 to Letter), then make will **not** 
know the pdfs are now out of date.

2) These lists are manually maintained.  Each time I add another part I’ve got 
to add another line.  If I add more dependencies (perhaps by pulling from a 
library of commonly used tweaks that I reuse from project to project), I have 
to make sure those are listed.  If I decide to change the output format from 
pdf to eps, I’ve got to change everyone of these rules (as well as a couple of 
other things). Basically, any little change to the project structure requires 
me to edit the Makefile, sometimes in several places, and that introduces 
opportunities for error.

The point of the dependency files that I’m trying to build is to fix these 
problems and do so automatically (so that once it is fixed, its fixed for all 
time).  Under this idea (with parse-only.ly in the file structure alongside 
Makefile, latest version is attached) the above section of the makefile becomes:

LY_all := $(wildcard Parts/*.ly) $(wildcard Scores/*.ly)

include $(LY_all:.ly=.dly)

%.dly: %.ly parse-only.ly
@set -e; rm -f $@; \
$(LILY_CMD) --silent --init parse-only.ly $< > $@.; \
sed '1s,^,$@ ,' < $@. > $@; \
rm -f $@.

You’ll note, this is fewer total lines and it doesn’t care how many parts or 
scores there are.  Add a part or a score and make will notice and create the 
dependency list for that part/score automatically.  Find a snippet that does 
something that you want to happen in one or more scores, simply add the 
necessary \include statements to the appropriate file(s) and make will notice 
and update accordingly.  Want to switch from pdf to eps (by adding the -E flag 
to LILY_CMD)?  Well, there are other parts of the Makefile which will need 
edits (because the Makefile was not written with this switch in mind), but as 
far as the dependencies are concerned no changes are necessary, you just need 
to clean out the existing dly files (which are written for the pdf targets) and 
make will create the new ones for the eps targets.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


parse-only.ly
Description: Binary data


Re: Identify included files

2020-05-21 Thread Fr. Samuel Springuel
> On 21 May, 2020, at 9:36 AM, David Kastrup  wrote:
> 
> antlists  writes:
> 
>> On 21/05/2020 01:49, David Wright wrote:
>>> I don't understand your equivalence between .ily and .h files. The
>>> .ily file(s) can contain just as much code as the .ly file(s), whereas
>>> .h files don't contain any code at all (in the sense of producing
>>> executable code for the next stage.
>> 
>> a) just like .h files, .ily files can't be passed directly to a
>> compiler for compilation.
>> 
>> b) who says .h files don't produce executable code? They often contain
>> code, sometimes entire functions.
> 
> The point of .h files is that they are intended to be included by more
> than one compilation unit resulting in an executable.
> 
> As such, they are limited with regard to the code they can contain.
> They can contain
> 
> a) inline function definitions: those can occur in multiple compilation
> units as long as they are identical.
> b) static inline: do not even need to be identical, are per-unit.
> c) static data definitions, are per-unit.
> d) template function definitions
> 
> I don't think that .ly/.ily is all that comparable here...
> 
> -- 
> David Kastrup
> 

The analogy is not perfect, but then no analogy is (otherwise it wouldn’t be an 
analogy).  Lilypond doesn’t enforce a distinction between .ly and .ily files in 
the same way that C enforces the distinction between .h and .c files.  Further, 
.pdf files are stand alone in a way that .o files are not.  The linker level 
which combines .o files into an executable would have as its closest 
approximation in the LilyPond world assembling several pdfs into some kind of 
portfolio.  And this is another point where the analogy breaks in that an 
executable cannot contain incompatible .o files but a portfolio can contain 
pdfs of scores with vastly different styles.  The result may not be as 
professional looking, but it’s possible.

Here are the parts of the analogy that do work:

1) .ily files cannot produce scores.  Sure, I can call LilyPond on them 
directly, but regardless of the options I use, no score will ever result.  This 
may be purely by convention (as in, LilyPond itself doesn’t enforce this, it 
really couldn’t care what the extension on its input files is), but it’s a 
convention which I rigorously apply in the files I write.  In this respect, 
.ily files are like .h files which also cannot, by themselves, ever produce a 
.o file. For .h files, at least a dummy.c file is needed to include the .h 
file.  My .ily files likewise need a .ly file to include them to produce a 
score.

2) .ly files do produce scores.  If I call LilyPond on an .ly file, then I 
expect a score to come out (in pdf format by default, but other formats are 
possible too if I use the right options or flags).  Again, this is primarily a 
convention, as LilyPond won’t throw an error on a .ly file which doesn’t 
produce a score (but has no other problems).  However, it is a convention that 
I strictly apply to my files.  In this respect .ly files are like .c files, 
which can be compiled to create .o files.

3) Further the relation between the .ly and .ily files is similar to the 
relation between .c and .h files.  .ly (.c) files do not, themselves, depend on 
the .ily (.h) files that they include.  There is no build process which creates 
a .ly (.c) file from the included .ily (.h) files.  However, if I make a change 
to a .ily (.h) file, then the .pdf (.o) file which is produced when LilyPond 
(GCC) compiles a .ly (.c) file which includes that changed file is out of date 
and needs to be recompiled. In this regard the directed acyclic graph (DAG) 
which illustrates these relationships is the same, just with one less level 
(unless I make use of a pdf merge tool to replace the linker level).


My goal is to inform make of these relationships so that when I tweak a 
LilyPond source, only the scores affected by that source are recompiled.  This 
may be several pdfs, but it’s not all of them, even when I tweak an ily file 
because not all ily files are included in all scores.  Furthermore, the more I 
work on this project, the more I tend to split up the “formatting” file so that 
I actually have several, each of which is responsible for a single aspect of 
the formatting.  This makes it easier for me to find code when I need to make 
adjustments to a particular aspect of the formatting.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Suggestion to make sharps and flats persistent

2020-05-20 Thread Fr. Samuel Springuel



> On 20 May, 2020, at 10:22 AM, David Kastrup  wrote:
> 
> myNames = \language-pitch-names.english
> myNames.do = c
> myNames.re = d
> myNames.mi = e
> myNames.fa = f
> myNames.sol = g
> myNames.la = a
> myNames.ta = bes
> myNames.ti = b
> language-pitch-names.solfegenglish = \myNames
> \language "solfegenglish"
> 

Is that a recent change to the syntax?  It definitely looks much nicer than 
what I had lying around. 


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-05-20 Thread Fr. Samuel Springuel
> On 20 May, 2020, at 12:05 PM, Fr. Samuel Springuel  
> wrote:
> 
> Use of the -dbackend=eps (or setting the backend to eps in the file) also 
> causes the production of several other files (*-systems.tex, *-systems.texi, 
> *-systems.count, and the eps and pdf files for each system) while -E (or 
> --eps) does not.  So far, however, I haven’t been to determine the difference 
> between these two situations.  Is there some variable (or scheme function) 
> that can be used to figure out if these files are being produced (and how 
> many systems there are)?

Okay, I found the answer to this one.  The aux-files option (accessed with 
(ly:get-option 'aux-files)) indicates that these files are being created.  

It’s also occurred to me that the only way to determine the number of systems 
is to actually do the typesetting.  Any attempt, therefore, to determine the 
targets and prerequisites automatically without typesetting the document cannot 
know exactly how many there are and has to be written from that perspective.  
This part of the question was akin to asking someone how many apples are in a 
bag while keeping the bag hidden from them.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-05-20 Thread Fr. Samuel Springuel
As an exercise in Scheme programming (and because I’m something of a 
perfectionist), I’m working on improving the output when using parse-only.ly by 
having it account for `--format` flags and the various backends when 
constructing the target portion of the make rule (the version I previously 
posted always assumes the target is pdf).  To that end I’ve been exploring some 
of the scheme functions and have come across the ly:output-formats and 
ly:parser-output-name as welll as (ly:get-option 'backend).  However, I have a 
few questions:

ly:output-formats is a list whose contents are determined by the `--format` 
flags.  However, when eps format is requested, ps, not eps is what’s added to 
the list.  To determine that the output is eps I then also need to look at 
(ly:get-option 'backend), which will be eps or ps (or svg or scm, but they only 
produce a single file format, regardless of --format flags).  I’ve also noticed 
that if both ps and eps files are requested with flags, then apparently only 
the eps file is produced, though ly:output-formats will have two ps entries.  
So, my question is can lilypond ever produce both ps and eps file from a single 
run, or does the use of the eps backend preclude the production of ps files?

ly:parser-output-name stores the base name of the output file, but doesn’t 
contain directory information about where the output file is supposed to go 
(unlike the list of files in ly:source-files, which do contain the directory 
information about the location of the source files).  This make sense because 
the output defaults to the current working directory when lilypond is called.  
However, if I use the --output option, I can force LilyPond to switch working 
directories before processing the file (and thus change the destination of the 
output).  However, I cannot find where that directory information is stored.  
Is it stored somewhere (if so, where)?

Use of the -dbackend=eps (or setting the backend to eps in the file) also 
causes the production of several other files (*-systems.tex, *-systems.texi, 
*-systems.count, and the eps and pdf files for each system) while -E (or --eps) 
does not.  So far, however, I haven’t been to determine the difference between 
these two situations.  Is there some variable (or scheme function) that can be 
used to figure out if these files are being produced (and how many systems 
there are)?

Finally, what about midi?  I have yet to find a scheme function that will tell 
me if the file being parsed will produce a midi file when typeset.  Is there 
anything that would do that?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Suggestion to make sharps and flats persistent

2020-05-20 Thread Fr. Samuel Springuel
> On 20 May, 2020, at 9:43 AM, Paul McKay  wrote:
> 
> Todays thoughts are: when you specify \language, then part of what you are 
> doing is setting up the parser to understand which character sequence should 
> indicate an f-sharp. I would like to be able to temporarily reconfigure this 
> so that as well as mapping ‘fs’  to f-sharp you can ask it to map ‘F’ to 
> f-sharp. I imagine that the parser is a finite state machine and that at the 
> appropriate point it looks up a list. Normally this would say that ‘fs’ means 
> f-sharp (or ‘fes’ means f-sharp if you were in another language). I guess it 
> looks up a list of pitch names to check whether the current token is a pitch 
> as expected and, if so, which one. If that list might have ‘F’ added at the 
> beginning of the search order, then the parser would recognize the letter ‘F’ 
> as meaning the pitch f-sharp. Later on, you could ask to remove the ‘F’ entry 
> from that list. Removing it would automatically revert to the default 
> behaviour because the list would still contain the entry to say that ‘fs’ 
> means f-sharp. To avoid confusion, the request to add an item to the list 
> would have the form (newName, pitchNameInOriginalLanguage).

I’ve done something like this for transcribing solfege music (while retaining 
English note names for other purposes):

myNames = #(append (assoc-get 'english language-pitch-names)
  `(
(do . ,(ly:make-pitch -1 0 NATURAL))
(re . ,(ly:make-pitch -1 1 NATURAL))
(mi . ,(ly:make-pitch -1 2 NATURAL))
(fa . ,(ly:make-pitch -1 3 NATURAL))
(sol . ,(ly:make-pitch -1 4 NATURAL))
(la . ,(ly:make-pitch -1 5 NATURAL))
(ta . ,(ly:make-pitch -1 6 FLAT))
(ti . ,(ly:make-pitch -1 6 NATURAL))
  ))

solfegenglish = \myNames
#(ly:parser-set-note-names solfegenglish)


You should be able to adapt this for any particular set of note names you want.


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Global colour substitution for specific characters in lyrics

2020-05-20 Thread Fr. Samuel Springuel
> On 20 May, 2020, at 2:41 AM, Witold Uchman  wrote:
> 
> Hello!
> 
> I am looking for a way to simplify input in a book of psalms, namely to be 
> able to simply put an * in lyrics and make the character in red.
> 

I define a special function for this:

#(define aster #{ \set stanza = \markup \with-color #gregoriocolor * #})

Given this definition, I can put `\aster` into the lyrics exactly where I want 
it.


`gregoriocolor` is used in several locations in my files, and has the following 
definition:

gregoriocolor = #(rgb-color 0.898 0.208 0.172)

You can, of course, change that to the color you actually want.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-05-18 Thread Fr. Samuel Springuel
> On 18 May, 2020, at 11:30 AM, David Wright  wrote:
> 
> If you were compiling a C program foo.c into an executable, what you
> would be trying to avoid is recompiling fnbar.c into fnbar.o over
> and over again (and all of its similar companions).
> 
> Can you explain which of your files are the equivalents of fnbar.o.
> (In python, for another example, they'd be your *.pyc files, and
> python looks after all this housekeeping itself.)

As I see it, the filetype equivalencies roughly map as this:

.ily -> .h
.ly -> .c
.pdf -> .o

To this I would also add one more file type for storing dependency information
.dly -> .d


> On 18 May, 2020, at 11:35 AM, David Wright  wrote:
> 
> If you follow some simple rules in your source layout, constructing
> such a list might be most straightforward to do in the shell, using
> grep. For example,
> 
> $ grep -e '^[[:space:]]*\\include ' foo-top-level.ly
> 
> will find all the includes in the source, restricting it to the start
> of lines, so that you can avoid false hits from, say, internal
> documentation or test includes.
> 
> You would insert the resulting filenames into two lists, files visited
> and all files. Iterate on the files list, skipping those visited,
> until the files to visit reaches zero (lists are of equal length).
> 
> One complication is applying the search of libraries in the same
> manner as LP, particularly if you rely on the order of searching.
> Another is if you're using external libraries where you have no
> control over their include format.
> 
> If you're not comfortable with shell programming, obviously it would
> be preferable to use a language like Python or Perl for coding.
> 
> The resulting list could be used for, say, making a tarball of source
> files for distribution, or for driving make to produce PDFs that are
> assembled by, say, TeX programs into final documents.


My original thoughts were to write something in Python or bash and it probably 
would have looked something like what you propose.  Being a firm believer in 
not reinventing the wheel whenever possible, I decided to ask the list to see 
if this had been done already first.


> 
> On 18 May, 2020, at 12:22 PM, antlists  wrote:
> 
> Okay, does that mean you want a list of all the lilypond include files, or 
> just your own?
> 
> If you're digging into the internals of lilypond, then it'll be a big job, 
> and makes it dangerous to upgrade lilypond. Because I assume that means 
> you're actually modifying lilypond's internal structure. What I do, anything 
> of lilypond's that I modify, I split it out into my directory structure, and 
> then over-ride lilypond's version from within my source. That way, what 
> happens to lilypond during an upgrade is no concern of mine (other than 
> changes to syntax which mess up my source :-)
> 
> If it's just your own files you're concerned about, then grep will probably 
> do the trick. I don't know how to recurse directories, but making it search 
> all the files in a directory for "include", and tell you which file it found 
> that line in, is pretty basic.
> 
> You can then read up on make for how to create those virtual objects, and use 
> an editor to put them in your makefile. Not totally automated, I admit, but 
> fairly simple grunt-work. The sort of thing I could have written a BASIC 
> program to do in 10 minutes, except I don't have access to a BASIC I 
> understand how to use any more - ironic - as computers have got easier to 
> use, so the programming languages have got harder...
> 

I’m not playing with the lilypond internals (and don’t need them in my list of 
prerequisites), but I do occasionally have files which make use of oll packages 
(I’ve been playing with the Edition Engraver recently).  Those packages have 
their own hierarchy outside my project hierarchy.  Further, the location of 
their hierarchy may be different on different machines (I always try to set 
things up with collaboration in mind, even when I’m not currently collaborating 
with anyone).  As a result, scripts which don’t understand how LilyPond finds 
files and simply look for “\include” statements are likely to come up short and 
not find all prerequisites.



> On 18 May, 2020, at 11:47 AM, Urs Liska  wrote:
> 
> I'm pretty sure that the only two ways to reasonably go forward is to
> either invoke LilyPond to produce this list or to use a library that
> already knows how LilyPond works. As I mentioned somewhere at the top
> of this thread, Frescobaldi knows pretty well how to recurse into the
> include files.
> 
> I would write a tool in Python that calls python-ly (well, probably
> quickly, it's designated successor (
> https://github.com/frescobaldi/quickly)) to produce the list of
> dependencies and feed that into Make.

I’ve reached a similar conclusion.  Right now I’m going forward with the 
lilypond route simply because David K.’s parse-only.ly means I’m closer to that 
solution than I am with python-ly or quickly (as I’ve never 

Re: Identify included files

2020-05-18 Thread Fr. Samuel Springuel
> On 18 May, 2020, at 9:37 AM, antlists  wrote:
> 
> define trombone-notes.ly as a target, define it as changed if its 
> dependencies change, and say "it doesn't exist as a file that can be created 
> with a command".

Right, that’s the step I’m trying to automate.  Make itself cannot determine 
the list of prerequisites.  You either need to do that manually (a real pain) 
or provide a tool that can examine a file, determine what its prerequisites are 
and then write them out in a way that make understands.

From the manual for GNU Make: 
https://www.gnu.org/software/make/manual/html_node/Automatic-Prerequisites.html#Automatic-Prerequisites

The example there uses the -M flag for a C compiler.  I’m looking to come up 
with an equivalent for LilyPond.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-05-17 Thread Fr. Samuel Springuel
> On 16 May, 2020, at 5:31 PM, David Kastrup  wrote:
> 
> The problem is that there are quite a few things in there that make no
> overwhelming sense for the task you want to solve.  In order to allow
> for "snappy" init files doing specific tasks like this version of
> parse-only.ly does, one should likely move some of its content to
> declarations-init.ly or elsewhere.  At the current point of time, the
> ability to set up different init files is not really something one can
> cleanly put to good use.
> 
> So generally I'd be wary expecting this to continue working forever, but
> hopefully if it stops working, the necessary changes should make for a
> cleaner solution then.
> 
> -- 
> David Kastrup

That’s really too bad as this is something that seems like it would really come 
in handy.  Certainly, as I’m learning make having something which is equivalent 
to the -M flag for a C compiler would be very handy for generating dependencies.

Though, I did find one problem thus far: \omit seems to create problems when 
placed as a context mod.  In the attached file I’ve got the two methods for 
getting rid of bar numbers (from the manuals).  If I use the \omit version, 
then processing with parse-only.ly generates "error: not a context mod”.  If I 
use the \remove version, then everything is fine.

Of course, I still get the list of files I want on the stdout, so I can totally 
live with this.  The only difficulty is that when this occurs lilypond exits 
with a non-zero exit code, so any scripts I write based on this can’t use the 
error code to determine if the command completed successfully.


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


test.ly
Description: Binary data


Re: Identify included files

2020-05-16 Thread Fr. Samuel Springuel
> On 15 May, 2020, at 5:04 PM, David Kastrup  wrote:
> 
> "Fr. Samuel Springuel"  writes:
> 
>> Before I start writing a script to do this, is there an existing tool
>> which will identify all the `\include` files that a LilyPond file
>> depends on?  Even better, one that will work in a recursive fashion?
> 
> You can use a file like
> 
> ...
> and call it with
> 
> lilypond --init parse-only.ly actual-file-name.ly 2> /dev/null
> 
> and it should be pretty fast.  Of course the file list includes
> parse-only.ly...
> 
> 
> -- 
> David Kastrup

Very nice.  I’ve tested the various options and this seems to be the best 
option.  While I haven’t tested with a really big file, this option appeared to 
be independent of file size while the option I came up with isn’t.

Is there any chance that something like this could be introduced into LilyPond 
core?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-05-15 Thread Fr. Samuel Springuel
> On 15 May, 2020, at 12:03 PM, Fr. Samuel Springuel  
> wrote:
> 
>> On 15 May, 2020, at 3:43 AM, Valentin Villenave  
>> wrote:
>> 
>> On 5/15/20, Fr. Samuel Springuel  wrote:
>>> Before I start writing a script to do this, is there an existing tool which
>>> will identify all the `\include` files that a LilyPond file depends on?
>>> Even better, one that will work in a recursive fashion?
>> 
>> Since 2.19.39, you can simply use this:
>> 
>> #(display (ly:source-files))
>> 
> 
> I’m hoping for something that doesn’t require actually typesetting the 
> document.  My end goal is a script which will somewhat intelligently 
> determine which files in a project have changed and re-typeset them as 
> needed.  Having to typeset the document in order to determine which files it 
> depends on means I’ve already done the typesetting.  Is there a way to pass 
> that and \set Score.skipTypesetting = ##t at the command line?
> 

So, I’ve done some experimenting on my own and here’s what I’ve discovered:

`-dno-print-pages` will prevent lilypond from producing typeset output.  My 
preliminary testing seems to indicate that this is indeed faster than actually 
typesetting, but I haven’t rigorously tested this to determine what kind of 
speed up is produced.

`#(display (ly:source-files))` must be after any `\include` statements in the 
LilyPond file in order for the list to be complete.  As such, it is best 
positioned at the end of the file.

`lilypond -` will read in from stdin, allowing piping input into the command 
and thus using pipes to modify a file “on-the-fly” without actually changing 
the file on the disk. 

Combining all this, I get the following:

echo "#(display (time ly:source-files))" | cat  - | lilypond 
-dno-print-pages -

This will send a list of the included files to stdout (there’s also some stuff 
on stderr which you’ll see if testing on the console).  The first two entries 
will be `init.ly` (with full path) and `-`, which can be thrown away, but the 
remaining entries are what I’m looking for (and it’s fully recursive).

One difficulty: if reading input from stdin, `\include` statements which 
navigate through the directory tree may experience problems if there is a 
mismatch between the current working directory and the location of the file 
being pushed through the pipes to stdin.  One way to get around this is to make 
use of the --include option to add in the directory of the file.  One easy way 
to do this is to define a variable `filename` with the name of the file, then 
the full command is:

echo "#(display (time ly:source-files))" | cat “$filename" - | lilypond 
--include="$(dirname $filename)" -dno-print-pages -

Now I just need to turn this list into something that can be used to figure out 
if the target needs to be recompiled.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Identify included files

2020-05-15 Thread Fr. Samuel Springuel
> On 15 May, 2020, at 3:43 AM, Valentin Villenave  
> wrote:
> 
> On 5/15/20, Fr. Samuel Springuel  wrote:
>> Before I start writing a script to do this, is there an existing tool which
>> will identify all the `\include` files that a LilyPond file depends on?
>> Even better, one that will work in a recursive fashion?
> 
> Since 2.19.39, you can simply use this:
> 
> #(display (ly:source-files))
> 

I’m hoping for something that doesn’t require actually typesetting the 
document.  My end goal is a script which will somewhat intelligently determine 
which files in a project have changed and re-typeset them as needed.  Having to 
typeset the document in order to determine which files it depends on means I’ve 
already done the typesetting.  Is there a way to pass that and \set 
Score.skipTypesetting = ##t at the command line?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Identify included files

2020-05-14 Thread Fr. Samuel Springuel
Before I start writing a script to do this, is there an existing tool which 
will identify all the `\include` files that a LilyPond file depends on?  Even 
better, one that will work in a recursive fashion?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: resetting accidentals at word breaks

2020-05-10 Thread Fr. Samuel Springuel
> On 30 Apr, 2020, at 4:24 AM, Lukas-Fabian Moser  wrote:
> 
> Hi Fr. Samuel,
> 
>> So far I’ve determined that the articulations property is a music-list, but 
>> I can’t seem to figure out how to look inside the music-list to see if it 
>> contains a HyphenEvent.  I tried using (member 'HyphenEvent ) 
>> (and memq and memv) to look at this, but this is always coming back false 
>> (i.e. not seeing the HyphenEvent).  Any hints from the scheme professionals?
> 
> Me not being a scheme professional by any means, nevertheless try:
> 
> #(define (hyphen? mus) (music-is-of-type? mus 'hyphen-event))
> #(define (lyric? mus) (music-is-of-type? mus 'lyric-event))
> 
> #(display (map
>(lambda (j) (if (lyric? j)
>(any hyphen? (ly:music-property j 
> 'articulations
>(ly:music-property words_one 'elements)))
> 

That got me over the hump and with some additional work, I’ve come up with the 
attached.  In addition to the combining lyrics function, this example also 
integrates the NullLyrics definition and the bar insertion engraver.  For 
testing purposes it inserts a visible bar, though when I actually use it I’ll 
change that to an empty bar.  Comments are welcome.


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


auto-empty-bar-between-words.ly
Description: Binary data


Re: Stanzas with different rhythms

2020-05-04 Thread Fr. Samuel Springuel
> On 4 May, 2020, at 3:20 PM, Fr. Samuel Springuel  
> wrote:
> 
> Now, I’m almost certain the answer is yes (at least in principle), but before 
> I start trying to write a music function that does [concatenates a variable 
> consisting of pairs of keys and music expressions into a single music 
> expression], I want to make sure that such a function doesn’t already exist.  
> If it doesn’t, I’d like to know from the scheme experts out there if there 
> are any technical reasons why such a function hasn’t been written, or if it’s 
> simply a case of no one’s thought of trying this before.
> 

Turns out that function is much simpler than I thought.  Attached is basic 
proof-of-concept.  Comments welcome.


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


null_voice.ly
Description: Binary data


Re: Stanzas with different rhythms

2020-05-04 Thread Fr. Samuel Springuel
> On 4 May, 2020, at 12:45 PM, David Wright  wrote:
> 
> Of course, you can break up the music into several variables
> from which you assemble the different versions, in order to
> localise the variation and make it easier to maintain.

So, attached is my first go at that sort of “assembly-required” structure.  
Originally I defined several music variables with “_a”, “_b”, etc. suffixes 
(preserved for alt_music).  However, I recalled from earlier list activity that 
one could also use “.1”, “.2”, etc. in variable names.  Now, as I understanding 
it, if I define music variables main_music.1, main_music.2, etc. then the 
underlying scheme creates a single variable main_music which is a list of 
pairs.  Each pair consists of the number as the first element (car) and the 
musical contents as the second element (cdr).  Now, I can just manually build 
up the whole main melody using { \main_music.1 \main_music.2 … } (as is 
currently done in the attached), but the scheme construction of it as a list 
got me thinking, is there a way to programmatically accomplish this 
concatenation?

Now, I’m almost certain the answer is yes (at least in principle), but before I 
start trying to write a music function that does this, I want to make sure that 
such a function doesn’t already exist.  If it doesn’t, I’d like to know from 
the scheme experts out there if there are any technical reasons why such a 
function hasn’t been written, or if it’s simply a case of no one’s thought of 
trying this before.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


null_voice.ly
Description: Binary data


Re: Stanzas with different rhythms

2020-05-04 Thread Fr. Samuel Springuel
> On 4 May, 2020, at 12:45 PM, David Wright  wrote:
> 
> Well, in a sense, you haven't managed to localise the complications
> because the lyrics are stuffed with redundant associatedVoices when
> reused elsewhere.

Very true.  Getting the separation I want is still very much a work in progress.

> Where the differences are this minor (same syllable count, and
> mixed music that's easily distiguished), I would put all the
> complication where it's unavoidable: in the notes.
> 
> From your example's "music" variable, I would derive two simple
> versions, musicA and musicIII, each for one rhythm. The words
> would contain no specific indications, but set with NullVoice
> to the appropriate music.
> 
> Of course, you can break up the music into several variables
> from which you assemble the different versions, in order to
> localise the variation and make it easier to maintain.

Now that’s an idea I hadn’t thought of.  I just got a basic edition-engraver 
example working (see attached), but I’ll try this method out too and see which 
I like better.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


lyrics-alternative.ly
Description: Binary data


Re: Stanzas with different rhythms

2020-05-04 Thread Fr. Samuel Springuel
> On 3 May, 2020, at 3:57 PM, Caio Barros  wrote:
> 
> Personally I tend to use explicit durations (no \lyricsto) in complex cases 
> like this, but a workaround would be simply:

I’m avoiding explicit durations in this project because each set of words can 
be set to multiple possible tunes.  These tunes may have the same meter (number 
of syllables per phrase) but not necessarily the same rhythm (indeed, at least 
one alternative is usually a chant setting while at least one is measured).  
Explicit durations would mean having separate copies of the same lyrics for 
each tune, something I’m trying to avoid.

Indeed, your workaround suffers from a similar problem, as that empty syllable 
isn’t needed in the other melody.

> I guess what is happening here is that when you switch to the previous voice 
> LilyPond will just align the next syllable to the next note in voice you 
> switched to, ignoring the duration of the previous syllable.

Hmm… If that’s true, then what I need is a way of timing the \unset command to 
happen 1/8 later for this melody.  Controlling when commands occur in time 
makes me think of the Edition Engraver, which I’ve always meant to come to 
terms with.  Perhaps this is the song which finally forces me down that route.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Stanzas with different rhythms

2020-05-03 Thread Fr. Samuel Springuel
I’m trying to apply the techniques for switching to an alternative melody for a 
stanza from here: 
http://lilypond.org/doc/v2.20/Documentation/notation/stanzas#stanzas-with-different-rhythms

So far the switch to the alternative melody is working alright, but the switch 
back is giving me trouble.  If I put the \unset command as indicated (one 
syllable before it is supposed to apply) then the words switch back to the main 
melody on the wrong note (one note too soon).  If I put the unset command 1 
syllable later, then the words disappear (presumably because they're sticking 
with the alternative melody which has run out of notes).  Have I misunderstood 
something about how this technique is supposed to work?

\version "2.20.0"
\language "english"

global = { \key f-sharp \minor \time 4/4 }

music = {
  f-sharp'4 e'8 f-sharp' << { \voiceOne a'4. a'8 } \new Voice = "v3" { 
\voiceTwo \teeny a'4_\markup{v.3} a' } >> \oneVoice |
  g-sharp'8( f-sharp') g-sharp' e' f-sharp'2 \bar "|."
}

verseII = \lyricmode {
Tak -- ing our way, you walked with us there.
}

verseIII = \lyricmode {
Gen -- tle \set associatedVoice = "v3" and strong
\set associatedVoice = "mel" %  words come back on wrong note: 1/8 too early
one,
%\set associatedVoice = "mel" % makes all subsequent words disappear
Lord of our way.
}

\new Staff
<<
\new Voice = "mel" { << \global \music >> }
\new Lyrics \lyricsto "mel" { \verseII }
\new Lyrics \lyricsto "mel" { \verseIII }
>>


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Break visibility for notes?

2020-05-02 Thread Fr. Samuel Springuel
> On 1 May, 2020, at 6:28 AM, Thomas Morley  wrote:
> 
> Below a hackish and probably fragile method to get the desired output anyway.
> Please test thoroughly before using it for serious work!

Well, after applying this version to my project, it doesn’t seem to break any 
scores.  So it appears to be robust enough for my purposes.  I will, of course, 
keep an eye on it as I continue to refine my house style for printing chant 
just in case there’s some interaction with one of the other things I’m working 
on.  Thanks for all your work Thomas!


Attached is version which shows how I make use of it.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


reveal-hidden-notes-at-new-line.ly
Description: Binary data


Re: Break visibility for notes?

2020-05-01 Thread Fr. Samuel Springuel
> On 1 May, 2020, at 6:28 AM, Thomas Morley  wrote:
> 
> sorry for coming back to this that late. Because of Corona the
> workload for my regular job exploded ...

Totally understandable.  I’ve got plenty of things to work on and am not on a 
deadline for this so I’m not concerned with the delay.

> Below a hackish and probably fragile method to get the desired output anyway.
> Please test thoroughly before using it for serious work!

So far I’ve found that there are a few more items that need to be effected, so 
the first change I’ve made is to add them to noteHeadBreakVisibility:

noteHeadBreakVisibility =
#(define-music-function (break-visibility)(vector?)
 "Makes notes transparent relying on @var{break-visibility}.
The list of objects to make transparent is taken from @code{hideNotes}."
 #{
 \override NoteHead.transparent = #(tranparent-at-line-position 
break-visibility)
 \override Dots.transparent = #(tranparent-at-line-position 
break-visibility)
 \override Accidental.transparent = #(tranparent-at-line-position 
break-visibility)
 \override Rest.transparent = #(tranparent-at-line-position 
break-visibility)
 %stems are always hidden in chant
 %we assume chants are not in a TabStaff and so don't need to hide 
TabNoteHeads
 %ledger lines have to be taken care of in the layout block using 
delete-ledgers-for-transparent-note-heads
 #})

This, of course, isn’t related to the fragility.  I’ll start testing for that 
tomorrow.
✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: resetting accidentals at word breaks

2020-04-29 Thread Fr. Samuel Springuel
> On 29 Apr, 2020, at 12:26 AM, David Wright  wrote:
> 
> That's probably all very similar to what you suggested above,
> but expressed in slightly different terms. It scales to many
> voices, and deals with missing syllables more simply.

It is very similar, but also relies on being able to construct the lists 
indicating the HyphenEvents for each set of syllables (as does mine), which is 
where I’m running into problems.

So far I’ve determined that the articulations property is a music-list, but I 
can’t seem to figure out how to look inside the music-list to see if it 
contains a HyphenEvent.  I tried using (member 'HyphenEvent ) (and 
memq and memv) to look at this, but this is always coming back false (i.e. not 
seeing the HyphenEvent).  Any hints from the scheme professionals?



✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


combine_lyrics.ly
Description: Binary data


Re: resetting accidentals at word breaks

2020-04-28 Thread Fr. Samuel Springuel
> On 28 Apr, 2020, at 3:47 PM, Fr. Samuel Springuel  
> wrote:
> 
>> On 25 Apr, 2020, at 2:02 PM, David Wright  wrote:
>> 
>> So you need a NullLyric which contains your "controlling" lyrics, but
>> which is not printed (and occupies no space).
> 
> My attempt to create such a context is attached.  Unfortunately, the 
> “occupies no space” thing still has me scratching my head.

After some more playing I came up with the following, which seems to work.  
Critiques welcome.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


null_lyrics.ly
Description: Binary data


Re: resetting accidentals at word breaks

2020-04-28 Thread Fr. Samuel Springuel
> On 25 Apr, 2020, at 2:02 PM, David Wright  wrote:
> 
> So you need a NullLyric which contains your "controlling" lyrics, but
> which is not printed (and occupies no space).

My attempt to create such a context is attached.  Unfortunately, the “occupies 
no space” thing still has me scratching my head.

> This lyric would have
> very long "words" whose syllables are all hyphenated together unless
> every real lyric line has a word break at that point. It could be
> hand-crafted in the first instance or, with more ingenuity,
> automatically constructed from the other lyrics. Good luck.

My lyrics are all entered in variables which look like: x = \lyricmode { some 
wordy -- words }

Using \displayMusic, I see these are make-music expressions with an elements 
list inside them containing 1 element per syllable.  If a hyphen follows a 
syllable, then the corresponding element of the list has a HyphenEvent in its 
articulations property.

So an algorithm for combining lyrics (lyrics_one and lyrics_two) would look 
like this:

1) Find the longer of lyrics_one and lyrics_two (referred to hereafter as 
lyrics_max, the other is lyrics_min)
2) loop over syllables (the elements list) in lyrics_max
2a) if concurrent syllable (element at same index) exists in lyrics_min 
(or more specifically the elements list in lyrics_min)
true) continue
false) break out of loop
2b) if current syllable of lyrics_max does has a HyphenEvent in its 
list of articulations
true) continue
false) if the concurrent syllable of other lyrics has a 
HyphenEvent in its list of articulations
true) add a HyphenEvent to list of articulations in 
current syllable of lyrics_max
false) continue
3) return lyrics_max

Does that sound like a reasonable algorithm for implementation in scheme?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


null_lyrics.ly
Description: Binary data


Re: Break visibility for notes?

2020-04-26 Thread Fr. Samuel Springuel
Okay, I’ve been applying this to my project and came across a problem with the 
version I posted earlier: ledger lines are visible for the invisible notes.  
Now, I’ve tried applying the line-position function to 
LedgerLineSpanner.transparent, but that doesn’t have any effect.  There is 
NoteHead.no-ledgers which, when set to true, does make the ledger lines 
disappear, but the line-position function complains about wrong argument type 
(not a grob) when I try to apply it.  How can I adapt things so that the ledger 
lines are invisible on the invisible notes?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


reveal-hidden-notes-at-new-line.ly
Description: Binary data


Re: Optional arguments for scheme functions

2020-04-26 Thread Fr. Samuel Springuel
> On 26 Apr, 2020, at 1:01 PM, David Kastrup  wrote:
> 
> Predicates used in argument parsing have to be "primary" in that they
> have to deliver a result for anything thrown at them.
> 

Can that be noted in the docs 
(http://lilypond.org/doc/v2.19/Documentation/extending/scheme-function-definitions)?
  For a scheme novice (like myself) that distinction isn’t expected as the docs 
just point to the full list of predicates 
(http://lilypond.org/doc/v2.19/Documentation/notation/predefined-type-predicates)
 without noting that only primary ones will work in this context.

Further, in that full list of predicates, the first two sections are clearly 
labeled as primary and secondary, but what about the other three?  Clearly 
index? and ly:music? are primary (since they work in this context) so I suspect 
that all LilyPond scheme predicates (where index? appears) and LilyPond 
exported predicates (where ly:music? appears) are primary, but it would be 
nicer if that was clearly stated.  Further, what about the Guile predicate?


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Optional arguments for scheme functions

2020-04-26 Thread Fr. Samuel Springuel
> On 26 Apr, 2020, at 4:30 AM, Thomas Morley  wrote:
> 
> I've no clue why positive? fails here.
> Though, for integers >= 0 we have the index? predicate, which works in
> your function.

Well, I’m glad I’m not the only one baffled.  And the index? predicate does 
seem to work.



> On 26 Apr, 2020, at 4:41 AM, Lukas-Fabian Moser  wrote:
> 
> Well, positive? does not seem to like being called with anything else than a 
> number:
> 
> (positive? "I'm a string")
> 
> fails as well.
> 
> I'm not sure as to why that is the case; but anyway, this shows that the 
> problem does not come from LilyPond.

Then is this something that should be reported up the chain somewhere?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Break visibility for notes?

2020-04-25 Thread Fr. Samuel Springuel
> On 23 Apr, 2020, at 3:42 PM, Thomas Morley  wrote:
> 
> Using Custos for it sounds very strange.

I don’t disagree.  I picked it because of the objects that obey 
break-visibility 
(http://lilypond.org/doc/v2.19/Documentation/notation/visibility-of-objects#using-break_002dvisibility)
 it was the one that made the most sense to use because it had a clear concept 
of what the first note on the line was.  Of course, my particular use was kind 
of backwards for what a Custos would be intended for.

> How about below? Coded after ideas by David Nalesnik, for now, only
> setting colors.

This makes much more sense and is easily adapted.  Attached is my version which 
is actually toggling note visibility as desired.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


reveal-hidden-notes-at-new-line.ly
Description: Binary data


Optional arguments for scheme functions

2020-04-25 Thread Fr. Samuel Springuel
I’m trying to write a music function in scheme in which the first argument is 
optional and have run into something that confuses me:

The following works:

\version "2.19.84"

recite = #(define-music-function (times note) ((integer? 1) ly:music?)
   #{ \repeat unfold #times { #note }
   #})

\new Staff {
\new Voice { g' \recite g' g' }
}

However, when I swap integer? for positive? (to reflect the fact that only a 
positive integer should be acceptable) it breaks, telling me the argument at 
position 1 is of the wrong type (it’s music, not a positive number).  Why 
doesn’t scheme’s handling of optional arguments work when using the positive? 
predicate?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Scaled durations in scheme

2020-04-25 Thread Fr. Samuel Springuel
Nevermind, I figured it out:

\version "2.19.84"

recite-note = #(define-music-function (note) (ly:music?)
   (define dur 1)
(withMusicProperty 'duration (ly:make-duration dur 0 (/ (expt 2 
dur) 4)) note))

\new Staff {
\new Voice { g' \recite-note g' g' }
}

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Scaled durations in scheme

2020-04-25 Thread Fr. Samuel Springuel
Within a scheme music function, how can I tie the value of the third argument 
of ly:make-duration to the value of the first argument so that the note takes 
up the space of a 1/4 note?  I’m trying to set things up so that I only have to 
change one thing to change the appearance of the note without changing the 
spacing.  For instance, the MWE below uses half-notes.  If I wanted to change 
to whole notes, I currently have to change both the first and third argument.  
I’d like to set things up so that only one thing has to be changed for easier 
maintenance.  The way I figure I need to define a scheme variable and use that 
in some sort of transformation, but converting from an integer for the first 
argument to the fraction expected for the third (or vice versa) has me baffled.

\version "2.19.84"

recite-note = #(define-music-function (note) (ly:music?)
(withMusicProperty 'duration (ly:make-duration 1 0 1/2) note))

\new Staff {
\new Voice { g' \recite-note g' g' }
}



✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: resetting accidentals at word breaks

2020-04-25 Thread Fr. Samuel Springuel
> On 25 Apr, 2020, at 11:44 AM, Fr. Samuel Springuel  
> wrote:
> 
>> On 23 Apr, 2020, at 4:23 PM, Aaron Hill  wrote:
>> 
>> Ooh, I didn't think of that.  Since \bar just sets the whichBar property, it 
>> is a case of whichever \bar command is last that wins.  So the code just 
>> needs to have a variation that checks whether whichBar is already set and 
>> only change it if unset:
> 
> This works nicely.  Thanks for making the change.
> 

Whoops.  May have spoken too soon as I found another complication.  When there 
are multiple verses (each of which has this engraver attached) then a word 
boundary in any of the verses inserts the bar (and allows line breaking), 
possibly splitting multi-syllable words in other verses.  I can live with it 
(possibly by setting one lyrics as the “controlling” context and leaving the 
engraver out of the others), but  is there a way to make things so that the 
various Lyrics contexts talk to each other and only insert the bar if there’s a 
word boundary in all contexts?

In the following example, the fourth, fifth, and sixth lines have the 
multi-syllable word in the second lyrics split.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


auto-empty-bar-between-words.ly
Description: Binary data


Re: resetting accidentals at word breaks

2020-04-25 Thread Fr. Samuel Springuel
> On 23 Apr, 2020, at 4:23 PM, Aaron Hill  wrote:
> 
> Ooh, I didn't think of that.  Since \bar just sets the whichBar property, it 
> is a case of whichever \bar command is last that wins.  So the code just 
> needs to have a variation that checks whether whichBar is already set and 
> only change it if unset:

This works nicely.  Thanks for making the change.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Break visibility for notes?

2020-04-23 Thread Fr. Samuel Springuel
> On 22 Apr, 2020, at 4:34 PM, Fr. Samuel Springuel  
> wrote:
> 
> Is there a way to specify that a note should only appear if it’s the first 
> note on the line?  I tried using the break-visibility property but this 
> doesn’t seem to be working (the notes simply disappear entirely.
> 
> \version "2.19.84"
> 
> mystart = \override Voice.NoteHead.break-visibility = #begin-of-line-visible
> 
> myend = \revert Voice.NoteHead.break-visibility
> 
> music = { \repeat unfold 20 { c' } \mystart g' g' g' g' g' g' g' g' \myend 
> \repeat unfold 20 { c' } }
> 
> \new Staff {
>\new Voice = "mel" { \music }
> }
> 

So, I figured out a way to do this using the Custos_engraver.  My slightly more 
than MWE is attached below.  Comments on this strategy are welcome.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


reveal-hidden-notes-at-new-line.ly
Description: Binary data


Re: resetting accidentals at word breaks

2020-04-23 Thread Fr. Samuel Springuel
> On 14 Apr, 2020, at 3:02 PM, Aaron Hill  wrote:
> 
> On 2020-04-14 9:14 am, Benjamin Bloomfield wrote:
>> However, I am still trying to figure out how engravers and contexts work to
>> be able to know exactly what's going on.
>> Thanks for any help or ideas,
> 
> Here is my take that works from events not grobs, plus it allows flexibility 
> in what you want to do between words:
> 
> 
> \version "2.20.0"
> 
> modifyContextPropertyWhereDefined =
> #(define-scheme-function
>  (prop value-or-proc) (symbol? scheme?)
>  (lambda (context)
>(ly:context-set-property!
>  (ly:context-property-where-defined context prop)
>  prop
>  (if (procedure? value-or-proc)
>(value-or-proc (ly:context-property context prop))
>value-or-proc
> 
> incrementBarNumber =
>  \modifyContextPropertyWhereDefined
>  internalBarNumber #1+
> 
> insertBar =
>  \modifyContextPropertyWhereDefined
>  whichBar \etc
> 
> betweenLyrics = #(define-scheme-function
>  (proc) (procedure?)
>  (lambda (context)
>(let ((first-lyric? #t) (hyphen? #f))
>  (make-engraver
>(listeners
>  ((hyphen-event engraver event) (set! hyphen? #t))
>  ((lyric-event engraver event)
>   (if first-lyric?
> (set! first-lyric? #f)
> (if (not hyphen?) (proc context)))
>   (set! hyphen? #f)))
> 
> doBoth = #(define-scheme-function
>  (proc1 proc2) (procedure? procedure?)
>  (lambda args (apply proc1 args) (apply proc2 args)))
> 
> repetitions = #3
> notes = \repeat unfold \repetitions {
>  fis'4 4 4 4 4 4 4( 4) 4( 4 4) 4 4 }
> words = \repeat unfold \repetitions \lyricmode {
>  a b -- b c -- c -- c d e -- e f }
> 
> << \new Staff { \cadenzaOn \new Voice = melody \notes }
>   \new Lyrics \with {
>\consists \betweenLyrics \incrementBarNumber
>   } \lyricsto melody \words >>
> 
> << \new Staff { \cadenzaOn \new Voice = melody \notes }
>   \new Lyrics \with {
>\consists \betweenLyrics \insertBar "'"
>   } \lyricsto melody \words >>
> 
> << \new Staff { \cadenzaOn \new Voice = melody \notes }
>   \new Lyrics \with {
>\consists \betweenLyrics \doBoth \insertBar "" \incrementBarNumber
>   } \lyricsto melody \words >>
> 
> 
> 
> -- Aaron Hill

This look useful for me too, but I’m running into some difficulty when trying 
to insert regular bars.  It seems the bar inserted by the betweenLyrics 
engraver is always used between words, even if the music specifies a different 
bar.  Is there some way to adapt around that so that explicitly \bar commands 
take precedence?


auto-empty-bar-between-words.ly
Description: Binary data


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ



Re: Default accidental style with timing off

2020-04-23 Thread Fr. Samuel Springuel
> On 22 Apr, 2020, at 6:09 PM, Aaron Hill  wrote:
> 
> A pattern I could recommend is defining a named procedure as opposed to using 
> a lambda with \applyContext:
> 
> 
>  foo = #(define-music-function () ()
>(define (proc context)
>  (do-something-here))
>#{ \applyContext #proc #})
> 
> 
> This keeps potentially complex S-expressions outside LilyPond syntax, which 
> should improve readability.

Thanks, that does look much nicer.

> Apart from that, I would suggest simplifying your variable names.  There is 
> no need to call something "mything" when "thing" would suffice.  Remember 
> that bindings have scope; and local bindings trump.  You only need unique 
> names if you must have access to both variables.
> 
> That said, I would prefer "my-thing" over "mything".  You have to be careful 
> with smooshing words together lest they read poorly.  "curnum" is not ideal 
> as it looks like it could be a word in Latin.  "currnum" is slightly better, 
> but "curr-num" would be the preference if abbreviation is required.
> 
> Mind you, I would sidestep all that by calling it "bar-number":
> 
> 
>  (let* ((score (ly:context-find context 'Score))
> (bar-number (ly:context-property score 'internalBarNumber)))
>(ly:context-set-property! score 'internalBarNumber (1+ bar-number)))
> 
> 

Good point.  I have to admit that I wasn’t paying much attention to the 
variable names.  As I was combining things from various sources I just ported 
over the existing naming conventions without really thinking about how 
unreadable they actually were.  Cleaning up the variable names, along with the 
above change make this much easier to read and like I might have a chance of 
understanding scheme more generally.


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Break visibility for notes?

2020-04-22 Thread Fr. Samuel Springuel
Is there a way to specify that a note should only appear if it’s the first note 
on the line?  I tried using the break-visibility property but this doesn’t seem 
to be working (the notes simply disappear entirely.

\version "2.19.84"

mystart = \override Voice.NoteHead.break-visibility = #begin-of-line-visible

myend = \revert Voice.NoteHead.break-visibility

music = { \repeat unfold 20 { c' } \mystart g' g' g' g' g' g' g' g' \myend 
\repeat unfold 20 { c' } }

\new Staff {
\new Voice = "mel" { \music }
}

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Re: Default accidental style with timing off

2020-04-22 Thread Fr. Samuel Springuel
After some more work I came up with the attached redefinition of the bar which 
does what I originally asked for.  I’d appreciate any scheme experts critique 
on what I have as I’m not entirely comfortable with the way I’m switching in 
and out of scheme.  It works, I’m just not sure it’s “proper.”

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


accidental_style.ly
Description: Binary data


Re: Default accidental style with timing off

2020-04-06 Thread Fr. Samuel Springuel
I’ve been playing with this further and have come up with the attached.  Now, 
can someone tell me how I might combine \test and \bar into a redefined \bar 
(so that I don’t have to have both \test and \bar in all bar locations)?  My 
naive expectation would have been `bar = \test \bar \etc` but this raises and 
“unexpected \etc” error.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


accidental_style.ly
Description: Binary data


Re: Default accidental style with timing off

2020-03-27 Thread Fr. Samuel Springuel
> On 26 Mar, 2020, at 7:50 PM, Mark Stephen Mrotek  wrote:
> 
> Fr. Samuel.
> 
> 1) The bar instructions are in printer's (curly) double quotes.

Sorry about that, my email client must have mangled them as they aren’t that 
way in the original document.  I’ve attached the original below.

> 2) The timing = ##f may be incorrectly written/located. See: 
> http://lilypond.org/doc/v2.19/Documentation/learning/gregorian-transcription-template.

That line is equivalent to the \set Score.timing = ##f in that template, just 
relocated to a context definition so as to facilitate putting all the settings 
in one place.  I don’t like that template because of how it scatters the 
settings in three places (a layout block which redefines several context 
defaults, the \include statement, and the aforementioned \set statement) and so 
I’m writing my own.  My intention is to have a single include file that will 
apply *all* the necessary changes when used.  I’m also trying to eliminate the 
\divisio… concept of gregorian.ly and instead using the more usual \bar 
mechanism.

I’ll point out, however that the indicated template has the same problems with 
accidentals.


✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


accidental_style.ly
Description: Binary data


MacPorts stable version lacks mactex variant

2020-03-26 Thread Fr. Samuel Springuel
The lilypond port for MacPorts (i.e. the stable version) doesn’t have a mactex 
variant like lilypond-devel and thus will end up installing several the 
MacPorts texlive packages which are redundant on systems which already have 
MacTex installed.  Should I be reporting this to the MacPorts bug tracker?

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ




Default accidental style with timing off

2020-03-26 Thread Fr. Samuel Springuel
When constructing scores where the timing is turned off, how do I get 
accidentals to behave with respect to the manually inserted bar lines?  I’m 
just looking for the default accidental style (accidentals “last” until a bar 
line), it’s just that all bar lines are inserted manually using \bar.

 MWE

\version "2.19.84"

\layout {
\context {
\Score
timing = ##f
}
}

music = {
f' fes' \bar “|” % flat on second note
fes' fes' \bar “|” % should be flat on first note, nothing on second
fes' f' \bar “|” % should be flat on first note, natural on second
f' fes' \bar “|” % flat on second note
f' fes' \bar “|” % should be nothing on first note, flat on second
}

\new Staff { \music }

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ