Re: 2nd stanza lyrics cont.

2021-04-21 Thread Aaron Hill

On 2021-04-21 10:49 am, Stephane Krims wrote:

Thank you Remy and Valentin for your replies 🙂

Unfortunately i still can't figure this out.
I tried separating each stanza into different variables, like so:


altoWordsOne = \lyricmode {
\set stanza = "1. "
% first verse and chorus
}
altoWordsTwo = \lyricmode {
\set stanza = "2. "
% second verse
}
altoWordsThree = \lyricmode {
\set stanza = "3."
% third verse
}

...and then squeezing it in here, like so:

\new Lyrics = "bass"
\context Lyrics = "tenor" \lyricsto "tenor" \sopWords
\context Lyrics = "lead" \lyricsto "lead" \altoWordsOne
\context Lyrics = "lead" \lyricsto "lead" \altoWordsTwo
\context Lyrics = "lead" \lyricsto "lead" \altoWordsThree
\context Lyrics = "baritone" \lyricsto "baritone" \tenorWords
\context Lyrics = "bass" \lyricsto "bass" \bassWords


You need to instantiate individual Lyrics contexts for each line of 
text.  Consider:



\version "2.22.0"

affinityDown = \with { \override VerticalAxisGroup.staff-affinity = 
#DOWN }


<< \new Lyrics = aboveI \with \affinityDown
   \new Lyrics = aboveII \with \affinityDown
   \new Staff \voices upper,lower
 << { \voiceOne b'8 c'' d''2. } \\
{ \voiceTwo g'4 fis' g'2 } >>
   \new Lyrics = belowI
   \new Lyrics = belowII

   \context Lyrics = aboveI \lyricsto upper { Up -- per one }
   \context Lyrics = aboveII \lyricsto upper { Up -- per two }
   \context Lyrics = belowI \lyricsto lower { Low -- er one }
   \context Lyrics = belowII \lyricsto lower { Low -- er two } >>


\new Lyrics is used four times because we need four distinct Lyrics 
lines (two stanzas each for two voices).



-- Aaron Hill



Re: combining chords in chords

2021-04-22 Thread Aaron Hill

On 2021-04-22 6:01 am, Gianmaria Lari wrote:

I have some variables, each containing one chord as in the following
example:

[...]

How can I solve this?


Here's a way that involves merging the elements of the two EventChords:


\version "2.22.0"

ja = 8
jb = 8
jc = 8

mergeChords =
#(begin
  (define (event-chord-music? arg)
   (music-type-predicate 'event-chord))
  (define-music-function
   (first second)
   (event-chord-music? event-chord-music?)
   (set! first (ly:music-deep-copy first))
   (ly:music-set-property! first 'elements
(append
 (ly:music-property first 'elements)
 (ly:music-property second 'elements)))
   first))

ka = \mergeChords \ja \jb
kb = \mergeChords \ja \jc
kc = \mergeChords \jb \jc

\new Voice \fixed c' { \ka[ \kb \kc] }


Could be some hidden quirks with this approach, but it does seem to 
allow the manual beaming to work.



-- Aaron Hill



Re: "compound music expression" to "music" expression"

2021-04-23 Thread Aaron Hill

On 2021-04-23 1:58 am, Jean Abou Samra wrote:

If you have it at hand in Scheme:

\version "2.23.

#(define (first-element music)
   (first (ly:music-property music 'elements)))

{ #(first-element #{ { c'1 } #}) }

It would be helpful to understand your use
case; this sounds like you may not necessarily
need to unpack a sequential music expression.


In my usual fashion, here's an over-engineered option showing off some 
of the built-in functions in an easily extensible pattern:



\version "2.22.0"

extract =
#(define-music-function
  (which what music)
  (symbol? symbol? ly:music?)
  (let ((extracted (extract-typed-music music what)))
   (case which
((first) (first extracted))
((last) (last extracted))
((all all-as-sequence) (make-sequential-music extracted))
((all-as-chord) (make-event-chord extracted))
(else (ly:input-warning (*location*)
   "\\extract does not understand '~s'" which)
  music

foo = { c  }

\fixed c' {
  \extract first event-chord \foo
  \extract last note-event \foo
  \extract all note-event \foo
  \extract all-as-chord note-event \foo
}


-- Aaron Hill

Re: "compound music expression" to "music" expression"

2021-04-24 Thread Aaron Hill

On 2021-04-23 11:32 pm, David Kastrup wrote:

Gianmaria Lari  writes:


Thank you Aaron and Jean, your code works!

But I have some trivial questions.
If I write:

\displayLilyMusic \chordmode {c}


I get:

{ < c' e' g' >4 }


It looks a good "compound music expression".


Try \displayMusic rather than \displayLilyMusic for more details.


In case David's hint was not sufficient, there is an additional layer of 
complexity when using \chordmode.  Unfortunately, that layer is not 
visible when using \displayLilyMusic, and this is where the confusion 
arises.


\chordmode produces UnrelativableMusic that contains SequentialMusic and 
then EventChords of NoteEvents.


Jean's first-element assumes that the music argument has a property 
called elements and resolves to the first value within the collection.  
UnrelativableMusic only has an element property, so first-element gets 
stuck.  Here is a modified version of first-element that does not:



#(define (first-element music)
  (or (ly:music-property music 'element #f)
  (first (ly:music-property music 'elements

% This works, but you get a SequentialMusic.
{ #(first-element #{ \chordmode {c} #}) }

% This grabs the EventChord from the SequentialMusic.
{ #(first-element (first-element #{ \chordmode {c} #})) }


My \extract uses the built-in extract-typed-music procedure to do the 
heavy lifting, including the logic necessary to traverse nested music 
expressions with both element and elements properties.



-- Aaron Hill



Re: Markup in a variable

2021-04-28 Thread Aaron Hill

On 2021-04-28 10:43 pm, Mark Probert wrote:

Hi, all.

I'm getting myself confused. I have an include file -- foo.ily -- and I
want to define different instrument names for later use, like

 altoSax = { \markup { \fontsize #-2 {
  Alto Saxophone \concat { E { \raise #0.5 \teeny \flat }
 tenorSax = { \markup { \fontsize #-2 {
  Tenor Saxophone \concat { B { \raise #0.5 \teeny \flat }

but when I do this I get an error "markup outside of text script or
\lyricmode."

What is the correct way to do this kind of thing?


You have an extra pair of braces around your \markup.  Consider:


\version "2.22.0"

foo = \markup { lorem ipsum }

\markup \bold \foo
\new Staff \with { instrumentName = \foo }
{ g'^\markup \italic \foo }



-- Aaron Hill



Re: repeatTie question

2021-04-29 Thread Aaron Hill

On 2021-04-29 4:14 pm, Mark Probert wrote:

Hi.

When I compile the following, the tie within the first time bar ends on
the wrong side of the D. Using a tilde (~) instead of \repeatTie
results in an error. Can someone please point me in the right 
direction?


TIA
 .. mark.

--[start]--
\version "2.22"

tune = \relative c'' {
  \clef treble

  \partial 8 d8~
  \repeat volta 2 { d1 | }
  \alternative {
{ r2 r4 r8 d8\repeatTie | }
{ c1 }
  }
}
\score {
  <<
\new Staff \tune
  >>
}
--[end]--


Did you mean to use \laissezVibrer?


-- Aaron Hill



Re: Pitch value of previous note

2021-04-30 Thread Aaron Hill

On 2021-04-30 3:39 am, David Sumbler wrote:

I want to be able to insert a note of the same pitch as the preceding
one.  I don't mind what form the pitch information is in, so long as I
can use it to create a new note.  It could, for example, be in the form
"b,,", or something similar to "(-2, 6)" as used by ly:make-pitch.
 There may be other possibilities.


What about the existing pitch-repeating functionality in LilyPond?


\version "2.22.0"

foo = { 4 4 }
{ b'2 \foo g' \foo }


A duration without pitch is encoded as a NoteEvent with the pitch 
property.  expand-repeat-notes! is the internal procedure that carries 
over the most recent pitch.  So long as you insert these events early 
enough, LilyPond should do the heavy lifting for you.



-- Aaron Hill



Re: Pitch value of previous note

2021-04-30 Thread Aaron Hill

On 2021-04-30 4:17 am, Aaron Hill wrote:

On 2021-04-30 3:39 am, David Sumbler wrote:

I want to be able to insert a note of the same pitch as the preceding
one.  I don't mind what form the pitch information is in, so long as I
can use it to create a new note.  It could, for example, be in the 
form

"b,,", or something similar to "(-2, 6)" as used by ly:make-pitch.
 There may be other possibilities.


What about the existing pitch-repeating functionality in LilyPond?


\version "2.22.0"

foo = { 4 4 }
{ b'2 \foo g' \foo }


A duration without pitch is encoded as a NoteEvent with the pitch
property.  expand-repeat-notes! is the internal procedure that carries
over the most recent pitch.  So long as you insert these events early
enough, LilyPond should do the heavy lifting for you.


Sorry, that was meant to say: "*without* the pitch property".


-- Aaron Hill



Re: align system to the right

2021-05-01 Thread Aaron Hill

On 2021-05-01 7:15 am, Kieren MacMillan wrote:

Hi Davi,

I am working on this Aperghis score to use as an example of my Abjad 
library. I wanna have every system aligned to the right.

I have in my layout block "ragged-right = ##t".
I am looking for something like the inverse, ragged-left...
How could I do that?
P.S.: I don't wanna use skips.


Can each line be a separate score?
If so, put each in a \markup, and then right-align all the markups.


\score-lines will take a single score and return a markup list, with 
each line in the score as its own markup.



-- Aaron Hill



Re: repeat barline after fine double-barline

2021-05-01 Thread Aaron Hill

On 2021-05-01 5:56 pm, Ahanu Banerjee wrote:

Here you go:

\version "2.20.0"
{ \defineBarLine "xyz" #'("|." ".|:" "")
  \repeat unfold 7 c'
  c'-\tweak X-offset #5 _\markup \bold \italic "Fine"
  \bar "xyz" \break
  \repeat unfold 7 c' c'_\markup \bold \italic "D.C. al Fine"
  \bar ":|." }


To follow convention, you could name the custom bar ".|:-|.".

Also, you probably want to specify the spanning type as well:


\defineBarLine ".|:-|." #'("|." ".|:" ".|")


That makes it more closely match the existing ".|:-||" as defined in 
bar-line.scm:



(define-bar-line ".|:-||" "||" ".|:" ".|")



-- Aaron Hill



Re: Piano: partial pedalling

2021-05-10 Thread Aaron Hill

On 2021-05-10 11:38 am, Dijkhuizen, J.F. van wrote:

Dear All,

I was wondering if anybody knows if it's possible to notate partial
sustain pedalling in LilyPond (essentially 1/4. half-pedal, 3/4
pedal), and if so how.

There seems to be nothing about it in the manual, and I've not been
able to find anything online that I am able to use. Ideally, I'd like
to be able to notate pedal level changes by means of a line, as is
possible in Dorico, for example:

However, just being able to specify '1/2' at the beginning of a pedal
line, and, for example, 'release pedal slowly' at tthe end of a pedal
line, would be great too.

 Any help with this would be really appreciated!


There are a few ad hoc solutions if you search the archives.  You can 
see if my hack [1] to the PianoPedalBracket stencil a few years ago 
would be of any use.


[1]: 
https://lists.gnu.org/archive/html/lilypond-user/2019-01/msg00522.html



-- Aaron Hill



Re: Piano: partial pedalling

2021-05-10 Thread Aaron Hill

(Please make sure to keep the mailing list on all messages.)

On 2021-05-10 1:42 pm, Dijkhuizen, J.F. van wrote:

Many thanks for this. When I paste the code into Frescobaldi and
compile it, I'm getting the following error message:

error: syntax error, unexpected end of input
{ s4 s4*6\gradualSustain #'((0 2 2 0)(0.3)(0.4 0 5 -3 3)) s4\sustainOff

Do you know what went wrong?


Well, there's a missing closing brace in what you quoted above.  But 
most likely you are hitting an issue where the >> is missing when you 
copy/paste from the lists.gnu.org archive site.  See this version hosted 
on lilybin [1].


[1]: http://lilybin.com/kq9t97/1

-- Aaron Hill



Re: Tempo marking with 2 notes

2021-05-10 Thread Aaron Hill

On 2021-05-10 6:41 pm, Ahanu Banerjee wrote:

Hello,

Can anyone provide a simple way to make a tempo marking like this: "♩= 
đť…ž "

?


You should be able to adapt LSR 574 [1] to achieve that.

[1]: https://lsr.di.unimi.it/LSR/Item?id=574


-- Aaron Hill



Re: Horizontal beam parallel to staff

2021-05-10 Thread Aaron Hill

On 2021-05-10 9:10 pm, Pierre Perol-Schneider wrote:

Hi Ahanu,
How about:

\version "2.20.0"
{
  %\override Beam.damping = #5
  \override Beam.positions = #'(5 . 5)
  g''8 b b c'' c'' b b g''
}


And for an automated approach:


\version "2.22.0"

#(define NEAR -1)
#(define FAR 1)
flattenPositions =
#(define-scheme-function
  (rel-pos) (number?)
  (grob-transformer 'positions
   (lambda (grob orig)
(let* ((dir (ly:grob-property grob 'direction))
   (ys (ordered-cons (car orig) (cdr orig)))
   (y (interval-index ys (* dir rel-pos
 (cons y y)

{
  \override Beam.positions = \flattenPositions #NEAR
  g''8 b b c'' a' b'' b'' d'
  \override Beam.positions = \flattenPositions #CENTER
  g''8 b b c'' a' b'' b'' d'
  \override Beam.positions = \flattenPositions #(* 2 FAR)
  g''8 b b c'' a' b'' b'' d'
}



-- Aaron Hill



Re: Rehearsal mark and fermata over bar line

2021-05-11 Thread Aaron Hill

On 2021-05-11 10:03 am, Rachel Green wrote:

Hi,
How can I add two marks over a bar line - both a fermata and a
rehearsal mark? I figured out how to do each separately, but LilyPond
will only show one of them.
Best,
Rachel

\version "2.20.0"

\relative c
  {
  \time 4/4
  \clef C
  c1
\mark \default
\mark \markup { \musicglyph #"scripts.ufermata"}
  r4 r4
}


LSR 202 [1] demonstrates how to include a segno/coda sign as part of a 
single RehearsalMark.


LSR 575 [2] uses a hidden measure to make it appear that you have two 
RehearsalMarks at the same point in the music.


LSR 976 [3] implements its own custom engraver to support an arbitrary 
number of RehearsalMarks.



[1]: https://lsr.di.unimi.it/LSR/Item?id=202
[2]: https://lsr.di.unimi.it/LSR/Item?id=575
[3]: https://lsr.di.unimi.it/LSR/Item?id=976



-- Aaron Hill



Re: setting partCombine text at a higher level

2021-05-11 Thread Aaron Hill

On 2021-05-11 5:44 pm, Paul Scott wrote:

Greetings,

Can the variables? soloText and its companions soloIIText, etc. be set
at a higher level than \new Staff so it doesn't have to be repeated
for each staff?  (Notation Manual 1.5.2)


You can do it more globally in a \layout block if you want it to apply 
to all staves.  Otherwise, put the variable definitions in a \with block 
that can be referenced on individual staves.



\version "2.22.0"

\layout {
 \context {
  \Staff
  soloText = girl
  soloIIText = boy
  aDueText = together
 }
}

combineTexts = \with {
  soloText = cat
  soloIIText = dog
}

\new Staff <<
  \partCombine
  \relative c'' { g4 g r r a2 g }
  \relative c'' { r4 r a( b) a2 g } >>

\new Staff \with \combineTexts <<
  \partCombine
  \relative c'' { g4 g r r a2 g }
  \relative c'' { r4 r a( b) a2 g } >>



-- Aaron Hill



Re: Changing volta number text

2021-05-14 Thread Aaron Hill

On 2021-05-14 2:47 pm, Ralph Palmer wrote:

I *did* find a thread in the archive :
change of volta number
which has gotten me close, but has an extra end-repeat before the first
volta ending bracket. I'm also not sure the format is the most recent.


How about this?


\version "2.22.0"
\include "english.ly"

changeVoltaText =
#(define-music-function
  (text) (markup?)
  (define (is-volta-text? cmd)
   (and (pair? cmd) (eq? 'volta (car cmd)) (markup? (cadr cmd
  (define (replace-volta-text cmd)
   (if (is-volta-text? cmd) `(volta ,text) cmd))
  (define (proc ctxt)
   (let ((cmds (ly:context-property ctxt 'repeatCommands)))
(set! cmds (map replace-volta-text cmds))
(ly:context-set-property! ctxt 'repeatCommands cmds)))
  #{ \context Score \applyContext #proc #} )

test = {
  \time 3/4
  \repeat volta 3
  {
a'4 b' c' |
b'4 c' d' |
  }
  \alternative {
{
  \changeVoltaText "1., 3."
  e'4 f' g' |
}
{
  d'4 c' b' |
}
{
  \changeVoltaText \markup \with-color #red "4."
  g'4 a' b' |
}
  }
  c'1
}

\score {
  \test
}


NOTE: I'm using \markup in the final alternative just to demonstrate 
that it works.



-- Aaron Hill



Re: Changing volta number text

2021-05-14 Thread Aaron Hill

On 2021-05-14 6:40 pm, Ralph Palmer wrote:
Excellent! Thank you, Aaron. I wish I could understand what your 
function

does - how it works.


The technique involves querying the current Score.repeatCommands and 
replacing any existing (volta "...") command with the user-provided 
version.  This preserves the other repeat commands such as (end-repeat) 
and (volta #f).


Here is a minorly-refactored version with some documentation, comments, 
and a helpful usage warning:



\version "2.22.0"
\include "english.ly"

changeVoltaText =
#(define-music-function
  (text) (markup?)
  (_i "Replaces the volta text within the currently-set 
@code{repeatCommands}.")


  (define (volta-text? cmd)
   ;; Look for the (volta "...") pattern.
   (and (pair? cmd)
(eq? 'volta (car cmd))
(markup? (cadr cmd
  (define (replacer cmd)
   (if (volta-text? cmd) `(volta ,text) cmd))
  (define (proc ctxt)
   (let ((cmds (ly:context-property ctxt 'repeatCommands '(
(if (any volta-text? cmds)
 (ly:context-set-property! ctxt 'repeatCommands (map replacer cmds))
 (ly:input-warning (*location*) "No volta text was replaced."

  #{ \context Score \applyContext #proc #})

test = {
  \time 3/4
  \repeat volta 3
  {
a'4 b' c' |
\changeVoltaText "dud"
#(ly:expect-warning "No volta text was replaced.")
b'4 c' d' |
  }
  \alternative {
{
  \changeVoltaText "1., 3."
  e'4 f' g' |
}
    {
  d'4 c' b' |
}
{
  \changeVoltaText \markup \with-color #red "4."
  g'4 a' b' |
}
  }
  c'1
}

\score {
  \test
}




-- Aaron Hill



Re: Lyrics and Repeats

2021-05-15 Thread Aaron Hill

On 2021-05-15 9:07 pm, Kaj Persson wrote:

[...]


\addlyrics and \lyricsto are related constructs that both create 
LyricCombineMusic.  This is what allows you to enter lyric syllables 
without specifying durations, where the durations are inferred by an 
associated Voice.  Note that in this special mode and only this mode, 
\skip durations are ignored.  So it is the count of \skips that matter.


When you are entering lyrics outside LyricCombineMusic, you must specify 
durations manually lest they be assumed given the most recently 
specified duration.  In this case, \skip carries its normal meaning 
where the duration matters.


It should be noted that \setting associatedVoice has no effect outside 
of LyricCombineMusic.


Here is an example demonstrating the difference between using \lyricsto 
and manual durations:



\version "2.22.0"

lyricSkip =
#(define-music-function
  (count) (integer?)
  "Inserts the specified number of lyric skips."
  #{ \repeat unfold #count \skip 1 #})

<<
  \new Voice = melody {
\time 3/4
\partial 4 g'8 8
\repeat volta 2 { 2 4 }
\alternative {
  { 2 4 | 2 8 8 }
  { 4 2 }
}
2. \bar "|."
  }
  \new Lyrics \lyricsto melody {
\set stanza = "lyricsto"
a b | c d | e f | g h i
  }
  \new Lyrics \lyricsto melody {
\lyricSkip 2 | j k \lyricSkip 5 | l m | n
  }
  \new Lyrics \lyricmode {
\set stanza = "manual"
a8 b | c2 d4 | e2 f4 | g2 h8 i
  }
  \new Lyrics \lyricmode {
    \skip 4 | j2 k4 \skip 2.*2 | l4 m2 | n2.
  } >>



-- Aaron Hill

Re: Handling transpositions gracefully

2021-05-17 Thread Aaron Hill

On 2021-05-17 5:43 pm, Mark Probert wrote:

Hi.

I'm not quite sure how to ask this, so please bear with me. Right now
I'm having fun doing jazz lead sheets (for which lilypond is a
fantastic tool--lilyjazz is fantastic! thank you!). What I find I'm
doing is creating a "concert" version, then making a bes version, then
a ees version (I play alto sax and cornet). Basically all the same
source except with a \transpose wrapper around the score.

Is there a recommended way of having a single source and then
triggering the multiple variant outputs? Or do I simply put the stuff
that remains constant an include and have three separate shells for the
different tranpositions?

Any thoughts? (I imagine this is a solved problem...)


You could use multiple \books along with \bookOutputSuffix:


\version "2.22.0"

asdf = \relative f' {
 \time 3/4 \key f \major
 f4. c'8 g4 | a2. \bar "|."
}

\book { \bookOutputSuffix "C" \transpose c c \asdf }
\book { \bookOutputSuffix "Bb" \transpose bes, c \asdf }
\book { \bookOutputSuffix "Eb" \transpose ees c \asdf }


(I might have messed up the actual transpositions, but you should get 
the idea.)



-- Aaron Hill



Re: Lyrics and Repeats

2021-05-18 Thread Aaron Hill

On 2021-05-18 6:21 am, Kaj Persson wrote:

So I have looked at the alternative method, suggested in Notification
Reference, to divide the piece, the voices in parts with one boundary
at at the \repeat. In my current case the repeat point also is where
the number of choral parts change, before that they have common words,
so the method with double angle brackets in the lyrics should be
applicable and suitable  But unfortunately I have not succeeded in
this work, and this was what I tried to present in my first post.
However I do not think the solution I presented is fully correct, but
it was a try. I also had come across the case when a second \lyricsto
introduced an extra \skip. With this post I include a special
presentation of that.

But back to the original task, probably it is impossible to solve it
in the present version of LilyPond. My wish is that with the "<< >>"
method you can forget all counting syllables in the first part of the
piece.


I do not have time to dig in much further, but I think there is an issue 
with using \lyricsto when you are already within it.  Note below that we 
only use \lyricsto once and do not mess about with associatedVoice 
either:



\version "2.22.0"

notes = \new Voice = melody \repeat unfold 8 { b'4 }
words = \new Lyrics \lyricsto melody {
  a a
  << { b b } \new Lyrics { c c d d } >>
  e e
}

<< \notes \words >>


This seems to do what you need by not requiring any skipping.  Lyrics 
"b" and "c" start at the same time, both waiting until "a" is done.  
Note that "d" continues on the second line as it is part of the same 
context as "c"; however, "e" does wait until "d" is complete before 
resuming lyrics in the original context.



-- Aaron Hill

Re: \partCombine question

2021-06-02 Thread Aaron Hill

On 2021-06-02 1:21 pm, Federico Sarudiansky wrote:

Hi,

I have a question regarding \partCombine.

Consider the following example:

[...]

Is there a way to produce something like the third staff (except for 
the

double forte) using only \partCombine? I.e. something like setting a
mininum "a2" length? I like the results of the first staff regarding
dynamics but I feel the constant on/off of the "a2" is a little 
annoying.


I know I can avoid the "a2" setting an empty text with \set 
Staff.aDueText
= ##f and then restore it to its previous value. But I wonder if there 
is

another option. Even in this case, if no "a2" is present, it would be
really nice to have the two voices explicit, to avoid confusion.


I would imagine \partCombineApart (or its kin) can help with this.


-- Aaron Hill



Re: Nashville Number System, again

2021-06-04 Thread Aaron Hill

On 2021-06-04 5:28 pm, Flaming Hakama by Elaine wrote:

However, there is one other Nashville rule that would need to be
accommodated, which is that for minor, the numbers still follow the
relative major.

So, for a song in A minor that goes A- D- A- E7 A- it is not 1- 4- 1- 
57 1-

as you might expect, but is rather 6- 2- 6- 37 6-


I thought the numerals were always relative to the key.  So a "1" is 
always an "A" even if it is "A major" or "A minor".  Where "A major" and 
"A minor" differ is in the assumed chord types:


(from Wikipedia)

Nashville numerical notation 1  2   3  4  5  
6  7

--
Chord type (major key)   major  minor   minor  major  
major  minor  diminished
Chord type (minor key)   minor  diminished  major  minor  
minor  major  major
Chord type (harmonic minor key)  minor  diminished  augmented  minor  
major  major  diminished


So if you wanted "Am Dm Am E7" then that becomes "1 4 1 5M7" in "A 
minor" and "1 4 1 57" in "A harmonic minor".



-- Aaron Hill



Re: How can I put a text markup above fermata

2021-06-18 Thread Aaron Hill

On 2021-06-18 10:18 pm, ç”°ćť‘ć·ł wrote:

Hello list,

This could be a silly question but I could not figure out by myself.
How can I put a text markup (e.g., arco) above fermata?

\relative c'' {c1\fermata^"arco”}


You could adjust the outside-staff-priority of the fermata.  Consider:


\relative c'' {
  c1 -\tweak outside-staff-priority 100 \fermata
 ^"arco"
}


The "arco" above is a TextScript which has a default 
outside-staff-priority of 450.  There is nothing magical about using 100 
in particular for the fermata, only that it is a smaller number.  Grobs 
with a smaller outside-staff-priority will sit closer to the staff.



-- Aaron Hill



Re: Terminology question

2021-06-19 Thread Aaron Hill

On 2021-06-19 6:05 pm, Mark Stephen Mrotek wrote:

I'll accept the burden.
His plays with dynamic dynamics.


Let's throw in some other parts of speech:

"Dynamic dynamcist dynamically dynamicizes dynamicity in dynamics."

(That word is beginning to lose meaning to me now... thanks, semantic 
satiation.)



-- Aaron Hill



Re: nabble (barlines in volta brackets)

2021-06-20 Thread Aaron Hill

On 2021-06-20 1:13 pm, Flaming Hakama by Elaine wrote:
Ok, so I was going to try figuring out how to use my \barline ":|]" in 
a

volta repeat

\defineBarLine ":|]" #'(":|]" "" " |.")
\relative {
  \repeat volta 2 { c''4 d e f | }
  \alternative {
{ c2 e | }
\bar ":|]"
{ f2 g | }
  }
  c1
}

but I get

programming error: Spanner `VoltaBracket' is not fully contained in 
parent

spanner.  Ignoring orphaned part

And it doesn't print the 2nd ending bracket.

And does anyone have a hint as to how to get the 2nd ending to work 
when

using this barline?


Your \bar command is sitting outside a music expression, so it is 
getting treated as an alternative all on its own--if I understand the 
constructs involved.  Try instead:



\defineBarLine ":|]" #'(":|]" "" " |.")
\relative {
  \repeat volta 2 { c''4 d e f | }
  \alternative {
{ c2 e | \bar ":|]" }
{ f2 g | }
  }
  c1
}


P.S.  No idea about the nabble stuff... does the archive [1] at 
lists.gnu.org have the data you want?

[1]: https://lists.gnu.org/archive/html/lilypond-user/


-- Aaron Hill



Re: horizontal lyric spacing?

2021-06-20 Thread Aaron Hill

On 2021-06-20 6:30 pm, Molly Preston wrote:
What is the best way to make more room horizontally for lyrics? I have 
two

syllable words that look like they are one syllable words (ie no hyphen
visible) , and I am not sure the best way to space them or if there is 
some

special property I don't understand?


This is one of my utility functions:


forceHyphen = \lyricmode {
  \once \override LyricHyphen.minimum-distance = #2
}


You then use it like this:


\lyricmode { And the \forceHyphen white -- robed mar -- tyrs fol -- low, 
}




-- Aaron Hill



Re: Center graphical markup on staff

2021-06-21 Thread Aaron Hill

On 2021-06-21 5:31 pm, Nuno Trocado wrote:

Hi everyone!
How can I have the wiggly line in the example below centered inside the 
staff?

Thanks,
Nuno

\score {
  \relative c' {
c4 d
s-\markup \override #'(height . 2) \draw-squiggle-line #1 #'(8 . 0) 
##f

  }
}


While you could play around with negative padding to get the TextScript 
to overlap the staff, I would recommend hijacking something already on 
the staff, such as a rest:



markupStencil =
#(define-music-function
 (markup music)
 (markup? ly:music?)
 (define (proc grob)
  (let* ((sten (grob-interpret-markup grob markup))
 (xex (ly:stencil-extent sten X)))
   (ly:grob-set-property! grob 'minimum-X-extent xex)
   (ly:grob-set-property! grob 'stencil sten)))
 #{ \tweak before-line-breaking #proc #music #})

squiggle = \markup
 \override #'(height . 2)
 \draw-squiggle-line #1 #'(8 . 0) ##f

\score {
 \relative c' { c4 d \markupStencil \squiggle r }
}


-- Aaron Hill



Re: SVG export - how might you add classes for all graphical objects?

2021-06-29 Thread Aaron Hill

On 2021-06-29 9:43 am, Jean Abou Samra wrote:

However, this problem can be solved by writing
an engraver (those are the powerful tools that
\applyOutput uses under the hood).

\version "2.22.0"

\layout {
  \context {
\Score
\consists
  #(lambda (context)
 (make-engraver
   (acknowledgers
 ((grob-interface engraver grob source-engraver)
(set! (ly:grob-property grob 'output-attributes)
  `((class . ,(grob::name grob
  }
}

<<
  { c d e f }
  \\
  { g a b c' }




NOTE: You might want this engraver to *append* to the class attribute, 
so you can still specify classes on an individual basis:



\version "2.22.0"

SvgAddClassName =
#(lambda (ctxt)
  (define (add-class-name grob)
   (let* ((attribs (ly:grob-property grob 'output-attributes '()))
  (class (ly:assoc-get 'class attribs '()))
  (name (grob::name grob)))
(set! class (if (null? class) name (format #f "~a ~a" class name)))
(set! attribs (assoc-set! attribs 'class class))
(ly:grob-set-property! grob 'output-attributes attribs)))
  (make-engraver
   (acknowledgers
((grob-interface engraver grob source)
 (add-class-name grob)

\layout { \context { \Score \consists \SvgAddClassName } }

{ \tweak output-attributes #'((class . foo)) b'4 }



-- Aaron Hill



Re: SVG export - how might you add classes for all graphical objects?

2021-06-29 Thread Aaron Hill

On 2021-06-29 12:45 pm, Carl Sorensen wrote:

I believe that the logical implications of side-effects are not very
concerning when local variables are set!, so there's probably very
little or no downside to the set!s in Aaron's code.  In fact, it's
possible that Aaron's code will use less heap space by re-using class
instead of adding a new variable grob-class-name.  But I can't help
myself; I want to avoid the grief  Sussman would give me over two
unneeded set! calls.


I prefer that pattern of set! calls because it helps you avoid nesting 
S-expressions too deeply, which I feel greatly improves readability and 
maintainability.  It is the same reason I bothered to define the 
add-class-name procedure, so that it would not be nested within the 
engraver definition itself, better separating concerns.


Additionally, I have taken flack for pushing some of the more functional 
elements of Scheme programming.  (Mention the word "lambda" once, and 
everyone assumes you are a pure functional zealot.)  Regardless, I have 
tended to favor a more imperative approach lately, something that is 
likely to be more consumable for users of LilyPond.



-- Aaron Hill



Re: SVG export - how might you add classes for all graphical objects?

2021-06-29 Thread Aaron Hill

On 2021-06-29 1:20 pm, David Kastrup wrote:


\version "2.22.0"

SvgAddClassName =
#(lambda (ctxt)
  (define (add-class-name grob)
   (let* ((attribs (ly:grob-property grob 'output-attributes '()))
  (class (ly:assoc-get 'class attribs '()))
  (name (grob::name grob)))
(set! class (if (null? class) name (format #f "~a ~a" class 
name)))

(set! attribs (assoc-set! attribs 'class class))
(ly:grob-set-property! grob 'output-attributes attribs)))
  (make-engraver
   (acknowledgers
((grob-interface engraver grob source)
 (add-class-name grob)


That assoc-set! looks like a stinker.  Doesn't it mess with shared data
structures?


Hrm... would it be better to explicitly alist-copy the result from 
ly:assoc-get?  Actually, I guess you could do:



(alist-cons 'class ... (alist-delete 'class attribs))


...since the SRFI says that alist-delete does not modify the original 
structure, only that it might return an alist with a common tail.


And on this point, should LilyPond provide an ly:assoc-set to pair with 
ly:assoc-get that avoids potential issues with shared structures?



-- Aaron Hill



Re: SVG export - how might you add classes for all graphical objects?

2021-06-29 Thread Aaron Hill

On 2021-06-29 1:45 pm, David Kastrup wrote:

Aaron Hill  writes:

Hrm... would it be better to explicitly alist-copy the result from
ly:assoc-get?  Actually, I guess you could do:


(alist-cons 'class ... (alist-delete 'class attribs))



Either that or not even bother about deleting the other entry.


If you don't remove the old entry, then the SVG looks like this:



I am fairly certain that it is not valid to have the same attribute name 
twice in an element in SGML.



-- Aaron Hill



Re: Parenthensize a horizontal group?

2021-06-30 Thread Aaron Hill

On 2021-06-30 9:00 pm, Mark Probert wrote:

Hi.

I've looked through docs and snippets and can't seem to find a way to
place parens around a horizontal group of notes (an "optional"
indicator for leadsheets). I've tried

 \parenthesize { a8 bes }

but nope. Is there a simple way? I want to do something like:

 \mark "(" a8 bes \mark ")"

and have the parens aligned on the center of the staff.


Does LSR 902 [1] help?

[1]: https://lsr.di.unimi.it/LSR/Item?id=902


-- Aaron Hill



Re: Parenthensize a horizontal group?

2021-06-30 Thread Aaron Hill

On 2021-06-30 9:07 pm, Aaron Hill wrote:

On 2021-06-30 9:00 pm, Mark Probert wrote:

Hi.

I've looked through docs and snippets and can't seem to find a way to
place parens around a horizontal group of notes (an "optional"
indicator for leadsheets). I've tried

 \parenthesize { a8 bes }

but nope. Is there a simple way? I want to do something like:

 \mark "(" a8 bes \mark ")"

and have the parens aligned on the center of the staff.


Does LSR 902 [1] help?

[1]: https://lsr.di.unimi.it/LSR/Item?id=902



Or perhaps this which might be easier to use if this sort of thing 
occurs often:



\version "2.22.0"

parenthesizeMusic =
#(define-music-function (music) (ly:music?)
  (define ((stencils which) grob)
   (let* ((stens (parentheses-item::calc-parenthesis-stencils grob))
  (sten (which stens)))
(if (eq? which first) (list sten point-stencil) (list point-stencil 
sten

  (define (add-tweak event tweak)
   (ly:music-set-property! event 'tweaks
(cons tweak (ly:music-property event 'tweaks '()
  (let ((evs (extract-typed-music music 'rhythmic-event)))
   (ly:music-set-property! (first evs) 'parenthesize #t)
   (add-tweak (first evs) `((ParenthesesItem . stencils) . ,(stencils 
first)))

   (ly:music-set-property! (last evs) 'parenthesize #t)
   (add-tweak (last evs) `((ParenthesesItem . stencils) . ,(stencils 
second

  music)

{
  \override ParenthesesItem.font-size = 5
  \override ParenthesesItem.extra-offset =
#(lambda (grob) (cons 0 (* -1/2 (ly:grob-staff-position grob
  \parenthesizeMusic {  d' e' f' g' }
}



-- Aaron Hill

Re: Change size of all notes in one voice with partCombine

2021-07-01 Thread Aaron Hill

On 2021-07-01 10:11 pm, Dinh Hoang Tu wrote:

Yes, I did try \partCombineChords, but it doesn't seem what I expect.
Expectation is 2 notes on same stem, one upper, one lower, not on 
separate

stems.

Below is the test and attached result (2 notes have separate stems)

\version "2.22.1"
localFontSize =
#(define-music-function (font-size music) (number? ly:music?)
   (for-some-music
 (lambda (m)
   (if (music-is-of-type? m 'rhythmic-event)
   (begin
 (set! (ly:music-property m 'tweaks)
   (cons `(font-size . ,font-size)
 (ly:music-property m 'tweaks)))
 #t)
   #f))
 music)
   music)

soprano = { f'4 g'4 a'4 b'4 c''2 }
basso = { d'4 e' f'' g' a'2 }
alto = { d'4 e' \stemUp f'' g' a'2 }
tenor = { d'4 e' f'' g' a'2 }
\new Score { \new Staff << \partCombineChords \soprano \basso >> }
\new Score { \new Staff << \partCombineChords \soprano \alto >> }
\new Score { \new Staff << \partCombineChords \soprano \localFontSize 
-3

\tenor >> }

Please advice if any mistake or missing.


\partCombineChords is not a substitute for \partCombine.

The former just sets an internal state for the part combiner, however 
you must use \partCombine to invoke the combiner.  Consider:



soprano = { f'4 g'4 a'4 b'4 c''2 }
tenor = { d'4 e' f'' g' a'2 }
\partCombine
  { \partCombineChords \soprano }
  { \stemUp \localFontSize -3 \tenor }



-- Aaron Hill

Re: Change size of all notes in one voice with partCombine

2021-07-01 Thread Aaron Hill

On 2021-07-01 10:44 pm, Aaron Hill wrote:

[...]


Also, here's a minor refactor of \localFontSize better separating some 
concerns:



\version "2.22.0"

localFontSize =
#(define-music-function
  (font-size music)
  (number? ly:music?)
  (map (lambda (m)
(ly:music-set-property! m 'tweaks
 (cons `(font-size . ,font-size)
  (ly:music-property m 'tweaks
   (extract-typed-music music 'rhythmic-event))
  music)

soprano = \fixed c' { f4 g a b c'2 }
tenor = \fixed c' { d4 e \tweak color #red f' g 2 }
\partCombine
  { \partCombineChords \soprano }
  { \stemUp \localFontSize -3 \tenor }


The test case below includes an inline \tweak and a chord within the 
tenor part.



-- Aaron Hill

Re: Warning: avoid-slur not set

2021-07-03 Thread Aaron Hill

On 2021-07-03 1:54 pm, Jonathan Armitage wrote:

I can see that the slur clashes with the i, but in spite of much
googling, I cannot for the life of me figure out how to set
avoid-slur. Please could you advise.


You can \override it for a more global effect or you can \tweak it to 
localize the impact.  Here is an example of the latter approach:



\version "2.20.0"
\language "english"

outside = \tweak avoid-slur #'outside \etc
rhf = \rightHandFinger \etc

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

  \key d \major
  \stemDown
  ( )  fs
}



-- Aaron Hill



Re: wront type for argument: on \note

2021-07-09 Thread Aaron Hill

On 2021-07-09 1:22 pm, ming tsang wrote:

I try to run the following lilypond code.

\version "2.23.3"
\markup { \note #"16" #1 }


The markup command was changed (in version 2.22, I think) so that you 
now specify a duration, not a string:



\markup \note { 16 } #UP



-- Aaron Hill



Re: Move chord name down onto staff?

2021-07-10 Thread Aaron Hill

On 2021-07-10 6:06 pm, Mark Probert wrote:

I'm not sure how to move the chord names down so they are centered on
the staff. Essentially I want the changes on an empty stave but I'm
unclear on how to do that.
[...]


Here's one way to do this:


\version "2.20"

harmony =  \chordmode { a1:m s1 f1:m7 s1 }
tune = { s1 s1 s1 s1 }

chordsOnStaff = \with {
  % Force the baselines to match.
  \override VerticalAxisGroup.nonstaff-relatedstaff-spacing =
  #'((basic-distance . 0) (minimum-distance . 0)
 (padding . -inf.0) (stretchability . 0))
  % Adjust to one staff space lower.
  \override ChordName.extra-offset = #'(0 . -1)
}

\score {
  <<
\new ChordNames \with \chordsOnStaff \harmony
    \new Staff  \tune
  >>
}



-- Aaron Hill

Re: error :GUILE signaled an error for the expression beginning here #

2021-07-10 Thread Aaron Hill

On 2021-07-10 7:15 pm, ming tsang wrote:

I copied the snippet from the lilypond snippet repository.  There is no
lilypond version information.


Last I checked, the LSR was only up-to-date with 2.18.2.


-- Aaron Hill



Re: error :GUILE signaled an error for the expression beginning here #

2021-07-10 Thread Aaron Hill

On 2021-07-10 8:46 pm, Aaron Hill wrote:

On 2021-07-10 7:15 pm, ming tsang wrote:
I copied the snippet from the lilypond snippet repository.  There is 
no

lilypond version information.


Last I checked, the LSR was only up-to-date with 2.18.2.


And confirmed at the bottom of the Contributing [1] page:


The LSR is currently running LilyPond version 2.18.2.


[1]: https://lsr.di.unimi.it/LSR/html/contributing.html


-- Aaron Hill



Re: error :GUILE signaled an error for the expression beginning here #

2021-07-11 Thread Aaron Hill

On 2021-07-11 12:32 pm, ming tsang wrote:

I am confused about this "file information" LSR.
Yesterday, I did a ""file>save as" to a file name to
untitled_LSR_file-info_v2182.ly. This morning I tried to run the
untitled_LSR_file-info_v2182.ly, but I got run error:


The code in LSR 197 is not able to properly handle non-ASCII characters 
in a file path.  Upon review, its use of object->string is mangling the 
filename.  Also, the entire premise of the snippet is predicated on the 
false assertion that the command-line only consists of the filename in 
question.  In practice, there are likely to be many other arguments.  At 
best, you might be able to rely on the filename being the last argument:



\version "2.18.2"

filename = #(last (command-line))
\markup { "File Name =" \filename }


However, why mess about with reparsing the command-line arguments in the 
first place?  LilyPond has already done this for you, so just ask 
LilyPond for the current filename:



\version "2.20.0" % or newer

filename = #(define-scheme-function () ()
 (car (ly:input-file-line-char-column (*location*
\markup { "File Name =" \filename }


You could adapt the above to work on 2.18.2, but calling the function 
within markup requires some extra sugar:



\version "2.18.2"

filename = #(define-scheme-function (parser location) ()
 (car (ly:input-file-line-char-column location)))
\markup { "File Name =" $#{ \filename #} }


All the more reason to leave 2.18.2 behind and just focus on the newer 
versions of LilyPond.



-- Aaron Hill



Re: Extra padding between ChordNames and custom headers

2021-07-16 Thread Aaron Hill

On 2021-07-16 10:49 pm, Brent Annable wrote:

Any other thoughts?


Does this approach help?


\version "2.22.0"

song =
<< \new ChordNames \chordmode { c2 d:7 | g1 }
   \new Voice \fixed c' { g2 a4 fis | g1 } >>

\paper {
  indent = 0 line-width = 2\in ragged-right = ##f

  originalScoreTitleMarkup = \scoreTitleMarkup
  scoreTitleMarkup = \markup \left-column {
\originalScoreTitleMarkup \fromproperty #'header:extra }
}

\score { \header { piece = "Duis blandit lorem" } \song }
\score { \header { piece = "Curabitur condimentum"
   extra = \markup \vspace #0.5 } \song }
\score { \header { piece = "Integer sit amet" } \song }


The strategy is to define a new header variable that gets vertically 
appended to the normal score markup.  Normally, this variable would be 
undefined and result in an empty stencil that causes no additional 
spacing.  But supplying a suitable value for the property would let you 
apply spacing to a particular score.



-- Aaron Hill

Re: Extra padding between ChordNames and custom headers

2021-07-17 Thread Aaron Hill

On 2021-07-17 2:24 am, Robin Bannister wrote:

Robin Bannister wrote:

And the put-mm [1] version of this would be


Forget that!

Sorry for the noise.  Missing Nabble's Classic overview.


On the contrary, it led me to this variation:


\version "2.22.0"

song =
<< \new ChordNames \chordmode { c2 d:7 | g1 }
   \new Voice \fixed c' { g2 a4 fis | g1 } >>

#(define-markup-command
  (header-pad-below layout props arg)
  (markup?)
  (let ((padding (chain-assoc-get 'header:pad-below props 0)))
   (interpret-markup layout props
(markup #:put-adjacent Y DOWN arg
 #:with-dimensions '(0 . 0) `(0 . ,padding) #:null

\paper {
  indent = 0 line-width = 2\in ragged-right = ##f
  scoreTitleMarkup = \markup \header-pad-below \scoreTitleMarkup
}

\score { \header { piece = "Duis blandit lorem" } \song }
\score { \header { piece = "Curabitur condimentum" pad-below = 2 } \song 
}

\score { \header { opus = "Integer sit amet" pad-below = 1 } \song }
\score { \header { pad-below = 3 } \song }



-- Aaron Hill

Re: Scheme doesn't check for missspeeled variable names???

2021-07-20 Thread Aaron Hill

On 2021-07-20 8:11 pm, James B. Wilkinson wrote:

I fat-fingered the keyboard on my laptop and got this:

flute-notes = {
  \override BreathingSigh.Y-offset = #2.6  %% also
tried #5.0 and some really big numbers; no effect
  7 bars of music in 4/4
}


AND I never got an error message.


What version are you running?  You should have gotten this output:


GNU LilyPond 2.22.0
Processing `grob-paths.ly'
Parsing...
grob-paths.ly:4:13: error: bad grob property path
  \override
BreathingSigh.Y-offset = #2.6
Interpreting music...



-- Aaron Hill



Re: Forcing display of a time signature

2021-07-21 Thread Aaron Hill

On 2021-07-21 2:56 am, N. Andrew Walsh wrote:

[ . . . ] Is there a way to force (re-)displaying a time
signature in one Staff, without invoking the \time command and 
displaying

it for all voices?


One option would be to use \time again, but then manually omit the 
signature where you do not want it to appear:



\version "2.22.0"

noTime = \omit Staff.TimeSignature
<< \new Staff { \once \noTime \time 3/4 b'4 4 4 }
   \new Staff { b'8 8 2 }
   \new Staff { \once \noTime b'4. 8 r4 } >>



-- Aaron Hill

Re: Scheme doesn't check for missspeeled variable names???

2021-07-21 Thread Aaron Hill
(Do try to keep the mailing list on all replies, so that threads do not 
get disrupted and to ensure broad visibility and participation.)


On 2021-07-21 9:11 am, James B. Wilkinson wrote:
On Jul 20, 2021, at 11:16 PM, Aaron Hill  
wrote:


On 2021-07-20 8:11 pm, James B. Wilkinson wrote:

I fat-fingered the keyboard on my laptop and got this:
flute-notes = {
 \override BreathingSigh.Y-offset = #2.6  %% also
tried #5.0 and some really big numbers; no effect
 7 bars of music in 4/4
}
AND I never got an error message.


What version are you running?  You should have gotten this output:


Sure enough. I got the latest version, and that’s what happens now.

I had this:   2.22.0-1  on OS X 10.14.6

My use of Lillypond is sporadic. I prolly should start every project
with a fresh download.

thanks for the quick reply.


Well, to be fair, I would expect all versions of LilyPond to have 
produced that error.  As such, the issue was likely more about your 
environment and workflow, checking to see if some other process was 
hiding the error message.



-- Aaron Hill



Re: Distance between staffs

2021-07-22 Thread Aaron Hill

On 2021-07-22 7:12 am, Silvain Dupertuis wrote:

Hello,
I found a nice way to do it, using Lilypond 20, by specifying
staff-staff-spacing.padding with a negative value

\new PianoStaff \with {
  % midiInstrument = "tenor sax"
  \override StaffGrouper.staff-staff-spacing = #'(
(basic-distance . 0)
(padding . 0)) % s0 for first exemple ;
second example : (padding . -3.09)
}

The result was this

 with padding=0
 with the negative adjustment (padding = -3.06)

Unfortunately, this adjustment no longer works in LilyPond 22
It looks like the property was broken, or no longer function this way?
Whatever the value, the distance is not affected.


Negative padding still works, but you failed to set minimum-distance.  
Seems there was a change of behavior around the assumed defaults.


That said, you should be relying solely on 
basic-distance/minimum-distance to separate the staves properly.  You 
then just need a suitably large negative padding to handle the 
overlapping ink.  Negative infinity should be large enough for most 
situations:



\version "2.22.0"

\new PianoStaff
\with {
  \override StaffGrouper.staff-staff-spacing =
  #'((basic-distance . 6) (minimum-distance . 6)
 (padding . -inf.0) (stretchability . 0))
}
<< \new Staff { g,4 g g' g'' | s1 }
   \new Staff { \clef "bass" s1 | g,4 g g' g'' } >>



-- Aaron Hill

Fix submitted for Frescobaldi #1379

2021-07-24 Thread Aaron Hill
I just submitted a PR [1] that should address the errors around Unicode 
command-line files paths on Windows.  It needs validation to ensure no 
new issues have been introduced.  On my Windows 10 (20H2) system, I was 
able to open files with non-ASCII characters properly.


[1]: https://github.com/frescobaldi/frescobaldi/pull/1382


-- Aaron Hill



Re: How to make a macro of articulation marks?

2021-07-30 Thread Aaron Hill

On 2021-07-30 5:52 pm, H. S. Teoh wrote:

I tried:

midiEmph = \tag #'midi -\>
a-.\midiEmph b-.\midiEmph c-.\midiEmph d-.\midiEmph

but the accent appears to just get dropped silently. What am I doing
wrong?


Did you mean to use decrescendo (\>) or a long accent (>) within 
midiEmph?



-- Aaron Hill



Re: Setting global staff size after the \paper block nullifies font setting

2021-07-31 Thread Aaron Hill

On 2021-07-30 11:05 pm, Brent Annable wrote:

I've come across a little problem that I don't know how to fix. I've
changed the text font in a vocal score by using the scheme #define font
procedure, and have noticed that if I subsequently use
#(set-global-staff-size) *after* the \paper block, the font reverts 
back to
the default. It doesn't do this if I use #(set-global-staff-size) 
*before *the

paper block.


This is a long-standing known issue [1] with LilyPond.  You need to set 
the staff size before specifying any custom fonts because 
layout-set-absolute-staff-size-in-module rebuilds the font tree for the 
new staff size.


[1]: https://gitlab.com/lilypond/lilypond/-/issues/1129

The best I can come up with is a hack that redefines the 
make-default-fonts-tree procedure:



\version "2.22.0"

changeDefaultFonts =
#(define-void-function
  (roman-str sans-str typewrite-str)
  (string? string? string?)
  (define (proc factor)
   (make-pango-font-tree roman-str sans-str typewrite-str factor))
  (set! make-default-fonts-tree proc))

\paper { indent = 0 }

foo = {
  \mark \markup \sans Sans
  b'1^\markup \typewriter Mono
 _\markup \roman Serif
}
\markup {
  \score { \foo \layout { #(layout-set-staff-size 15) } }
  \score { \foo \layout { #(layout-set-staff-size 20) } }
  \score { \foo \layout { #(layout-set-staff-size 25) } }
}
\changeDefaultFonts "Cambria" "Calibri" "Consolas"
\markup {
  \score { \foo \layout { #(layout-set-staff-size 15) } }
  \score { \foo \layout { #(layout-set-staff-size 20) } }
  \score { \foo \layout { #(layout-set-staff-size 25) } }
}



-- Aaron Hill

Re: Custom note names, or meta-score?

2021-07-31 Thread Aaron Hill

On 2021-07-31 10:43 am, Craig Comstock wrote:

So said another way, I’d like to write a meta-score like { aa4 aa2 aa
aa ab ab ab ac ac ca ca } and those note names relate to a set of
pitches determined maybe in another file (not code hopefully) so that
as the pitches are chosen/changed it is easy to regenerate the
score/parts.


The following (minimally-tested) proof-of-concept should get you pretty 
close to your goal:



\version "2.22.0"

#(define generic-notes '())

defineGenericNote =
#(begin
  (define (note-event? arg)
   (and (ly:music? arg)
(music-is-of-type? arg 'note-event)))
  (define-void-function (name music) (symbol? note-event?)
   (if (ly:assoc-get name generic-notes #f)
(ly:input-warning (*location*)
 "note name ~s is already defined" name)
(set! generic-notes (cons (cons name music) generic-notes)

registerGenericLanguage =
#(define-void-function () ()
  (define pitch-names
   (let ((len (length generic-notes)))
(cons 'generic
 (map (lambda (n idx)
   ;; Encode index within alteration.
   (cons (car n) (ly:make-pitch 0 0 (/ idx len
  generic-notes (iota len)
  (set! language-pitch-names (cons pitch-names language-pitch-names)))

fixupGenericMusic =
#(define-music-function (music) (ly:music?)
  (define (fixup! m)
   (let* ((pitch (ly:music-property m 'pitch))
  (oct (ly:pitch-octave pitch))
  (alt (ly:pitch-alteration pitch))
  (idx (numerator alt))
  (note (cdr (list-ref generic-notes idx
;; Adjust pitch, applying octave transposition.
(ly:music-set-property! m 'pitch
 (ly:pitch-transpose
  (ly:music-property note 'pitch)
  (ly:make-pitch oct 0 0)))
;; Merge articulations.
(ly:music-set-property! m 'articulations
 (append (ly:music-property note 'articulations '())
 (ly:music-property m 'articulations '(
;; Merge tweaks.
(ly:music-set-property! m 'tweaks
 (append (ly:music-property note 'tweaks '())
 (ly:music-property m 'tweaks '())
  (map fixup! (extract-typed-music music 'note-event))
  music)

toplevel-music-functions =
#(cons fixupGenericMusic toplevel-music-functions)

% NOTE: Pitches here use the current \language setting.
\defineGenericNote qw d'
\defineGenericNote er d'-.
\defineGenericNote ty \tweak font-size -3 fis'

\registerGenericLanguage
\language "generic"

{ qw4 er2 ty8->  }


Each generic note name is mapped to a note event that specifies the 
desired pitch along with tweaks and articulations.  Target pitches need 
not be unique.


As an implementation detail, a generic note is associated with a 
placeholder pitch with a special alteration value for looking up the 
reference note event.  A top-level handler is installed that processes 
music to convert these temporary pitches into the correct ones while 
merging tweaks and articulations.  As shown above with qw', the 
reference pitch can be shifted by octave as needed.


Chords mostly work, however certain articulations need to be applied to 
the chord-event rather than individual notes.  Additional logic is 
needed to support chords fully, and it might be useful for generic note 
names to be chords as well.


Key signatures do not support the generic note names as they are 
processed before the top-level handler.  For now, you would have to 
manually specify the pitch:



\key #(ly:make-pitch 0 1 0) \major   %{ equiv. to \key d \major %}


-- Aaron Hill

Re: Custom note names, or meta-score?

2021-07-31 Thread Aaron Hill

On 2021-07-31 1:32 pm, Jean Abou Samra wrote:

This is perfectly doable, but not as simple as defining a
custom language for pitches, because the languages map note
names to mere pitches, and not full-fledged notes that can
contain articulations. Therefore, the code below arrives at
the end result via two steps, first mapping the note names
to dummy pitches chosen to be unique, then replacing those
with the real pitches, adding the articulations at the
same time.


Sigh... you got there before me.  :)

It is funny how similar our approaches were.


-- Aaron Hill



Re: incomplete tuplets

2021-07-31 Thread Aaron Hill

On 2021-07-31 2:44 pm, David Zelinsky wrote:
The suggested notation for this was to use a quintuplet bracket that 
was

open on the right, and extended slightly beyond the second notehead, or
beyond the beam.  See attached.

Is there a sensible way to do that in Lilypond?  I've searched around 
in

the documentation but haven't found anything.


Not a perfect replica, but hopefully a start:


\version "2.22.0"

\fixed c'' {
  \time 2/20
  #(ly:expect-warning "strange time signature")
  \once \override TupletBracket.bracket-visibility = ##t
  \once \override TupletBracket.edge-height = #'(0.7 . 0)
  \once \override TupletBracket.shorten-pair = #'(0 . -1)
  \once \override TupletBracket.padding = 3
  \tuplet 5/4 { a16[ bes16] }
  \time 4/8
  r8
}


-- Aaron Hill

Re: simple question 1 where's the pdf for all the manuals for 2.22? a better response I hope more polite

2021-08-02 Thread Aaron Hill

On 2021-08-02 5:44 pm, jh wrote:

Carl - that works fine for the notation but with 2.18 I have all the
information in one huge pdf.  This doesn't work at all with 2.22 the
only pdf that seems available is the one you directed to me but going
to the bottom of any other subject doesn't show a pdf and in fact
there is a confusing line that says go back to the main page for docs.

So the impolite question was 'really' but actually I'd rather actually
have the pdf that I'm used to/need.  This is not that.
thanks for the help.


To my knowledge, there has never been a single PDF containing all the 
manuals.  Of course, you could download each individual PDF and manually 
stitch them together; but that might cause problems for the table of 
contents and inter-document links.


The PDFs are, admittedly, a little hidden when you come from the main 
manuals page [1].  You need to click on the parenthetical "details" link 
for each section, which then will give you the link to its PDF.  Once 
you are on one of these pages, there is a banner with links to the other 
details pages.


[1]: http://lilypond.org/manuals.html


-- Aaron Hill



Re: run error Lilypond-book on Windows 10

2021-08-06 Thread Aaron Hill

On 2021-08-06 8:46 am, Archer Endrich wrote:

[ . . . ]
C:\P3L\lpbk>lilypond-book --output=out --pdf ALMdurasnumber.lytex
  File "C:\Lilypond2221\usr\bin\lilypond-book.py", line 376
    except subprocess.CalledProcessError as e:
  ^
SyntaxError: invalid syntax
[ . . . ]
Perhaps someone could check out line 376 for me.  Thanks again.


The error message clearly indicates this is invalid syntax for the 
version of Python you are running.  In particular, "as" is not valid 
prior to 2.6 according to [1].


[1]: 
https://stackoverflow.com/questions/2535760/python-try-except-comma-vs-as-in-except#2535770



-- Aaron Hill



Re: Ending Tie to No Note

2021-08-06 Thread Aaron Hill

On 2021-08-06 11:29 am, Ernie Braganza wrote:

Is there a better way to do this?

I am trying to end a repeated section with a tie to the first note back 
at
the beginning of the section. This is written as an unterminated tie. I 
can

get it to look right with this code, but I get an error message
"programming error: bounds of this piece aren't breakable"

What's the "right" way to achieve this?

\version "2.20.0"
\relative c' {
  c1~
  \repeat volta 2 {
c2 e2|
g2 c,2(<>)|
  }
}


You should use one of the "semi-ties", specifically \laissezVibrer.


-- Aaron Hill



Re: Printing two staves in the same place (overlaying)

2021-08-07 Thread Aaron Hill

On 2021-08-07 2:38 am, Daniel Benjamin Miller wrote:

Thanks, Silvain, but let me clarify. I want two staffs to actually be
placed in the same exact spot. So, for instance, the five lines of
each staff should be engraved in the same spot --- but everything
within the staff should be "unaware" of this fact.


You have a few options, depending on the degree of alignment you do want 
between the staves.



\version "2.22.0"

staffI = \new Staff \fixed c' { g4 a b a8 g | fis4 e f2 }
staffII = \new Staff \fixed c'' { c2 d4 b, | c4 d bes,2 }

zeroSpacing = \with {
  \override VerticalAxisGroup.staff-staff-spacing =
  #'((basic-distance . 0) (minimum-distance . 0)
 (padding . -inf.0) (stretchability . 0))
}

\new StaffGroup \with \zeroSpacing << \staffI \staffII >>

\markup \overlay {
  \with-color #red \score { \staffI }
  \with-color #blue \score { \staffII }
}


The first approach above eliminates spacing by using an extremely 
negative padding to permit overlapping staves within a system.  The 
second approach uses \markup to overlap the stencils from two scores.


With the first option, there is still general time alignment between the 
systems, which if you do want measures to line up, that would be the way 
to go.  With the second, each staff is completely isolated from one 
another.  In the example above, I added color to each staff so you can 
better see the effect.



-- Aaron Hill

Re: Differentiate between including and direct compiling a file

2021-08-07 Thread Aaron Hill

On 2021-08-07 11:52 am, R. Padraic Springuel wrote:

Is there a way for Lilypond to differentiate between a file which is
being compiled directly and it being included in the compilation of
another file?  Something equivalent to `if __name__ == “__main__”`
from python?  I’d like to add simple examples to my various tools that
I can use to test it (both during original development and after an
update which breaks something) and remind me of what the tool does
when I haven’t used it in a while. Ideally, I’d hide these examples
inside a construction like this so that the example output is only
produced when the tool file is compiled directly.


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.



-- Aaron Hill



Re: how to write an extended dim and cresc (text, not hairpins) , like a trillSpan?

2021-08-07 Thread Aaron Hill

On 2021-08-07 2:14 pm, Kenneth Wolcott wrote:
How to write an extended dim and cresc (text, not hairpins) ,like a 
trillSpan?

[ . . . ]
Where do I look in the manual for this long extension (span?) of the
expressive mark?


Text spanners [1] should be what you need.

[1]: 
http://lilypond.org/doc/v2.22/Documentation/notation/writing-text#text-spanners



-- Aaron Hill



Re: Gracenote bug?

2021-08-23 Thread Aaron Hill

On 2021-08-23 11:30 am, Kees van den Doel wrote:
Trying to shift a note away from the barline which it's touching by 
adding

a \grace s16, but I ran into what appears a bug?
[ . . . ]


One of the longest-standing bugs, in fact.  See [1].

[1]: https://gitlab.com/lilypond/lilypond/-/issues/34


-- Aaron Hill



Re: Adjusting horizontal space from notehead to bar line

2021-08-23 Thread Aaron Hill

On 2021-08-23 4:03 pm, Matthew Fong wrote:

Hello Hans, LilyPonders,

Thank you! I added the line to my Staff context, and everything worked 
as

expected.
\override BarLine.space-alist.next-note = #'(fixed-space . 1.2)

I wanted to refine the solution and add space only *after* double-bar
lines, but adding the following to my bars doesn't seem to have any 
effect

\once \override BarLine.space-alist.next-note = #'(fixed-space . 1.2)

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

. 1.2) \bar "||"
\skip 1*16/4 \once \override BarLine.space-alist.next-note = 
#'(fixed-space

. 1.2) \bar "||"
\skip 1*16/4 \once \override BarLine.space-alist.next-note = 
#'(fixed-space

. 1.2) \bar "||"
\skip 1*8/4 \once \override BarLine.space-alist.next-note = 
#'(fixed-space

. 1.2) \bar "||"


You might need to be specific about context:

\override Staff.BarLine...
  ^^

-- Aaron Hill



Re: Parenthensize a horizontal group?

2021-08-26 Thread Aaron Hill

On 2021-08-25 7:36 am, Ernie Braganza wrote:
When I use the parenthesizeMusic function or the snippet in LSR-902 
with a
winged repeat bar, the parenthesis collides with the bar. I have not 
been
able to find a way to pad the bar or the parentheses in a way that 
avoids

this.
[in this code I could simply reduce the font size, but that does not 
fix

the issue in my score]

\relative c''
{
\override ParenthesesItem.font-size = 7
  \override ParenthesesItem.extra-offset =
  #(lambda (grob) (cons 0 (* -1/2 (ly:grob-staff-position grob
  g2 r4
  \parenthesizeMusic {
d'8 bes8
  }
  \bar":|]"
}


It is possible to add some padding to the BarLine:


  \once \override Staff.BarLine.extra-spacing-width = #'(-2 . 0)
  \bar ":|]"



-- Aaron Hill



Re: how to insert text inside a hairpin?

2021-09-03 Thread Aaron Hill

On 2021-09-03 11:52 am, Kenneth Wolcott wrote:
  I am engraving some music that has a "poco rit." embedded inside a 
hairpin.


  See attached image.

  How do I do that in Lilypond?

  I'm using Lilypond 2.22.0


Maybe something like this:


\version "2.22.0"

overlayMarkup =
#(define-scheme-function
  (self-x self-y parent-x parent-y markup)
  ((number? 0) (number? 0) (number? 0) (number? 0) markup?)
  (grob-transformer 'stencil
   (lambda (grob orig)
(let* ((xex (ly:stencil-extent orig X))
   (yex (ly:stencil-extent orig Y))
   (xoff (interval-index xex parent-x))
   (yoff (interval-index yex parent-y))
   (sten (grob-interpret-markup grob markup)))
 (set! sten (ly:stencil-aligned-to sten X self-x))
 (set! sten (ly:stencil-aligned-to sten Y self-y))
 (ly:stencil-add orig
  (ly:stencil-translate sten (cons xoff yoff)))

pocoRitMarkup =
 \markup \whiteout \tiny \italic "poco rit."
pocoRit =
 -\tweak stencil \overlayMarkup \pocoRitMarkup \etc

{ b'4 \pocoRit \< 4 4 4 \! }


-- Aaron Hill

Re: Using Scheme inside Lilypond

2021-09-04 Thread Aaron Hill

On 2021-09-04 11:39 am, Richard Shann wrote:

Can someone educate me as to why this works:

\markup \path #0.4 #'((moveto 0 0) (lineto -30 50) (lineto -20 80) 
(closepath))


but this does not:

\markup \path #0.4 #'((moveto 0 0) (lineto -30 (* 2 25)) (lineto -20
80) (closepath))

The difference being I replace 50 with (* 2 25)

(I'm trying to write code that will draw a box round A4 or letter paper
with just a change of some scaling factors - I can work around it but
it's distressing not to understand what is going on).

Richard Shann


You are quoting so there is no interpretation of arithmetic expressions. 
 You should quasiquote:



\markup \path #0.4
 #`((moveto 0 0) (lineto -30 ,(* 2 25))
(lineto -20 80) (closepath))


-- Aaron Hill



Re: Misunderstanding \footnote

2021-09-08 Thread Aaron Hill

On 8 Sep 2021, at 03:33, Kevin Cole  wrote:
\footnote "*" \concat {
  "* This song has been translated by the leading Irish,"
  " Scotch Gaelic, Manx, Welsh, Breton, and Cornish poets"
  " into their native languages for singing in each Celtic"
  " country and at Pan-Celtic Festivals."


And though not related to footnotes, you should avoid \concatenating 
strings because it will result in single line of text.  Granted, if your 
font size is small compared to the paper size, it is possible all that 
text could fit within the page margins.  In general, though, you should 
consider using \wordwrap or \wordwrap-string:



\markup \override #'(line-width . 40)
\left-column {
  \bold \typewriter "\\wordwrap"
  \wordwrap {
  * This song has been translated by the leading Irish,
Scotch Gaelic, Manx, Welsh, Breton, and Cornish poets
into their native languages for singing in each Celtic
country and at Pan-Celtic Festivals.
  }
  \vspace #1 \draw-hline
  \bold \typewriter "\\wordwrap-string"
  \wordwrap-string
  #"* This song has been translated by the leading Irish,
  Scotch Gaelic, Manx, Welsh, Breton, and Cornish poets
  into their native languages for singing in each Celtic
  country and at Pan-Celtic Festivals."
}



-- Aaron Hill



Re: Adding a quote to lyrics

2021-09-11 Thread Aaron Hill

On 2021-09-11 5:32 pm, Kira Garvie wrote:

Following up on this question from thursday, how do I insert the curly
quotes? I copied them from your email but would like to know how to do 
them

myself!


If you are running Windows, you hold down ALT, type a series of numbers 
on the numpad, and then release ALT to input the specified character.  
For instance, here are the codes for double quotation marks:


ALT+0147 → “ (Left double quotation mark)
ALT+0148 → ” (Right double quotation mark)

There are tables of codes online, but you can also use the Character Map 
(charmap.exe) program.  Find and select a character, and the status bar 
will list its Alt+Numpad code if supported.  Keep a cheat sheet nearby 
with the ones you use most often; though it should not take long before 
muscle memory takes over.  In my work, I type "blessèd" enough that I 
have ALT+0232 memorized.



-- Aaron Hill



Re: Adding a quote to lyrics

2021-09-12 Thread Aaron Hill

On 2021-09-12 2:32 am, Kira Garvie wrote:
(Anyone who types “blessèd” that much probably works in a similar line 
of
work to me - that word sounds funny to me with just one syllable now! I 
am

a church organist/ music director.)!


Similar role, indeed.  Though in my case, I am just filling the position 
while we are looking for a full-time replacement for our previous 
director.  Unfortunately, it seems there are fewer folks entering the 
music ministry these days, and the pandemic certainly has not been 
helping.



-- Aaron Hill



Re: Having an actual hyphen in the lyrics?

2021-09-14 Thread Aaron Hill

On 2021-09-14 10:25 pm, Valentin Petzel wrote:

if you use "on –" then you are treating this as one syllable. So this
way Lilypond won't align the – under the tied note, if that is still
intended.


Could you use a LyricHyphen and just lengthen it to look like an em 
dash?



lyricEmDash = {
  \override LyricHyphen.minimum-distance = #5
  \override LyricHyphen.length = #2.5
}

\relative b' { \time 3/4 b4 b2 | b4 b2 \bar "|." }
\addlyrics { Lo -- \once \lyricEmDash rem -- ips -- um. }


Just know that you need to do the appropriate \overrides before the 
LyricText preceding the LyricHyphen.



-- Aaron Hill



Re: Old style bass clef

2021-09-15 Thread Aaron Hill

On 2021-09-15 6:49 pm, Stanton Sanderson wrote:

I am trying to reproduce a manuscript which use an old style bass
clef. A screen shot from <http://lsr.di.unimi.it/LSR/Item?u=1&id=900
<http://lsr.di.unimi.it/LSR/Item?u=1&id=900>> is shown below.The code
apparently worked at one time, but fails when I run it.
%% <= http://lilypond.1069038.n5.nabble.com/Old-Bass-Clef-td28833.html
<http://lilypond.1069038.n5.nabble.com/Old-Bass-Clef-td28833.html>
% add by P.P.Schneider on March 2014. Edited on June. 2017.
The LSR snippet is a bit long, so I’m not reproducing it here. I would
be grateful for some help- perhaps someone has an update?


Seems to be some odd quoting going on.  Does this version work better?


my-clef =
#(ly:make-stencil
  '(path 0.001
 (moveto   -0.10  -0.35
  curveto  -0.10  -1.11   0.48  -1.80   1.25  -1.80
  curveto   1.75  -1.80   2.20  -1.60   2.50  -1.05
  curveto   2.55  -0.95   2.50  -0.90   2.43  -0.95
  curveto   2.20  -1.17   1.90  -1.48   1.45  -1.48
  curveto   0.70  -1.48   0.15  -0.85   0.15  -0.15
  curveto   0.15   0.45   0.62   0.83   1.05   0.83
  curveto   1.55   0.83   1.90   0.50   1.90   0.05
  curveto   1.90  -0.35   1.55  -0.71   1.20  -0.71
  curveto   0.80  -0.71   0.60  -0.40   0.63  -0.17
  curveto   0.75  -0.30   0.90  -0.31   1.00  -0.31
  curveto   1.20  -0.31   1.38  -0.10   1.38   0.15
  curveto   1.38   0.35   1.20   0.55   0.95   0.55
  curveto   0.60   0.52   0.39   0.25   0.39  -0.05
  curveto   0.39  -0.52   0.62  -0.89   1.20  -0.89
  curveto   1.65  -0.89   2.07  -0.50   2.07   0.10
  curveto   2.07   0.66   1.56   1.01   1.05   1.01
  curveto   0.28   1.01  -0.10   0.35  -0.10  -0.35
  moveto2.42   0.20
  curveto   2.54   0.20   2.64   0.30   2.64   0.42
  curveto   2.64   0.54   2.54   0.64   2.42   0.64
  curveto   2.30   0.64   2.20   0.54   2.20   0.42
  curveto   2.20   0.30   2.30   0.20   2.42   0.20
  moveto2.42  -0.20
  curveto   2.54  -0.20   2.64  -0.30   2.64  -0.42
  curveto   2.64  -0.54   2.54  -0.64   2.42  -0.64
  curveto   2.30  -0.64   2.20  -0.54   2.20  -0.42
  curveto   2.20  -0.30   2.30  -0.20   2.42  -0.20
  closepath)
 round round #t)
   (cons -0.1 2.65)
   (cons -1.3 1))



-- Aaron Hill



Re: Old style bass clef

2021-09-15 Thread Aaron Hill

(re-adding mailing list for visibility...)

On 2021-09-15 8:26 pm, Stanton Sanderson wrote:

Unfortunately, no. With Lilypond 2.23.3, substituting \clef my-clef
for \cleff bass in the code results in Frescobaldi’s Lilypond Log
spitting out a list of supported types:

warning: unknown clef type `my-clef'
warning: supported clefs: C F G G2 GG…. (And so on). Will look further 
tomorrow.


Wait... what error were you getting with the original LSR snippet?  Was 
it not something like this?



GNU LilyPond 2.22.0
Processing `custom-bass-clef.ly'
Parsing...
Interpreting music...
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Layout output to `custom-bass-clef.cropped.eps'...
warning: unknown line-cap-style: (quote round)
/usr/local/lilypond/usr/share/lilypond/current/scm/output-ps.scm:272:49: 
In procedure symbol->string in expression (symbol->string join):
/usr/local/lilypond/usr/share/lilypond/current/scm/output-ps.scm:272:49: 
Wrong type argument in position 1 (expecting symbol): (quote round)



"\clef my-clef" is nonsense.  You would have to register a new clef type 
(if that is even possible), and the LSR snippet certainly is not doing 
that.  It is replacing the stencil for a bass clef, but you still say 
\clef bass.



-- Aaron Hill



Re: Having an actual hyphen in the lyrics?

2021-09-15 Thread Aaron Hill

On 2021-09-15 9:13 pm, David Wright wrote:

As others have pointed out, you can line up hyphens with notes by
setting them as actual lyrics, but bear in mind that real lyric
hyphens have slightly different dimensions from those you insert
by hand. (Real ones are typically longer, thinner, and rounded.)


LSR 1090 [1] is a snippet I wrote to utilize an actual hyphen (or really 
anything you want) from a font in place of simply drawing a rectangle.


[1]: https://lsr.di.unimi.it/LSR/Item?id=1090


-- Aaron Hill



Re: Old style bass clef

2021-09-16 Thread Aaron Hill

On 2021-09-16 4:30 am, Paul Hodges wrote:

That works fine.  I note that it doesn't update the CueClef stencil to
match, but I guess similar code to the Clef update given would suffice
(if felt necessary at all!).

Your correction raises a question in my mind (which may or may not have
helped here): is there anywhere a list of dates of release of the
various stable versions (at least) of LilyPond?  Many old snippets
benefit from, or require, updating because of changes; and when they
don't specify the version used, but have a date, a reference list would
enable us to put in an appropriate version statement so that we could
run an update on the code.


LSR is currently 2.18.2 (last line in [1]).  Knowing that, you can fill 
in the correct \version statement to be able to convert-ly most snippets 
to the latest version.


[1]: https://lsr.di.unimi.it/LSR/html/contributing.html


-- Aaron Hill



Re: percent and bar lines

2021-09-16 Thread Aaron Hill

On 2021-09-16 5:17 am, Niels wrote:

is it possible to use 'repeat percent' including special bar lines?
I tried:

\version "2.20.0"
\score {
  {
  \time 1/4
  \repeat percent 12 { c''4 \bar "!" }
  r4
  \bar "|."
  }
}

In the score the dashed bar line (\bar "!") appears only after the
first note and not after the percent signs. How can I have all bar
lines dashed?


Should be able to play with the default bar line type:


\version "2.20.0"
\score {
  {
  \time 1/4
  \set Timing.defaultBarType = "!"
  \repeat percent 12 { c''4 }
  \unset Timing.defaultBarType
  r4
  \bar "|."
  }
}



-- Aaron Hill



Re: Removing dynamics from PartCombined staff

2021-09-17 Thread Aaron Hill

On 2021-09-17 8:44 am, Peter Toye wrote:

I'm using PartCombine for the first time to produce a piano reduction,
and have found a slight problem. Because the dynamics are a bit
complex I want to remove them from the piano part, but adding \remove
"Dynamic_engraver" to each piano staff has no effect. What am I doing
wrong please?


Not sure what's up with the engraver, but you could filter out events:


noDynamics =
#(define-music-function (music) (ly:music?)
  (define ((is-not type) music)
   (not (music-is-of-type? music type)))
  (music-filter (is-not 'dynamic-event) music))

asdf = { b'4\p b'4\mp b'4\ff b'4\sfz }

{ \asdf \noDynamics \asdf }



-- Aaron Hill



Re: Font

2021-09-23 Thread Aaron Hill

On 2021-09-23 4:34 am, Carlos Martinez wrote:

I am trying to figure out if it is possible to use the font IM FELL
ENGLISH PRO in lilypond. I needed for a title.

When using this \override #'(font-family . Font name?)
I cannot find what is the name of the font….
Where do I find it so I can enter it?


font-family refers to 'roman, 'sans, or 'typewriter, which are the fonts 
specified as part of the font tree.  You can technically define your own 
custom font family in addition to the standard three, but you only need 
to do this if you are using a font in many places and want to ensure 
consistency.  Otherwise, one-off font changes are best done specifying 
the font-name directly:



\version "2.22.0"

\markup \left-column {
  \override #'(font-name . "IM FELL English")
  "IM FELL English, Regular"
  \override #'(font-name . "IM FELL English, Italic")
  "IM FELL English, Italic"
  \override #'(font-name . "IM FELL English SC")
  "IM FELL English SC"

  \override #'(font-name . "IM FELL French Canon")
  "IM FELL French Canon, Regular"
  \override #'(font-name . "IM FELL French Canon, Italic")
  "IM FELL French Canon, Italic"
  \override #'(font-name . "IM FELL French Canon SC")
  "IM FELL French Canon SC"

  \override #'(font-name . "IM FELL Great Primer")
  "IM FELL Great Primer, Regular"
  \override #'(font-name . "IM FELL Great Primer, Italic")
  "IM FELL Great Primer, Italic"
  \override #'(font-name . "IM FELL Great Primer SC")
  "IM FELL Great Primer SC"
}


To your other question, the command-line option -dshow-available-fonts 
(see the usage documentation for details) will output all of the fonts 
LilyPond can see.



-- Aaron Hill

Re: Font

2021-09-23 Thread Aaron Hill

On 2021-09-23 9:52 am, Carlos Martinez wrote:

How do I use this command? Where do I input it?
-dshow-available-fonts


See [1].

[1]: 
http://lilypond.org/doc/v2.22/Documentation/notation/fonts#single-entry-fonts


NOTE: The output will be to "standard error" so if you want to grep it, 
you'll need to redirect:



lilypond -dshow-available-fonts 2>&1 | grep -i "im fell"




Using the code you sent, I pasted it on Lilypond and it did not show
me IM Fell….
I just need it for the title of the piece. So I don’t necessarily need
it for the whole piece.


It could be that your version of the IM FELL family is named 
differently.  I got mine from Google's OFL collection [2].


[2]: https://github.com/google/fonts/tree/main/ofl


-- Aaron Hill



Re: concatenate BarNumber and string (\")?

2021-09-25 Thread Aaron Hill

On 2021-09-25 7:30 am, padovani wrote:

Hi,

I'm working with an algorithmic transcription of some sounds. I'm using 
a

1/4 TimeSignature with custom barlines and would like to concatenate a
seconds quote (") to the BarNumber...

Do you have any tips on how to do that?

It seems that I should deal with BarNumber.stencil, but I'm not getting 
how

to concatenate the printed number to an arbitrary string.

Any suggestions?


grob-transformer on BarNumber.text would be ideal, but that property 
does not support a callback.


You could do the transform yourself either within a stencil callback or 
using before-line-breaking:



asdf = {
  \override Score.BarNumber.break-visibility = #all-visible
  \time 1/4 \repeat unfold 9 b'4
}

{
  \override Score.BarNumber.stencil =
  #(lambda (grob)
(let ((text (ly:grob-property grob 'text)))
 (grob-interpret-markup grob
  #{ \markup \concat { #text "\"" } #})))
  \asdf
}

{
  \override Score.BarNumber.before-line-breaking =
  #(lambda (grob)
(let ((text (ly:grob-property grob 'text)))
 (ly:grob-set-property! grob 'text
  #{ \markup \concat { #text "\"" } #})))
  \asdf
}



-- Aaron Hill



Re: voiceOne and oneVoice

2021-09-30 Thread Aaron Hill

On 2021-09-30 12:36 am, Silvain Dupertuis wrote:

One problem with this suggestion that Lilypond does not support the
simple use of digits in variable names.
As far as I understand, it is because a digit following directly
alphabetic characters is interpreted as a duration.


I think the idea would be that \voice would be itself a music function:


voice = #(define-music-function (n) (index?)
 (context-spec-music (make-voice-props-set (1- n)) 'Voice))

<< { \voice1 b'4 c'' } \\ { \voice2 g'2 } >>



-- Aaron Hill



Re: Horizontal line between hymn verses

2021-10-07 Thread Aaron Hill

On 2021-10-07 5:46 pm, Kira Garvie wrote:

Hello all!
I can't figure out how to get that horizontal line dividing the
spanish from the english verses... any tips?
Thank you!
Kira


Here is an excerpt of what I have done in the past:


\version "2.20.0"

separatorLineBelow = \with {
  \override StanzaNumber.stencil =
  #(grob-transformer 'stencil
(lambda (grob orig)
 (grob-interpret-markup grob
  #{ \markup \overlay { \stencil $orig
 \with-dimensions #'(0 . 0) #'(0 . 0)
 \translate #'(-1 . -1.25)
 \override #'(thickness . 2)
 \draw-line #'(6 . 0)} #} )))
  \override VerticalAxisGroup.nonstaff-nonstaff-spacing =
#'( (basic-distance . 0) (minimum-distance . 4.0)
(padding . 0.0) (stretchability . 0) )
}

\layout { \context { \Lyrics
  \override VerticalAxisGroup.nonstaff-nonstaff-spacing =
#'( (basic-distance . 0) (minimum-distance . 3.5)
(padding . 0.0) (stretchability . 0) )
} }

<< \new Voice = melody \fixed c' { \time 3/4 a4 g b | a2. }
   \new Lyrics \lyricsto melody { \set stanza = "1." Lo -- rem ips -- 
um. }

   \new Lyrics \with \separatorLineBelow
   \lyricsto melody { \set stanza = "2." Lo -- rem ips -- 
um. }
   \new Lyrics \lyricsto melody { \set stanza = "3." Lo -- rem ips -- 
um. }

   \new Lyrics \with \separatorLineBelow
   \lyricsto melody { \set stanza = "4." Lo -- rem ips -- 
um. }
   \new Lyrics \lyricsto melody { \set stanza = "5." Lo -- rem ips -- 
um. }
   \new Lyrics \lyricsto melody { \set stanza = "6." Lo -- rem ips -- 
um. } >>



The principle is simply to hack the StanzaNumber and then increase the 
spacing between two Lyrics lines.



-- Aaron Hill



Re: Change text size within " "?

2021-10-07 Thread Aaron Hill

On 2021-10-07 5:51 pm, Kira Garvie wrote:

Another question...
In the score, the Spanish title is smaller. Is there a way to do that 
in

the header block within the quotation marks?



title = "Blest Be the Tie that Binds / Sagrado es el amor"


Know that each header property supports markup directly:


title = \markup \concat { "Lorem ipsum" " / " \smaller "dolor sit amet" 
}




-- Aaron Hill



Re: Manipulating lyrics with a music function

2021-10-08 Thread Aaron Hill

On 2021-10-08 8:24 pm, David F. wrote:

macOS 10.14.6, Lilypond 2.22.1

The syntax for adding quotes to lyrics is a little cluttered, so I
thought I’d whip up a couple of little helper functions to tidy things
up.  Two hours later I’m reaching out to the mailing list for help.
The example below is failing in two ways.  First, I can’t figure out
how to actually interpolate the syllable that is the input to my
functions into the output.  Second, the hyphen between the first two
syllables is lost.


Your functions could accept the text as markup.  Also, you should 
strongly consider using typographer's quotes, which can be input 
directly as UTF-8 or using character shorthand neither of which requires 
messing about with escaping:



\paper { #(include-special-characters) }
\relative { \time 3/4 e'4 e4. e8 d4 e d c2. }
\addlyrics { &elqq;In -- com -- pa -- ra -- ble,&erqq; said she }

openQuote = #(define-scheme-function (text) (markup?) #{ \markup \concat 
{ “ #text } #})
closeQuote = #(define-scheme-function (text) (markup?) #{ \markup 
\concat { #text ” } #})

\relative { \time 3/4 e'4 e4. e8 d4 e d c2. }
\addlyrics { \openQuote In -- com -- pa --  ra -- \closeQuote ble, said 
she }




-- Aaron Hill



Re: Mandatory dashes in lyrics

2021-10-10 Thread Aaron Hill

On 2021-10-09 7:55 am, Lukas-Fabian Moser wrote:

{
  c'8 8 8
}
\addlyrics {
  En -- tends -- tu
}

but the LyricHyphen between those two words isn't printed if the
syllables are close.


You can force a LyricHyphen to appear:


forceHyphen = \lyricmode {
  \once \override LyricHyphen.minimum-distance = #1.5
}

music = \fixed c' {
  \key f \major \time 3/4
  a2 4 | a4( g) a | c'4( bes) a | a4 g r
}

{ \music } \addlyrics {
  And the white -- robed mar -- tyrs fol -- low,
}
{ \music } \addlyrics {
  And the \forceHyphen white -- robed mar -- tyrs fol -- low,
}


Note that since the -- must appear directly after the text, you will 
need to apply this override before the text.



-- Aaron Hill



Re: Is there a simple way to add a vertical line separator between columns?

2021-10-22 Thread Aaron Hill

On 2021-10-22 10:42 am, Kevin Cole wrote:

The subject line pretty much says it all:

I have two columns of additional verse lyrics to a song following the
score, and I'm wondering if there's a simple way  to add a vertical
line centered between them that is as "tall" as the two columns of
lyrics.

I'm still pretty new to LilyPond, hence the "simple". ;-)


The simplest option is to manually insert a \draw-line command.


\markup \concat {
 \left-column { "Lorem ipsum" "dolor sit amet," }
 \hspace #2 \raise #1 \draw-line #'(0 . -4) \hspace #2
 \left-column { consectetur "adipiscing elit." }
}


If you want something more automated, you could use a custom markup 
command like this:



#(define-markup-command
  (line-between layout props left right)
  (markup? markup?)
  #:properties ((padding 0.5))
  (let* ((left-sten (interpret-markup layout props left))
 (left-yex (ly:stencil-extent left-sten Y))
 (right-sten (interpret-markup layout props right))
 (right-yex (ly:stencil-extent right-sten Y))
 (combined-yex (interval-union left-yex right-yex))
 (offset (car combined-yex))
 (height (interval-length combined-yex)))
   (interpret-markup layout props #{
\markup \concat {
 #left \hspace #padding
 \raise #offset \draw-line #(cons 0 height)
 \hspace #padding #right
} #} )))

\markup
\override #'(padding . 3)
\line-between
 \left-column { "Lorem ipsum" "dolor sit amet," }
 \left-column { consectetur "adipiscing elit." }



-- Aaron Hill



Re: Start, end, gradient of Glissando

2021-10-23 Thread Aaron Hill

On 2021-10-23 5:17 am, Thomas Morley wrote:

Any hints?


normalized-endpoints

Your Y-left and Y-right are the extreme values that have not been 
interpolated using the values from normalized-endpoints.  Borrowing 
logic from Line_spanner::print, here is a modification to your test 
code:



   (normalized-endpoints (ly:grob-property grob 
'normalized-endpoints))

   (Y-length (- Y-right Y-left))
   (normal-Y-left (+ Y-left (* (car normalized-endpoints) 
Y-length)))
   (normal-Y-right (- Y-right (* (- 1 (cdr 
normalized-endpoints)) Y-length)))

   (start-coord
 (cons
   (- X-left grob-relative-coord (- left-padding) (/ thick 
2))

   (+ normal-Y-left left-padding-y)))
   (end-coord
 (cons
   (- X-right grob-relative-coord right-padding (- (/ thick 
2)))

   (- normal-Y-right right-padding-y current-y-coord



-- Aaron Hill



Re: Multiple versions of Lilypond?

2021-10-23 Thread Aaron Hill

On 2021-10-23 3:58 pm, Kira Garvie wrote:

What I was told is that there are some features on the back-end of the
program that turns the Lilypond scores into manipulatable scores for 
the
company that doesn't play well with some of the newer updates to 
Lilypond.
So I can have more than one Lilypond program downloaded, my computer 
won't

care?


The only issues would be if the installer modifies global or shared 
aspects of the OS environment.


On Windows, for instance, only one version of LilyPond can be associated 
with .ly files at a time.  The most recently installed version would 
trump priors, unless you specifically disable file association during 
installation.  If you never double-click .ly files to compile them, then 
none of this matters.  If you do, then you would need to be careful when 
installing other versions to preserve the existing association.  And 
should the association get altered, you would need to manually 
re-associate with the desired version.



-- Aaron Hill



Re: both alternatives have notes which end a phrased slur; how to notate the 2nd alternative?

2021-10-23 Thread Aaron Hill

On 2021-10-23 7:04 pm, Kenneth Wolcott wrote:

Hi;

  I have music which I am engraving that has two alternatives, both
having notes which end a phrasing slur.  I get a warning (warning:
cannot end phrasing slur) about the second phrased slur and, of
course, the phrased slur is not shown in the second alternative.

  I saw in NR that there is a solution when this situation is
encountered with a tie, (\repeatTie) but I do not see a solution for
slurs or phrased slurs.


You could cheat by having a new (phrasing) slur connecting the chords 
between the voltas, playing around with dash-definition or reshaping the 
curve to get the desired effect:



\fixed c'' {
 \key g \major \time 3/4
 \repeat volta 2 { 4.\(  }
 \alternative {
   { 2.\)
 -\tweak dash-definition #'((0.6 1 1 1 )) ^\( }
   { 2.\) }
 }
}

\fixed c'' {
 \key g \major \time 3/4
 \repeat volta 2 { 4.\(  }
 \alternative {
   { 2.\)
 -\shape #'((6 . 0.5) (5 . -0.5) (2 . -1) (0 . 0)) ^\( }
   { 2.\) }
 }
}



-- Aaron Hill



Re: Start, end, gradient of Glissando

2021-10-24 Thread Aaron Hill

On 2021-10-24 6:22 am, Thomas Morley wrote:

Though, how could I have found it myself?
My lack of C++-knowledge hinders me to understand the "logic from
Line_spanner::print". I usually learn things from looking at
scheme-codings.


Not sure it would have been clear without digging into the print 
function.  For reference, here are the relevant lines:



  Interval normalized_endpoints = from_scm (get_property (me, 
"normalized-endpoints"), Interval (0, 1));
  Real y_length = span_points[RIGHT][Y_AXIS] - 
span_points[LEFT][Y_AXIS];


  span_points[LEFT][Y_AXIS] += normalized_endpoints[LEFT] * y_length;
  span_points[RIGHT][Y_AXIS] -= (1 - normalized_endpoints[RIGHT]) * 
y_length;





But there is none in our source using 'normalized-endpoints, apart
from setting it in some grob-definitions.
The description reads: "Represents left and right placement over the
_total_ spanner, where the _width_ of the spanner is normalized
between 0 and 1."
I think the wording is misleading, at least "total" means the unbroken
spanner for me, thus I never considered to look at it for broken
spanners.
The word "width" means the extent in X-axis direction, again no reason
to look at it for extents in Y-axis.


You are right that "width" is talking about the X extent, but "total" 
does not just mean an unbroken spanner but the entire spanner, broken or 
otherwise.  The resulting normalized values are in essence percentages 
of the total width if you were to lay each broken element end-to-end.  
For example, if a spanner is broken into two parts of equal size, then 
you should see normalized-endpoints as the intervals [0, 0.5] and [0.5, 
1].




P.S.
While the Y-values are fixed now, I found some flaw, if left/right
padding is not zero. At least for broken or cross-staff Glissando.
I'll continue research..., unless someone has another hint?


Yup, there's more code in Line_spanner::print that factors in the 
padding values.  It is perhaps harder to locate because the variable was 
named "gaps".  And it turns out there is more than just padding that 
will affect your calculation.  Try setting a stencil in either 
bound-details, as that will also shorten the effective spanner line.  
Arrows, however, seem to overlay on the line without changing its 
length.


Let me take a stab at converting the print routine to Scheme.


-- Aaron Hill



Re: Start, end, gradient of Glissando

2021-10-24 Thread Aaron Hill

On 2021-10-24 8:05 am, Thomas Morley wrote:

Am So., 24. Okt. 2021 um 16:35 Uhr schrieb Aaron Hill

Let me take a stab at converting the print routine to Scheme.


Would be great !!


Sorry for the delay... took me some time to figure out why there was an 
error with cross-staff right-side Y coordinate after porting the logic 
from C++.  I think it's all working as expected, and I have added a few 
new test cases.  (NOTE: I only have 2.22.0 here, so I had to fixup the 
version statement.)  The one thing I did not include was adjusting the 
line ends for the arrows, but I assume the crosses would be best put at 
the arrow points anyway.


There is something to note in the original logic.  If the padding is 
large enough that the line spanner would disappear, then the stencil 
returned is null.  I am also likewise returning the empty list instead 
of a point-pair, so the code that consumes the results would need to 
check for this case.



-- Aaron Hill\version "2.22.0" % "2.23.3"

\paper {
  indent = 0
  ragged-right = ##f
  line-width = 120
}

\layout {
  \context {
\Voice
\override Glissando.layer = 1000
\override Glissando.bound-details.left.padding = 0
\override Glissando.bound-details.right.padding = 0
\override Glissando.breakable = ##t
  }
}

%% cross stensil
#(define*
   (make-cross-stencil coords #:optional (thick 0.1) (sz 0.2))
   (ly:stencil-add
 (make-line-stencil
   thick
   (- (car coords) sz)
   (- (cdr coords) sz)
   (+ (car coords) sz)
   (+ (cdr coords) sz))
 (make-line-stencil
   thick
   (- (car coords) sz)
   (+ (cdr coords) sz)
   (+ (car coords) sz)
   (- (cdr coords) sz

%% glissando stencil
#(define glissando-stencil-proc (lambda (grob) (ly:line-spanner::print grob)))

%% get start/end points
#(define gliss-data
  (lambda (grob)
(let* ((simple-y? (and (ly:grob-property grob 'simple-Y)
   (not (ly:grob-property grob 'cross-staff
   (lbi (ly:grob-property grob 'left-bound-info))
   (rbi (ly:grob-property grob 'right-bound-info))
   (common-x (ly:grob-common-refpoint grob
  (ly:grob-common-refpoint
   (ly:spanner-bound grob LEFT)
   (ly:spanner-bound grob RIGHT) X) X))
   (scaling (magstep (ly:grob-property grob 'font-size 0)))
   (left-padding (ly:assoc-get 'padding lbi 0))
   (left-stencil (ly:assoc-get 'stencil lbi #f))
   (left-common-y (ly:assoc-get 'common-y lbi grob))
   (right-padding (ly:assoc-get 'padding rbi 0))
   (right-stencil (ly:assoc-get 'stencil rbi #f))
   (right-common-y (ly:assoc-get 'common-y rbi grob))
   (common-y (ly:grob-common-refpoint left-common-y right-common-y Y))
   (normalized-endpoints (ly:grob-property grob 'normalized-endpoints '(0 . 
1)))
   (span-left-x (ly:assoc-get 'X lbi 0))
   (span-left-y (ly:assoc-get 'Y lbi 0))
   (span-right-x (ly:assoc-get 'X rbi 0))
   (span-right-y (ly:assoc-get 'Y rbi 0)))
  (if (not simple-y?)
   (begin
(set! span-left-y (+ span-left-y
 (ly:grob-relative-coordinate left-common-y common-y Y)))
(set! span-right-y (+ span-right-y
 (ly:grob-relative-coordinate right-common-y common-y Y)
  (let ((y-length (- span-right-y span-left-y)))
   (set! span-left-y (+ span-left-y
(* (car normalized-endpoints) y-length)))
   (set! span-right-y (- span-right-y
(* (- 1 (cdr normalized-endpoints)) y-length
  (let* ((span-dx (- span-right-x span-left-x))
 (span-dy (- span-right-y span-left-y))
 (span-length (sqrt (+ (* span-dx span-dx) (* span-dy span-dy)
   (if (> (+ left-padding right-padding) span-length) '()
(let* ((grad-dx (/ span-dx span-length))
   (grad-dy (/ span-dy span-length)))
 (set! span-left-x (+ span-left-x (* left-padding scaling grad-dx)))
 (set! span-left-y (+ span-left-y (* left-padding scaling grad-dy)))
 (set! span-right-x (- span-right-x (* right-padding scaling grad-dx)))
 (set! span-right-y (- span-right-y (* right-padding scaling grad-dy)))
 (if (and (ly:stencil? left-stencil)
  (not (ly:stencil-empty? left-stencil)))
  (let ((factor (/ (cdr (ly:stencil-extent left-stencil X)) grad-dx)))
   (set! span-left-x (+ span-left-x (* factor grad-dx)))
   (set! span-left-y (+ span-left-y (* factor grad-dy)
 (if (and (ly:stencil? right-stencil)
  (not (ly:stencil-empty? right-stencil)))
  (let ((factor (/ (car (ly:stencil-extent right-stencil X)) grad-dx)))
   (set! span-right-x (+ span-right-x (* factor grad-dx)))
   (set! span-right-y (+ span-right-y (* factor grad-dy)
 (let* ((dx (ly:grob-relative-coordinate grob common-x X))
(dy (if simple-y? 0 (ly:grob-relative-coordinate grob common-y Y)))
(system (ly:grob-system grob))

Re: Multiple versions of Lilypond?

2021-10-24 Thread Aaron Hill

On 2021-10-24 11:06 am, David Wright wrote:

Perhaps this is one example where drag-and-drop comes into its own,
rather than double-clicking documents. You just drag the LP document
onto the appropriate icon representing a specific version of LP.
Do you know how that is configured, again not disturbing any
preexisting association for one particular version.


Drag-and-drop should ignore file association.  Instead, Windows will 
simply invoke the target program or shortcut, passing the absolute path 
to each source file after any arguments specified within the shortcut.



-- Aaron Hill



Re: Markup with long notes spacing

2021-10-24 Thread Aaron Hill

On 2021-10-24 10:56 am, Erika Pirnes wrote:

I thought "textLenghtOn" would solve my problems but it seemingly just
moves them somewhere else, here the other part (see first measure of
the example). I also tried experimenting with
"SpacingSpanner.base-shortest-duration" but it doesn't solve the
problem and makes the spacing look pretty ridiculous after some point.

Any suggestions?

[...]
tempos = {
\textLengthOn
s2^\atempo
s2^\rit
\textLengthOff
s2^\atempo
s2^\rit
}
[...]


\textLengthOn *should* be the tool for the job.  The first measure, 
however, does not need it as the eighth notes are plenty to keep the two 
texts away from each other.


This seems to fix the second measure, unless I am misunderstanding what 
you need:



tempos = {
s2^\atempo
s2^\rit
\once \textLengthOn s2^\atempo
s2^\rit
}



-- Aaron Hill



Re: Markup with long notes spacing

2021-10-24 Thread Aaron Hill

On 2021-10-24 2:44 pm, Erika Pirnes wrote:

Again, the issue is that using textLengthOn works well with score, but
in the individual parts either the short notes get stretched weirdly
(if I use textLengthOn with those) or markups above long notes are
positioned on top of each other (if I don't use textLengthOn with
those, or sometimes even if I do).


Ah, I see what the problem is now.  A customized version of 
\textLengthOn seems to work:



\version "2.18.2"

rit = \markup {\italic "rit." }
atempo = \markup {\italic "a tempo" }

tempos = {
% Modified logic from \textLengthOn...
% * extra-spacing-width gets a larger right-side value
%   so that \atempo and \rit sit a little further apart.
% * extra-spacing-height is tweaked to minimize impact
%   on the eighth notes spacing while still encouraging
%   TextScripts to sit side-by-side.
\override TextScript.extra-spacing-width = #'(0 . 1.5)
\override TextScript.extra-spacing-height = #'(1 . 1)

% Helps vertically align TextScript baselines, as the
% default allows \rit to sit too close to the staff
% since it does not contain any descenders.
\override TextScript.staff-padding = #1

s2^\atempo
s2^\rit
s2^\atempo
s2^\rit
}

notes = \relative c'{
c2. d8 b
c2. g8 b
}

othernotes = \relative c'{
e8 f g a g2 c2 b
}

\score {
  <<
  \new Staff << \tempos \notes >>
  \new Staff {\othernotes}
  >>
}

\score {
\new Staff << \tempos \notes >>
}

\score {
\new Staff << \tempos \othernotes >>
}



-- Aaron Hill



Re: Sending around contexts

2021-10-28 Thread Aaron Hill

On 2021-10-28 11:27 am, Kieren MacMillan wrote:
2. Maybe even better: Would a Scheme engraver be able to extract (and 
“delete”/omit) *all* dynamics from one context (e.g., the piano_upper 
context) and inject them into a second context (e.g., piano_dynamics)? 
If so, what would be the most elegant way of indicating that a 
single/particular dynamic marking *shouldn’t* be extracted/pushed by 
the engraver?


Not an engraver, but a dispatcher trick could be a first step:


\version "2.22.0"

#(define event-transfer-sink (ly:make-dispatcher))
eventTransferSink = \applyContext
#(lambda (ctxt)
 (ly:connect-dispatchers
  (ly:context-event-source ctxt)
  event-transfer-sink))

#(define event-transfer-source (ly:make-dispatcher))
eventTransferSource =
#(define-music-function (event-type) (symbol?)
  (define (event-proc ev)
   (ly:broadcast event-transfer-sink (ly:event-deep-copy ev)))
  (define (context-proc ctxt)
   (ly:connect-dispatchers
event-transfer-source
(ly:context-events-below ctxt)))
  (ly:add-listener event-proc event-transfer-source event-type)
  #{ \applyContext #context-proc #})

piano_upper = {
  c'4\p d' e' f'
  g'1\mp
  g'4\f f' e' d'
  c'1
}

piano_lower = {
  \clef bass
  c1
  g,1
  g,1
  c1\ff
}

\score {
  <<
\new PianoStaff <<
  \new Staff \with { \eventTransferSource dynamic-event } 
\piano_upper
  \new Dynamics \with { \eventTransferSink } { #(skip-of-length 
piano_upper) }
  \new Staff \with { \eventTransferSource dynamic-event } 
\piano_lower

>>
  >>
}


This duplicates events by necessity, because I do not believe you can 
guarantee that the event transfer process is first to intercept an 
event.  As such, it may have already been processed by another engraver. 
 In the above example, you can \omit DynamicText within the two staves 
and get what looks to be the desired goal, but that would mean losing 
all such grobs in those contexts.



-- Aaron Hill



Re: Sending around contexts

2021-10-28 Thread Aaron Hill

On 2021-10-28 12:25 pm, Aaron Hill wrote:

Not an engraver, but a dispatcher trick could be a first step:


Wait... there's no need to share a source dispatcher... also, that code 
duplicates the listener...



\version "2.22.0"

#(define event-transfer-sink (ly:make-dispatcher))
eventTransferSink = \applyContext
#(lambda (ctxt)
 (ly:connect-dispatchers
  (ly:context-event-source ctxt)
  event-transfer-sink))

eventTransferSource =
#(define-music-function (event-type) (symbol?)
  (define (event-proc ev)
   (ly:broadcast event-transfer-sink (ly:event-deep-copy ev)))
  (define (context-proc ctxt)
   (ly:add-listener event-proc (ly:context-events-below ctxt) 
event-type))

  #{ \applyContext #context-proc #})

piano_upper = {
  c'4\p d' e' f'
  g'1\mp
  g'4\f f' e' d'
  c'1
}

piano_lower = {
  \clef bass
  c1
  g,1
  g,1
  c1\ff
}

\score {
  <<
\new PianoStaff <<
  \new Staff \with {
\eventTransferSource dynamic-event
\omit DynamicText
  } \piano_upper
  \new Dynamics \with { \eventTransferSink } { #(skip-of-length 
piano_upper) }

  \new Staff \with {
\eventTransferSource dynamic-event
\omit DynamicText
  } \piano_lower
>>
  >>
}



-- Aaron Hill



Re: Windows Media Player alternatives for midi playing?

2021-10-30 Thread Aaron Hill
;focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
  },
  "problemMatcher": "$gcc"
},
{
  "label": "LilyPond (PNG)",
  "type": "shell",
  "command": ".vscode/build.sh",
  "args": [
"--png",
"${relativeFile}"
  ],
  "group": "build",
  "presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
  },
  "problemMatcher": "$gcc"
},
{
  "label": "LilyPond (PNG, cropped)",
  "type": "shell",
  "command": ".vscode/build.sh",
  "args": [
"--png-crop",
"${relativeFile}"
  ],
  "group": "build",
  "presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
  },
  "problemMatcher": "$gcc"
},
{
  "label": "LilyPond (SVG)",
  "type": "shell",
  "command": ".vscode/build.sh",
  "args": [
"--svg",
"${relativeFile}"
  ],
  "group": "build",
  "presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
  },
  "problemMatcher": "$gcc"
},
{
  "label": "LilyPond (SVG, cropped)",
  "type": "shell",
  "command": ".vscode/build.sh",
  "args": [
"--svg-crop",
"${relativeFile}"
  ],
  "group": "build",
  "presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
  },
  "problemMatcher": "$gcc"
}
  ]
}



-- Aaron Hill



Re: Windows Media Player alternatives for midi playing?

2021-10-30 Thread Aaron Hill

On 2021-10-30 5:02 pm, Wol wrote:

On 30/10/2021 08:42, Pablo Cordal wrote:
The problem: WMP blocks the midi file while (and after) it's playing, 
so if I modify something in lilypond and I want to hear it, I have to 
close WMP, then compile, go to the folder and reproduce again.. and 
I'm composing so I do it a LOT of times.


Except that's NOT the problem. The problem is that WINDOWS locks the
file against writing if anything else has it open. You need to get WMP
to drop the file.


Only if you instruct Windows to do so.  See [1] where you may call 
CreateFile with GENERIC_READ and FILE_SHARE_WRITE.  (In practice, you 
probably want the trifecta of FILE_SHARE_READ | FILE_SHARE_WRITE | 
FILE_SHARE_DELETE to be most permissive.)


[1]: 
https://docs.microsoft.com/en-us/windows/win32/fileio/creating-and-opening-files




I have exactly the same problem with Acrobat Reader - if I'm viewing a
score I can't run lilypond until I close Acrobat, otherwise it just
fails on me because it can't overwrite the pdf.


I run SumatraPDF which is able to display a PDF without causing Lilypond 
to fail to write to the file at a later time.  In fact, it is also able 
to detect such changes and redisplay its contents.  None of this is 
special to Sumatra though, so there could be other PDF viewers that are 
similarly well-behaved.


One of the main issues with proprietary software is that we cannot 
review or audit Adobe's programming decisions.  They very well may have 
a good reason to hold onto file handles that block writing, but such a 
reason will be a mystery.


NOTE: I just discovered that WMP no longer blocks file I/O like it used 
to.  Not sure when the behavior changed, but it seems that I can keep 
WMP open and regenerate the MIDI file.  I am running 20H2/19042.1288 for 
reference.



-- Aaron Hill



Re: Markup functions and punctuation in lyrics

2021-11-02 Thread Aaron Hill

On 2021-11-02 8:23 am, R. Padraic Springuel wrote:

On Oct 31, 2021, at 6:02 PM, David Kastrup  wrote:

If the ugliness of juxtaposition is ok, you may use things like

\,\man

for concatenating stuff, too.


Not sure if this was already suggested, but could you use something like 
this to concatenate arbitrary markup?



"\+" =
#(define-scheme-function
  (first second) (markup? markup?)
  #{ \markup \concat { #first #second } #})

foo =
#(let ((idx 0))
  (define (inc) (set! idx (1+ idx)) idx)
  (define-scheme-function () ()
   #{ \markup $(format #f "~r" (inc)) #}))

{ b'4 4 4 4 }
\addlyrics { \+ \foo , \+ \foo , and \+ \foo ! }



-- Aaron Hill



Re: Markup functions and punctuation in lyrics

2021-11-02 Thread Aaron Hill

On 2021-11-02 2:56 pm, R. Padraic Springuel wrote:
On Nov 2, 2021, at 1:00 PM, Aaron Hill  
wrote:


Not sure if this was already suggested, but could you use something 
like this to concatenate arbitrary markup?


I think that what you’re suggesting is in the spirit of what David was
suggesting, but I’m trying to reduce the input overhead at this point
and feel like what you propose increases it slightly.


Okay, would text replacement be viable as opposed to writing a bunch of 
individual functions?



feminine =
#'(("man/woman" . "woman")
   ("his/her" . "her")
   ("he/she" . "she"))

\markup \replace \feminine {
  The man/woman, tightly clutching his/her jacket, braved the
  bitter cold as he/she searched for his/her missing dog.
}


Note that you can install such text replacements at the global level to 
affect all markup without needing the explicit call to \replace:



neutral =
#'(("man/woman" . "person")
   ("his/her" . "their")
   ("he/she" . "they"))

\paper { #(add-text-replacements! neutral) }

\markup {
  The man/woman, tightly clutching his/her jacket, braved the
  bitter cold as he/she searched for his/her missing dog.
}



-- Aaron Hill



Re: Growing beam position

2021-11-03 Thread Aaron Hill

On 2021-11-03 11:27 am, Paolo Prete wrote:

Hello,

is there a way to *automatically* have a growing beam on 32th notes 
with a

horizontal middle line?

Currently I do that by tweaking Beam.positions (see below), but I 
wonder if

is there a way to avoid this trial-and-error procedure:

Thanks!
P

%%%
\version "2.22.0"
{
  \override Beam.grow-direction = #RIGHT
  \override Beam.positions = #'(0 . 0.8)
  { c32[ d e f] }
}
%%%


I think this is right:


{
  \override Beam.positions =
  #(grob-transformer 'positions
(lambda (grob orig)
 (let* ((dir (ly:grob-property grob 'direction))
(grow (ly:grob-property grob 'grow-direction))
(cnt (length (ly:grob-property grob 'beam-segments)))
(th (ly:grob-property grob 'beam-thickness))
(iv (if (interval-sane? orig) orig
(reverse-interval orig)))
(pos1 (interval-index iv dir))
(pos2 (- pos1 (* 0.5 dir (- cnt 1 th)
  (if (> 0 grow) (cons pos1 pos2) (cons pos2 pos1)

  \override Beam.grow-direction = #RIGHT
  e'32[ f' g' a']
  c''64[ d'' e'' f'']
  \override Beam.grow-direction = #LEFT
  b'128[ a' g' f']
}


-- Aaron Hill



Re: Growing beam position

2021-11-03 Thread Aaron Hill

On 2021-11-03 4:45 pm, Paolo Prete wrote:

Hello Aaron,

what if I enlarge the beam angle? (see below)


Okay, my guesswork was wrong.  Here is code that was adapted from the 
underlying C++ logic:



\version "2.22.0"

#(define (ly:stem::beam-multiplicity grob)
  ;; Adapted from non-exported C++ method
  (define (slice lst)
   (let ((ints (filter integer? (or lst '()
(if (null? ints) (cons 1 -1)
 (cons (apply min ints) (apply max ints)
  (let ((beaming (ly:grob-property grob 'beaming)))
   (interval-union (slice (car beaming)) (slice (cdr beaming)

#(define (ly:beam::get-beam-count grob)
  ;; Adapted from non-exported C++ method
  (apply max
   (map
(lambda (stem)
 (1+ (interval-length (ly:stem::beam-multiplicity stem
(ly:grob-array->list (ly:grob-object grob 'stems)

#(define (ly:beam::get-beam-translation grob)
  ;; Adapted from non-exported C++ method
  (let* ((beam-count (ly:beam::get-beam-count grob))
 (staff-space (ly:staff-symbol-staff-space grob))
 (line-thickness (ly:staff-symbol-line-thickness grob))
 (beam-thickness (* (ly:grob-property grob 'beam-thickness)
staff-space))
 (length-fraction (ly:grob-property grob 'length-fraction 1))
 (scalar (if (< beam-count 4) 2 3)))
   (- (* length-fraction (+ staff-space (/ line-thickness scalar)))
  (/ beam-thickness scalar

alignGrowingBeams =
\override Beam.positions =
#(grob-transformer 'positions (lambda (grob orig)
  (let* ((beam-translation (ly:beam::get-beam-translation grob))
 (beam-count (ly:beam::get-beam-count grob))
 (staff-space (ly:staff-symbol-staff-space grob))
 (height (/ (* (1- beam-count) beam-translation) staff-space))
 (direction (ly:grob-property grob 'direction))
 (grow-right? (< 0 (ly:grob-property grob 'grow-direction)))
 (interval (if (interval-sane? orig) orig
   (reverse-interval orig)))
 (far (interval-index interval direction))
 (near (- far (* 0.5 direction height
   (if grow-right? (cons near far) (cons far near)

beamTest = {
  \override Beam.grow-direction = #RIGHT
  e'32[ f' g' a']
  c''64[ d'' e'' f'']
  \override Beam.grow-direction = #LEFT
  b'128[ a' g' f']
}

beamTests = {
  \beamTest
  \override Beam.length-fraction = #1.6
  \beamTest
  \override Beam.beam-thickness = #0.8
  \beamTest
}

{ \alignGrowingBeams \beamTests }
{ \magnifyStaff #0.6 \alignGrowingBeams \beamTests }



-- Aaron Hill

<    1   2   3   4   5   6   7   8   9   10   >