Re: DIfferent note values within a chord

2024-05-21 Thread Aaron Hill

On 2024-05-21 6:55 am, Xavier Scheuer wrote:

\relative c' {
\key bes \major
\stemDown
<\tweak duration-log 2 bes bes' f'>2\f
  <\tweak duration-log 2 bes' f' d'>2 |
<\tweak duration-log 2 c, a' c>2\fermata
}


It is interesting how we interpreted the clef and key signature 
differently when trying to recreate the image.  You did manage to the 
squeeze in the forte, which I did not.



-- Aaron Hill



Re: DIfferent note values within a chord

2024-05-21 Thread Aaron Hill

On 2024-05-21 6:40 am, Jun Tamura wrote:

Hello,

Could someone give me a pointer for this?

This is a quite popular notation for bowed string instruments. I’m 
almost certain that I saw a way to achieve this before but could not 
find it this time.



What you typically do is \tweak the duration-log property of the 
notehead you want to change.  In the example you provided, begin with 
all notes simply as half-notes.  The only notehead you need to adjust 
will be the low one.



\version "2.25.13"

{
  \clef bass \omit Staff.Clef
  \omit Staff.TimeSignature
  \stemDown

  <\tweak duration-log 2 d, d a>2
  <\tweak duration-log 2 d a f'>2
  <\tweak duration-log 2 e, c e>2 \fermata
}




-- Aaron Hill



Re: Cry for help - lost plot ....

2024-05-18 Thread Aaron Hill

On 2024-05-18 8:49 am, Giles Boardman wrote:

\score {

… music …

  \layout { }
  \midi { }
}

Please, someone help me while I still have a little hair left to pull 
out on a later occasion :-}



\score basically expects just one "music".  You are providing many 
"musics".  The question is how you want to handle it.


Normally, we have simultaneous music where the parts are meant to run in 
parallel.  But you can also do sequential music.


So, this means your \score block should have one of these two patterns:


\score {
  <<
...simultaneous music...
  >>

  \layout { }
  \midi { }
}

\score {
  {
...sequential music...
  }

  \layout { }
  \midi { }
}



-- Aaron Hill



Re: Problems hiding clef using \omit

2024-05-17 Thread Aaron Hill

On 2024-05-17 10:15 am, kie...@kierenmacmillan.info wrote:

Hi Dirck,

I don't know what the term is for this "8", so i was not successful 
searching the manuals and snippets.


ClefModifier
<https://lilypond.org/doc/v2.25/Documentation/internals/clefmodifier>



Also if you need help with identifying grobs, the visual index [1] 
should be your first place to check.


[1]: 
https://lilypond.org/doc/v2.25/Documentation/ly-examples/visualindex.pdf



-- Aaron Hill



Re: \omit TupletBracket

2024-05-16 Thread Aaron Hill

On 2024-05-16 7:54 pm, carsonm...@ca.rr.com wrote:

Aaron,

Thank you for the instruction yet how does it apply to my notation?



It is simply a fairly common mistake we see post on the mailing list.

For instance, new users are often tempted to put the square brackets 
*around* the notes:


  [c16 r 8]

This does not associate the beaming start with the c16.  Since [ is a 
post-event, it must look like this:


  c16[ r 8]


-- Aaron Hill



Re: \omit TupletBracket

2024-05-16 Thread Aaron Hill

On 2024-05-16 5:57 pm, carsonm...@ca.rr.com wrote:

  c16 [r c8]


It is important to understand that the syntax for beaming, like slurs, 
requires the symbols to be post-fixed.


As such it is best to keep the symbols snug to the event they apply:

  c16[ r c8]

To a seasoned LilyPonder, this clearly indicates beaming beginning with 
the 16th note and ending with the 8th.



-- Aaron Hill



Re: Rehearsal mark on right side of measure?

2024-05-05 Thread Aaron Hill

On 2024-05-05 6:49 pm, Dirck Nagy wrote:

Hi all

I am using rehearsal marks (\mark \default,  to mark off repeated 
sections as  "A", "B", etc.,  instead of Dal Segno.


One of these sections ends at the end of a line.  Is there an easy way 
to move the rehearsal mark to the right side of the measure, instead of 
the left?  I can't find a command that works.


Or should I be using markup commands instead?



No, \mark for RehearsalMarks is perfectly fine.  What you need to do is 
firstly ensure the \mark command is located at the correct moment in the 
music--it sounds like you are putting the \mark at the beginning of a 
measure when it should appear at the next bar line--and then ensure its 
break-visibility is set appropriately so the mark appears on the correct 
line.  Consider:



\version "2.25.13"

{
  \repeat unfold 3 { b'4 4 2 }
  \tweak break-visibility #end-of-line-visible
  \tweak self-alignment-X #RIGHT
  \mark \default \break
  \repeat unfold 3 { b'4 4 2 } 1 \fine
}



-- Aaron Hill

Re: Tunable Context Properties

2024-05-04 Thread Aaron Hill

On 2024-05-04 8:06 am, Fr. Samuel Springuel wrote:
1) Can I establish that shortVocalName should default to vocalName at 
the top level of the file (effectively placing it where I can transport 
it over to my format file)?



Yes, you do something like this:


\version "2.24.3"

\layout {
  \context {
\Lyrics
\override InstrumentName.stencil =
  #(lambda (grob)
;; Use long-text for text, as needed.
(or (markup? (ly:grob-property grob 'text))
  (ly:grob-set-property! grob 'text
(ly:grob-property grob 'long-text)))
(system-start-text::print grob))
  }
}


If vocalName is set but not shortVocalName, then the value of vocalName 
(long-text) is copied into the shortVocalName (text).  This gives you 
some flexibility as you can define them independently as needed.



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



I would use more helper functions to automate things.  Consider:


\version "2.24.3"

\layout {
  \context {
\Lyrics
\override InstrumentName.self-alignment-X = #RIGHT
  }
}

stanza =
#(define-scheme-function (stanza) (markup?)
  (let ((markup #{ \markup \italic #stanza #}))
#{ \with { vocalName = #markup shortVocalName = #markup } #}))

autoStanza =
#(let ((ctr 0))
  (define-scheme-function (fmt) ((string? "~d."))
(set! ctr (1+ ctr))
#{ \stanza #(format #f fmt ctr) #}))

\layout { ragged-right = ##t }

music = \relative { f' g a c | \break c a g f | \break f e d c }
verseI = \lyricmode { \repeat unfold 12 a }
verseII = \lyricmode { \repeat unfold 12 b }
verseIII = \lyricmode { \repeat unfold 12 c }
verseIV = \lyricmode { \repeat unfold 12 d }

\new Staff
<<
  \new Voice = "mel" { \music }
  \new Lyrics \with \autoStanza \default \lyricsto "mel" { \verseI }
  \new Lyrics \with \autoStanza "~@(~:r.~)" \lyricsto "mel" { \verseII }
  \new Lyrics \with \autoStanza "~@r." \lyricsto "mel" { \verseIII }
  \new Lyrics \with \autoStanza "~(~:@r.~)" \lyricsto "mel" { \verseIV }





Note above that \stanza takes care of setting both vocalName and 
shortVocalName to the same markup, so the stencil override I showed is 
not necessary.  I am also doing the work within the \with block for each 
Lyrics context rather than \setting.  You could modify this logic to use 
\set instead if you needed to change the vocalName/shortVocalName.  
You'd need to use define-music-function rather than 
define-scheme-function.


The \autoStanza takes care of the counter logic, although it only 
supports one global counter.  For most scores, this is probably 
sufficient.  The formatting string gives you some customization options 
based on the formatted printing facility within Scheme.  If you used 
this a lot, it probably make sense to define the format strings with 
sensible naming:



ordinal = "~@(~:r.~)"
newRomanUpper = "~@r."
oldRomanLower = "~(~:@r.~)"
%% . . .

  \new Lyrics \with \autoStanza \oldRomanLower \lyricsto "mel" { ... }



In fact, you could take automation even further to reduce typing:


lyricsWithAutoStanzaOrdinal =
#(define-music-function (lyrics) (ly:music?)
  #{ \new Lyrics \with \autoStanza \ordinal \lyricsto mel $lyrics #})
%% . . .

  \lyricsWithAutoStanzaOrdinal \verseII




-- Aaron Hill



Re: parenthesis around dot only (note value indication)

2024-05-01 Thread Aaron Hill

On 2024-05-01 12:18 am, David Kastrup wrote:

{
  \tweak Dots.extra-spacing-width #'(.2 . .2)
  4.
}

Wish I could get the actual dots to move, but maybe someone else has an
idea for that.



Looks like the DotColumn is controlling things.  This seems to work:


{
  \once \override Staff.DotColumn.padding = #1
  4.
}



-- Aaron Hill



Re: Transparent box around notes

2024-04-30 Thread Aaron Hill

On 2024-04-30 5:30 pm, David Nalesnik wrote:
 What LilyPond version is the LSR currently running?  (I'm wondering if 
you

are able to use the revised add-grob-definition there.)



This is documented on the Contributing page [1].

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

LSR appears to be running 2.24.x at the moment.


-- Aaron Hill



Re: Issue with durations and roman numeral analysis tool

2024-04-30 Thread Aaron Hill

On 2024-04-30 4:54 pm, Joseph Srednicki wrote:

Hello:
I am having difficulty with durations and the roman numeral analysis 
tool roman_numeral_analysis_tool.ily, which I downloaded from GitHub - 
lyp-packages/roman-numerals: LilyPond typesetter for Roman numeral 
harmonic analysis

See the tiny example below.
In this example, I have used beat durations in the analysis section of 
the source code. 
Based on the input, I expect the vi 6 4 to appear beneath the final 
sixteenth note of the second beat of the measure. However, the vi 6 4 
appears under the first note of the third beat in the measure.

Can anyone please help detect the error that I am making?
Thanks for your help.
Joe Srednicki
-
\version "2.24.0"\language "english"% Change the following line to the 
path of the roman numeral analysis tool on your computer\include 
"C:/docs/frescobaldi/roman_num/roman_numeral_analysis_tool.ily"

global = {  \key ef \major  \time 3/4}
right = \relative c'' {  \global   r4 r2}
leftOne = \relative c'' {  \global \clef treble  r4 g8. af16 f8.\prall 
e32 f  }
leftTwo = \relative c' {  \global  r4 bf8. c16 af8._\prall g32 af | % 
1}

pedal = \relative c {  \global  \clef bass  ef,4 ef' bf | % 1}
analysis = \lyricmode {  \override LyricText.self-alignment-X = #-0.6  
\offset StanzaNumber.X-offset #-3  \set stanza  = \markup{E \flat:}  
\skip 4 \markup \rN { I }8. \markup \rN { vi 6 4 }16 % 1}
\score {  <<    \new PianoStaff <<      \new Staff = "right" \right    
  \new Staff = "left" { \clef bass << \leftOne \\ \leftTwo >> }    >>  
  \context Staff = "pedal"    <<      \context Voice = pedal { << 
\pedal >> }      \new Lyrics \with {      } \lyricsto "pedal" { 
\analysis }    >>  >>}



It appears you are using \lyricsto which ignores the durations specified 
and instead associates each syllable with a note in the named voice.  
You should just reference the lyrics variable directly:  \new Lyrics { 
\analysis }



-- Aaron Hill



Re: Fw: Frescobaldi ... panic alternatives?

2024-04-30 Thread Aaron Hill

On 2024-04-30 10:05 am, Karlin High wrote:

On 4/30/2024 10:25 AM, Jennifer Doering wrote:
What happened to the Frescobaldi dev? Just doesn't have time to 
maintain it anymore?


Link to past discussion:

<https://lists.gnu.org/archive/html/lilypond-user/2022-11/msg00131.html>

His software development activity appears reduced after a health crisis 
in 2021.



Can relate to that.  Had open heart surgery myself last year and still 
recovering, in and out of hospital.  Wishing all the best to him and his 
family.



-- Aaron Hill



Re: Conditional markup? UP|DOWN

2024-04-29 Thread Aaron Hill

On 2024-04-29 7:50 am, Pierre-Luc Gauthier wrote:

Can a markup command introspect its direction ?

Is it possible to set in a markup command some conditionals (not paper
related) ?

\version "2.25.15"

#(define-markup-command (conditionalMrkp layout props)
   ()
   (interpret-markup layout props #{
 \markup {
   %\if #DOWN
   "↑"
   %\if #UP
   "↓"
 }#}))

{b'^\markup \conditionalMrkp b'_\markup \conditionalMrkp}




\version "2.24.3"

is-directional =
#(lambda (layout props)
  (number? (chain-assoc-get 'direction props #f)))

is-upward =
#(lambda (layout props)
  (eq? UP (chain-assoc-get 'direction props #f)))

is-downward =
#(lambda (layout props)
  (eq? DOWN (chain-assoc-get 'direction props #f)))

asdf = \markup \circle \overlay {
  \if \is-upward ↑ \if \is-downward ↓
  \unless \is-directional \pad-around #0.25 *
}

\layout { indent = 0 }
\asdf
{ b'4-\asdf 4_\asdf 2^\asdf }



-- Aaron Hill

Re: Note names are causing text marks to be duplicated

2024-04-26 Thread Aaron Hill

On 2024-04-26 7:44 am, Eric Benson wrote:
I see. How hard would it be to write a Scheme function that would copy 
a
melody variable and remove the text marks, or in fact everything other 
than
the note values, which are all I want in the NoteNames variable? That 
would

be preferable to entering a separate sequence containing only the text
marks in my application.



\tagging your \textMarks would let you apply them only where you intend:


\version "2.24.3"

textMark = \tag textMark \textMark \etc
withTextMarks = \keepWithTag textMark \etc
withoutTextMarks = \removeWithTag textMark \etc

melody = { b'4 4 \textMark "Hey!" 2 }

<< \withTextMarks \melody \\ \withoutTextMarks \melody >>



-- Aaron Hill



Re: Note names are causing text marks to be duplicated

2024-04-25 Thread Aaron Hill

On 2024-04-25 9:43 pm, Eric Benson wrote:
I took one of the NoteName examples from the documentation and dropped 
a
\textMark in the middle of it, and there is an extra copy of that text 
mark

for each NoteName staff.



This makes sense, since the \textMark command is within the \melody 
music variable, which gets used three times.  The same behavior occurs 
without NoteNames:



\version "2.24.3"

melody = { b'4 4 \textMark Hey 2 }

<< \melody \\ \melody >>



-- Aaron Hill



Re: Lyrics and Barchecks

2024-04-25 Thread Aaron Hill
It is known (and documented) that bar checks need to be used with care 
within Lyrics contexts.  I was thinking about this problem and wondered 
if a custom engraver would be able to assist.  (The actual bar checks 
are implemented in an iterator, presumably because it results in faster 
processing when skipping typesetting.)  At this time, I am not sure if 
custom iterators can be created within Scheme, so consider this just a 
proof-of-concept using a Scheme engraver.


It would seem that for the case of lyrics, the behavior of a so-called 
"lyric bar check" would be less precise than that of the normal bar 
check.  Instead of requiring the bar check to occur only at the first 
moment of a measure, the logic instead simply checks that no lyrics have 
been created from the beginning of the measure to the time of the lyric 
bar check.  That is to say, the lyric bar check should be the first 
"thing" that occurs in a measure when it appears.


Attached is the proof-of-concept code.

NOTE: The final lyric bar check intentionally is an example of a failing 
case.  Here is the expected compiled output:



lyric-bar-check.ly:64:54: warning: lyric bar check failed
\addlyrics { | lo -- rem | ips -- um | do -- lor sit
 | a -- met }


Also NOTE: The code includes a toplevel-music-function that converts 
normal bar checks that occur within Lyrics contexts into lyric bar 
checks that the custom engraver handles.  This was done so that the user 
could input lyric bar checks using the same symbol as for normal music 
but get the unique behavior.  Not sure if this transparent approach is 
best, as it could be seen as surprising to some users.



-- Aaron Hill\version "2.25.13"

#(define-event-class 'lyric-bar-check 'music-event)
#(define custom-music-descriptions
  `((LyricBarCheck
  . ((description . "Check whether lyrics correlate with
 the start of the measure.")
 (types . (lyric-bar-check event))

#(set!
  custom-music-descriptions
  (map (lambda (x)
(set-object-property! (car x)
  'music-description
  (cdr (assq 'description (cdr x
(let ((lst (cdr x)))
  (set! lst (assoc-set! lst 'name (car x)))
  (set! lst (assq-remove! lst 'description))
  (hashq-set! music-name-to-property-table (car x) lst)
  (cons (car x) lst)))
  custom-music-descriptions))
#(set! music-descriptions
  (sort
(append music-descriptions custom-music-descriptions)
alist

Re: Highlighting lyric words

2024-04-24 Thread Aaron Hill

On 2024-04-24 4:05 pm, Walt North wrote:
Thanks, that's close enough to what I wanted.  I was originally for 
yellow background with back letters... but red (or other bright) font 
will suffice.



Here is an (over-engineered and probably bug-ridden) approach:


\version "2.25.13"

#(define-markup-command
  (highlight layout props arg) (markup?)
  #:category other
  #:properties ((blot 0.2)
(color yellow)
(padding 0.2))
  (let* ((stencil (interpret-markup layout props arg))
 (strut (interpret-markup layout props
  #{ \markup qxb #}))
 (x-extent (ly:stencil-extent stencil X))
 (y-extent (interval-union
 (ly:stencil-extent stencil Y)
 (ly:stencil-extent strut Y)))
 (x-extent-wide (interval-widen x-extent padding))
 (y-extent-wide (interval-widen y-extent padding)))
(interpret-markup layout props #{
  \markup \combine
\with-color #color
  \with-dimensions #x-extent #y-extent
  \filled-box #x-extent-wide #y-extent-wide #blot
\stencil #stencil
#})))

#(define (highlighter blot color padding)
  (grob-transformer 'stencil
(lambda (grob orig)
  (grob-interpret-markup grob #{
\markup
  \override #`(blot . ,blot)
  \override #`(color . ,color)
  \override #`(padding . ,padding)
  \highlight \stencil #orig
  #}

\markup {
  \pad-around #1
  \override #'(blot . 1.5)
  \override #`(color . ,(x11-color 'orange))
  \override #'(padding . 0.5)
  \highlight \line { \bold lorem \italic ipsum }
}

myHighlight = \override LyricText.stencil =
  #(highlighter 0.6 (x11-color 'cornflowerblue) 0.1)

\paper { indent = 0 }
{ \repeat unfold 3 { b'4 4 2 } }
\addlyrics {
  no high -- light
  \myHighlight high --
  \tweak font-family #'sans
  \tweak font-series #'bold
  light -- er
  \undo \myHighlight none
  \once \myHighlight once
  done
}



-- Aaron Hill

Re: String pressure notation

2024-04-16 Thread Aaron Hill

On 2024-04-14 8:45 pm, Richard Davis wrote:

In my head, whatever implementation this requires would somehow
"collect" these levels and generate the final shape as
necessary. However, I don't know nearly enough scheme to even know 
where

to begin on this. The reddit contributor to the original did suggest
using DynamicLineSpanners may be more productive, but I also don't 
quite

understand how to go about that.

I apologize for the lengthy question; I hope it makes sense. Any help
would be greatly appreciated!



Whew.  I'm nowhere as good as folks like Harm when it comes to this 
custom engraver stuff, but I think I got something useable.


Firstly, the syntax is pretty close to what Richard requested:


{ b'4 \startBowPressure 1 4 \bowPressure 2 2 \stopBowPressure 0 \fine }


The pressure values probably should be strictly in [0, 1], but I opted 
to take the value literally when generating the polygon shape.  If you 
want to stick to "normal" values, then the engraver probably needs to 
support a customizable height parameter for scaling the resulting 
indicators, particularly if this scaling were in staff-space units.


There is a hard-coded padding value that I used to help keep the 
beginning and ends of the indicator from clashing with one another.  
Along with this value, there are a number of properties that \polygon 
supports that could be exposed to the user.  For instance, a user might 
want an unfilled shape, optionally with vertical lines at the transition 
points.


One thing I got lucky with was that \tweaking the color of ink worked 
automatically.  You can see this in the attached demonstration.  The 
version with line breaks was done in \markup with \score-lines because I 
wanted to better see the relationship between the broken spanners.  One 
improvement I could see is trying to estimate what fraction between 
pressures should be used at the boundaries.  Currently, I just use the 
midpoint, which does result in different slopes.  But I think it is a 
reasonable trade-off.


I originally started building this against 2.25.13.  With a little work 
to address a missing function, I have the demonstration running on 
stable 2.24.3.  To go back to 2.22.x would require more work, but I 
think it is good enough to ensure stable works.


P.S. I am running a little bit low on sleep, so I expect there are 
coding mistakes and/or inefficiencies.  My apologies.



-- Aaron Hill\version "2.24.3"

%%
%% Bow_pressure_engraver

#(define-event-class 'bow-pressure-event 'span-event)

#(define custom-music-descriptions `(
  (BowPressureEvent .
   ((description . "Start/change/stop a bow pressure span.")
(types . (post-event span-event event bow-pressure-event))
  ))
))

#(begin
  ;; NOTE: Code sourced from define-music-types.scm
  (set!
custom-music-descriptions
(map (lambda (x)
   (set-object-property! (car x)
 'music-description
 (cdr (assq 'description (cdr x
   (let ((lst (cdr x)))
 (set! lst (assoc-set! lst 'name (car x)))
 (set! lst (assq-remove! lst 'description))
 (hashq-set! music-name-to-property-table (car x) lst)
 (cons (car x) lst)))
  custom-music-descriptions))

  (set! music-descriptions
(sort (append music-descriptions custom-music-descriptions) alist

bow-pressure.pdf
Description: Adobe PDF document


Re: String pressure notation

2024-04-16 Thread Aaron Hill

On 2024-04-16 12:46 pm, Dimitri Sykias wrote:

Is it possible to make the text italic?
I tried  \tweak text \italic “x” and it didn’t work.



You need to specify \markup:


  \tweak text \markup \italic x



-- Aaron Hill



Re: String pressure notation

2024-04-16 Thread Aaron Hill

On 2024-04-16 4:03 am, Aaron Hill wrote:

On 2024-04-16 3:59 am, Aaron Hill wrote:
What you are looking for, however, can be done with 
horizontal/analysis brackets:



\version "2.25.13"

\new Voice
\with { \consists Horizontal_bracket_engraver }
{
  b'4
  -\tweak layer 0
  -\tweak direction #UP
  -\tweak bracket-flare #'(0 . 0)
  -\tweak HorizontalBracketText.Y-offset -0.5
  -\tweak HorizontalBracketText.text
\markup \whiteout \pad-around #0.5 "9\""
  -\startGroup 4 2\stopGroup
}



Oh, and if you need the brackets to align to the measures and not 
notes, then the Measure_spanner_engraver is what you probably want.



Sorry for the extra noise.  I meant to include an example snippet in my 
earlier mail.



\version "2.25.13"

\new Voice
\with { \consists Measure_spanner_engraver }
{
  \tweak spacing-pair #'(time-signature . staff-bar)
  \tweak text "9\""
  \startMeasureSpanner
  b'4 4 2
  \stopMeasureSpanner
}



-- Aaron Hill

Re: String pressure notation

2024-04-16 Thread Aaron Hill

On 2024-04-16 3:59 am, Aaron Hill wrote:
What you are looking for, however, can be done with horizontal/analysis 
brackets:



\version "2.25.13"

\new Voice
\with { \consists Horizontal_bracket_engraver }
{
  b'4
  -\tweak layer 0
  -\tweak direction #UP
  -\tweak bracket-flare #'(0 . 0)
  -\tweak HorizontalBracketText.Y-offset -0.5
  -\tweak HorizontalBracketText.text
\markup \whiteout \pad-around #0.5 "9\""
  -\startGroup 4 2\stopGroup
}



Oh, and if you need the brackets to align to the measures and not notes, 
then the Measure_spanner_engraver is what you probably want.



-- Aaron Hill



Re: String pressure notation

2024-04-16 Thread Aaron Hill

On 2024-04-16 3:41 am, Archer Endrich wrote:

Hello Richard,

Your bow-pressure graphic looks great, and I hope your question about 
horizontal proportions can be answered soon.


Another feature of your illustration is relevant to my wish list:  the 
downward-pointing brackets with 9" in the middle.  I've been trying to 
find a way to do this for some time.  Could you forward the code for 
this feature?  Perhaps it is just something basic that I've missed.



I believe you misunderstood.  The picture provided was an external 
reference, not LilyPond output.  (It's easy to spot because the treble 
clef is leaning as if it would fall to the right.  Most non-LilyPond 
fonts have this flaw.)  The point of the attached image was to provide a 
visual example of the desired feature, not that such feature is 
implemented in LilyPond yet.




What you are looking for, however, can be done with horizontal/analysis 
brackets:



\version "2.25.13"

\new Voice
\with { \consists Horizontal_bracket_engraver }
{
  b'4
  -\tweak layer 0
  -\tweak direction #UP
  -\tweak bracket-flare #'(0 . 0)
  -\tweak HorizontalBracketText.Y-offset -0.5
  -\tweak HorizontalBracketText.text
\markup \whiteout \pad-around #0.5 "9\""
  -\startGroup 4 2\stopGroup
}



-- Aaron Hill

Re: String pressure notation

2024-04-15 Thread Aaron Hill

On 2024-04-14 8:45 pm, Richard Davis wrote:
Ideally I'd want to be able to anchor specific levels along this 
spanner

to rhythmic events, perhaps by specifying "levels" of pressure like so:

{
  c4\startBowSpan 0.0 c4\pressure 1.0 c4\pressure 0.5 c4\stopBowSpan 
0.0

}

In my head, whatever implementation this requires would somehow
"collect" these levels and generate the final shape as
necessary. However, I don't know nearly enough scheme to even know 
where

to begin on this. The reddit contributor to the original did suggest
using DynamicLineSpanners may be more productive, but I also don't 
quite

understand how to go about that.



Hi, Richard.  I was the one helping you on Reddit.  I think the best 
option is to create a custom grob and engraver for this type of 
notation.  In fact, a more generalized continuous controller notation 
(with MIDI output) would be ideal, and bow pressure could just be one 
special form.  I started investigating going down this path, but I ran 
into some time constraints due to some personal health issues.  But I 
know there are several folks on the mailing list that have experience 
with creating custom grobs and engravers.  If they have the availability 
and interest, I am sure they can help get you to a better working 
solution than the one I threw together.


By the by, my comment about the DynamicLineSpanner was because I 
consider this type of notation to be akin to any other standard dynamics 
indication.  One would probably want all of these pressure indicators to 
vertically line up with each other, so I was thinking the Dynamics 
context would be the eventual home.



-- Aaron Hill



Re: make-music?

2024-04-13 Thread Aaron Hill

On 2024-04-13 1:08 pm, Pierre-Luc Gauthier wrote:

But what about the parenthesised alist -> (alist) ‽



Difference between a variable containing an alist versus a *procedure* 
that returns an alist.  This defers the evaluation of aSymbol until such 
time as it is defined.


Here is another approach:


\version "2.25.13"

#(define anAList '((aVariable . aSymbol)))

aSymbol = { cis' }

{
  #(module-ref (current-module) (cdr (assoc 'aVariable anAList)))
}
%%%%


-- Aaron Hill



Re: Overriding default text of \f, \p, etc.

2024-04-12 Thread Aaron Hill

On 2024-04-12 1:54 am, David Kastrup wrote:

YTG 1234  writes:


Hello List,

I want to override the default text markup used with commands such as
\f, \p, \mf, etc.

However, trying to define f = #(make-dynamic-script ...) doesn't work
because Lilypond interprets f as a note-name.


You could switch to Italian note names temporarily… Just kidding: the
sane solution of using quote marks has been already covered in two
replies.




\version "2.25.13"

\language italiano
f = -\tweak color #red \f
\language english

{ b'4 4 2\f }


That's hilarious.  David, have you been hoarding other tricks?  /s


-- Aaron Hill



Re: Overriding default text of \f, \p, etc.

2024-04-12 Thread Aaron Hill

On 2024-04-12 12:21 am, YTG 1234 wrote:

Hello List,

I want to override the default text markup used with commands such as 
\f, \p, \mf, etc.


However, trying to define f = #(make-dynamic-script ...) doesn't work 
because Lilypond interprets f as a note-name.


Additionally, how would I be able to change the text while maintaining 
the MIDI effect? I tried using \tweak DynamicText.text but it doesn't 
seem to override the text...



Since f is a pitch, you need to put it in quotes.  Consider:


\version "2.25.13"

"f" =
  -\tweak color #red
  -\tweak text \markup \circle f
  \f

{ b'4 4 2\f }



-- Aaron Hill



Re: Installing 2.24.1

2024-04-11 Thread Aaron Hill

On 2024-04-11 1:14 pm, Wol wrote:
So it looks like it's searching the program directory for my include 
files, and not the current directory where they actually are! Note that 
running the older lilypond correctly compiles the file.



I am having trouble reproducing the behavior you are seeing.  On a 
Windows 10 machine (22H2, 19045.4170) that does not have Frescobaldi nor 
any prior LilyPond installation, I took the following steps:


1) Download LilyPond for Windows (version 2.24.3, also 2.25.14 from the 
development page)
2) Unzip to my Downloads folder (produced subfolders lilypond-2.24.3 and 
lilypond-2.25.14)

3) Opened a terminal window within the Downloads folder...
4) Ran "lilypond-2.24.3/bin/lilypond --version" to verify the download 
and extraction worked

5) Created two files on my Desktop:

%% test.ily %%
\version "2.24.0"
test = { b'4 4 2 }


%% test.ly %%
\version "2.24.0"
\include "test.ily"
{ \test \test }


6) Opened a terminal window within the Desktop folder...
7) Ran "..\..\Downloads\lilypond-2.24.3\bin\lilypond --version" to 
verify pathing worked
8) Ran "..\..\Downloads\lilypond-2.24.3\bin\lilypond test.ly" to verify 
compilation


At this point, test.pdf was created without any issues.  (Well, 
actually, it did fail due to a wrong version number, but that was 
because I was running on autopilot and had mistyped the \version 
statements in my test documents as 2.25.14, since I was also testing 
against that version as well.  Correcting the \version statements as 
noted above resolved that.)


9) From an *elevated* command prompt...
10) Ran "assoc .ly=LilyPond"
11) Ran "ftype LilyPond=\lilypond-2.24.3\bin\lilypond.exe 
%1"


NOTE: The path above was to my user's Downloads folder from which I had 
been running LilyPond during testing.


12) Back in a normal command prompt from the Desktop folder...
13) Ran "test.ly" to verify file association and compilation.

No issues.

14) Double-clicked "test.ly" from my Desktop.

No issues.


-- Aaron Hill



Re: PianoPedalBracket.to-barline doesn't always work as expected

2024-04-09 Thread Aaron Hill
On 2024-04-09 2:55 pm, Maurits Lamers via LilyPond user discussion 
wrote:
Only when the \sustainOff is placed outside of the tremolo, the bracket 
extends to the barline:


%%%

\version "2.24.0"
\score {
  \new Staff {
    \clef bass
    \time 6/8
    \relative c' {
  c8 b a g e c |
  \set Staff.pedalSustainStyle = #'mixed
  \override Staff.PianoPedalBracket.to-barline = ##t
  \repeat tremolo 12 { b,32\sustainOn b' } |
  \repeat tremolo 12 { b,32 b' }  \sustainOff |
  c8 e f g a
    }
  }
}

%%%

However, this leads to Lilypond complaining about an unattached 
SustainEvent. Is this a bug?



Does the empty chord construct help?

  <>\sustainOff

(I'm away from my normal environment, so I cannot test this locally to 
confirm.)



-- Aaron Hill



Re: Lead sheets: Maj. 7 chords

2024-04-09 Thread Aaron Hill

On 2024-04-09 1:43 pm, Ivan Kuznetsov wrote:

have been creating some lead sheets in
the style of the "Real Book", using
the \chords{} syntax.  However,
I do not like the way the default
notates "major 7 chords", that is,
a major triad with a major seventh.

The default is to use a "triangle"
to notate such a chord (shown below
in my example" but I much prefer
the way the Real Book notates
such chords, by writing out
"maj7".

How can I get the \chords {} syntax
to notate "major 7 chords as
I prefer, using the notation
"maj7" ?



You need to adjust the majorSevenSymbol [1].

[1]: 
https://lilypond.org/doc/v2.25/Documentation/notation/customizing-chord-names#chord-name-major7



-- Aaron Hill



Re: \quoteDuring #'("piccolo" "fluteI" "fluteII" "oboeI") {o_O!}

2024-04-05 Thread Aaron Hill

On 2024-04-05 10:20 am, Pierre-Luc Gauthier wrote:

Hi there,

Is there a way to quote multiple quotables ?

I use it often for piano reductions and what not.
e.g.:

\version "2.25.15"

\addQuote "piccolo" {c4}
\addQuote "fluteI"  {g'''4}
\addQuote "fluteII" {e'''4}
\addQuote "oboeI"   {c'''4}

\new Voice <<
  \ottava 1
  \quoteDuring "piccolo" {s4}
  \quoteDuring "fluteI" {s4}
  \quoteDuring "fluteII" {s4}
  \quoteDuring "oboeI" {s4}




Wouldn't elegance suggests something like :

pianoReduction = \quoteDuring #'("piccolo" "fluteI" "fluteII" "oboeI") 
{s4}


I thought maybe the \quoteDuring command could accept lists but I have
not managed to get it to work... :-(




\version "2.25.13"

#(define (string-list? arg) (and (list? arg) (every string? arg)))
#(define (string-or-string-list? arg) (or (string? arg) (string-list? 
arg)))


quoteDuring =
#(define-music-function (what main-music) (string-or-string-list? 
ly:music?)

  (fold (lambda (elem prev)
  (make-music 'QuoteMusic
  'element prev
  'quoted-music-name elem))
main-music (if (list? what) what (list what

%% - - - - %%

\addQuote "piccolo" {c4}
\addQuote "fluteI"  {g'''4}
\addQuote "fluteII" {e'''4}
\addQuote "oboeI"   {c'''4}

\new Voice {
  \ottava 1
  \quoteDuring #'("piccolo" "fluteI" "fluteII" "oboeI") { s4 }
}


NOTE: The modified \quoteDurring above produces a nested music 
expression, as if you had written:



\quoteDuring "oboeI" \quoteDuring "fluteII" \quoteDuring "fluteI" 
\quoteDuring "piccolo" { s4 }




-- Aaron Hill



Re: organizing shared libraries

2024-04-04 Thread Aaron Hill

On 2024-04-04 6:53 am, Tom Brennan wrote:

Sort of answering my own question, but I figure that you don't get
much out of creating scheme modules directly, unless they can live
entirely outside of the lilypond world. Generally it seems better to
create shared libraries somewhere and include them with
`--include/-I`.



If you were doing lots of Scheme programming and wanted to avoid 
polluting the end user's namespace, then modules could make sense.  Mind 
you, if you are the only consumer of your shared library, you probably 
can mitigate naming collisions on your own.


Another case is the backend pattern LilyPond uses, where each backend 
lives in its own module but ultimately exposes the same public 
interface.  This allows abstract driver logic to be wired up dynamically 
with the concrete behavior with minimal coupling and the ability for the 
front-end and back-end to vary independently.



-- Aaron Hill



Re: define-public

2024-03-29 Thread Aaron Hill

On 2024-03-29 2:41 am, Rip _Mus wrote:

Hello,
on mac, I want to insert this flag on compilation:

-e '(define-public part 'cello)'

But this give me an "error near unexpected token". I think that the 
problem

is the ' near the symbol name.
I tried enclosing in double quotation marks, as on Windows, but it is 
not

working.
I'm using szh on terminal. In the Lilypond file i put the #(use-modules
(guile-user))

Can somebody help me?



For most shells, you escape single quotes with the '\'' pattern if you 
are working within single-quoted strings:



-e '(define-public part '\''cello)'


Not sure why the double-quoted string would have failed, though.


-- Aaron Hill



Re: remove key change at end of line

2024-03-25 Thread Aaron Hill

On 2024-03-25 2:18 pm, bobr...@centrum.is wrote:
I want to remove a key change from the ends of lines/systems. I am 
*not* referring to just key cancellation, which I do also want. I mean, 
at the end of a line the new key should not appear before the new line. 
I haven't worked it out.



Shouldn't it be nothing more than setting break-visibility to 
'end-of-line-invisible?


https://lilypond.org/doc/v2.25/Documentation/notation/using-break_002dvisibility


-- Aaron Hill



Re: nested \set ?

2024-03-25 Thread Aaron Hill

On 2024-03-25 4:13 am, Jean Abou Samra wrote:

No, this doesn't exist OOTB. It could be implemented with a
Scheme engraver, but that would probably be overkill, unless
for some reason it's really important for what you're trying
to do?



Here's a simple non-engraver way to potentially get close:


\version "2.25.13"

#(define context-stack '())

#(define (context-stack-find property)
  (ly:assoc-get property context-stack '()))

#(define (context-stack-push! property value)
  (set! context-stack
(assoc-set! context-stack property
  (cons value (context-stack-find property)

#(define (context-stack-pop! property)
  (let ((stack (context-stack-find property)))
(if (null? stack) '()
(let ((value (car stack)) (rest (cdr stack)))
  (set! context-stack
(if (null? rest)
  (assoc-remove! context-stack property)
  (assoc-set! context-stack property rest)))
  value

push =
#(define-music-function
  (property value)
  (symbol? scheme?)
  (define (proc ctxt)
(let ((value (ly:context-property ctxt property '(
  (or (null? value)
(context-stack-push! property value)))
(ly:context-set-property! ctxt property value)
;; (format #t "~a\n" context-stack)
  )
  #{ \applyContext #proc #})

pop =
#(define-music-function
  (property)
  (symbol?)
  (define (proc ctxt)
(let ((value (context-stack-pop! property)))
  (if (null? value)
(ly:context-unset-property ctxt property)
(ly:context-set-property! ctxt property value)))
;; (format #t "~a\n" context-stack)
  )
  #{ \applyContext #proc #})

{
  \repeat unfold 8 b'8
  %% This example involves a property
  %% that already has a value set...
  \push autoBeaming ##f
  \repeat unfold 8 b'8
  \pop autoBeaming
  \repeat unfold 8 b'8
}

{
  \repeat unfold 2 { 4( ) }
  %% This example involves a property
  %% that was unset initially...
  \push doubleSlurs ##t
  \repeat unfold 2 { 4( ) }
  \pop doubleSlurs
  \repeat unfold 2 { 4( ) }
}


It is probably missing some edge case handling, and certainly the 
`context-stack` should itself be stored within the context rather than 
just some arbitrary global variable.  Another issue would be not 
handling the extended \set syntax as in, say, `\set Score.skipBars = 
##t`.  The property argument would need to become a `key-list?` with the 
appropriate handling to redirect to another named context.



-- Aaron Hill



Re: LilyPond 2.25.14

2024-03-24 Thread Aaron Hill

On 2024-03-24 3:45 am, Jonas Hahnfeld wrote:

On Sun, 2024-03-24 at 03:20 -0700, Aaron Hill wrote:

Based on the email thread you linked, perhaps I should nuke all my WSL
distros at this point and start from scratch with the latest Ubuntu 
(22,

I gather).  Not sure if Alma is an option for WSL.


You don't need Alma, the binaries should run on any distribution that
is newer than that. Ubuntu is perfectly fine, and likely better tested
with WSL (but I don't have experience with it myself).



Yeah, Ubuntu has been the de facto default for WSL, as it was my 
understanding that Canonical and Microsoft teamed up to create the 
original WSL project.


Interestingly, it turns out Alma is a supported WSL distro (8 and 9 are 
both in the Windows Store).



-- Aaron Hill



Re: LilyPond 2.25.14

2024-03-24 Thread Aaron Hill

On 2024-03-24 1:23 am, Jonas Hahnfeld wrote:

On Sat, 2024-03-23 at 18:18 -0700, Aaron Hill wrote:

On 2024-03-23 6:25 am, Jonas Hahnfeld wrote:
> We are happy to announce the release of LilyPond 2.25.14. This is
> termed a development release, but these are usually reliable for
> testing new features and recent bug fixes. However, if you require
> stability, we recommend using version 2.24.3, the current stable
> release.
> Please refer to the Installing section in the Learning Manual for
> instructions how to set up the provided binaries:
> https://lilypond.org/doc/v2.25/Documentation/learning/installing


/opt/lilypond/2.25.14/bin/lilypond: /lib/x86_64-linux-gnu/libc.so.6:
version `GLIBC_2.28' not found (required by
/opt/lilypond/2.25.14/bin/lilypond)


Something changed from .13 to .14?  I'm presuming my system is just
out-of-date, and this might be expected.


Yes, 2.25.14 is built in Alma Linux 8 instead of CentOS 7 which raises
the glibc requirement. I didn't mention it in the release email because
I thought it wouldn't make a practical difference as outlined in
https://lists.gnu.org/archive/html/lilypond-devel/2024-02/msg00052.html
Which distribution are you running?



The error occurred from my WSL1 environment running Ubuntu 18.04.  
Probably my own fault for keeping bionic around.


I do have Ubuntu 20.04 under WSL2.  I can confirm 2.25.14 runs under 
focal without complaining about glibc.


Based on the email thread you linked, perhaps I should nuke all my WSL 
distros at this point and start from scratch with the latest Ubuntu (22, 
I gather).  Not sure if Alma is an option for WSL.



-- Aaron Hill



Re: LilyPond 2.25.14

2024-03-23 Thread Aaron Hill
On 2024-03-23 6:25 am, Jonas Hahnfeld via Discussions on LilyPond 
development wrote:

We are happy to announce the release of LilyPond 2.25.14. This is
termed a development release, but these are usually reliable for
testing new features and recent bug fixes. However, if you require
stability, we recommend using version 2.24.3, the current stable
release.
Please refer to the Installing section in the Learning Manual for
instructions how to set up the provided binaries:
https://lilypond.org/doc/v2.25/Documentation/learning/installing




/opt/lilypond/2.25.14/bin/lilypond: /lib/x86_64-linux-gnu/libc.so.6: 
version `GLIBC_2.28' not found (required by 
/opt/lilypond/2.25.14/bin/lilypond)



Something changed from .13 to .14?  I'm presuming my system is just 
out-of-date, and this might be expected.



-- Aaron Hill



Re: multipart choral music - disable barlines between staves when using GrandStaff within ChoirStaff

2024-03-23 Thread Aaron Hill

On 2024-03-23 2:12 am, Eby Mani wrote:

Two questions.
1, How do i set instrument names as per attached "example_1" picture.

2, example_1 - How do i disable connecting barlines between staves when 
using PianoStaff or GrandStaff within ChoirStaff.



This is not the complete scenario with all voices and lyrics, but it 
should give you the general idea:


1. Use the ChoirStaff which already omits the SpanBar.
2. Change the delimiter to the brace, like the GrandStaff (or 
PianoStaff).
3. Apply an instrument name to the group of related voices to get its 
label shown between the individual voices.




  \version "2.25.13"

  startBrace = \with { systemStartDelimiter = #'SystemStartBrace }

  notes = { \repeat unfold 5 { b'4 8 8 2 | 4. 8 2 } | 1 \fine }

  \new ChoirStaff <<
\new ChoirStaff \with { \startBrace instrumentName = "Soprano" 
shortInstrumentName = "S." } <<
  \new Staff = sopranoI \with { instrumentName = "I" 
shortInstrumentName = "I" } \notes
  \new Staff = sopranoII \with { instrumentName = "II" 
shortInstrumentName = "II" } \notes

>>
\new ChoirStaff \with { \startBrace instrumentName = "Alto" 
shortInstrumentName = "A." } <<
  \new Staff = altoI \with { instrumentName = "I" 
shortInstrumentName = "I" } \notes
  \new Staff = altoII \with { instrumentName = "II" 
shortInstrumentName = "II" } \notes

>>
  >>



NOTE: If you do need to use a GrandStaff (or PianoStaff), you can remove 
the Span_bar_engraver similar to what the ChoirStaff already does:



\new PianoStaff \with { \remove Span_bar_engraver } { . . . }



-- Aaron Hill

Re: Dynamics collide with span bar

2024-03-22 Thread Aaron Hill

On 2024-03-22 5:30 pm, Michael Bret wrote:
Then, it should be added that transposing your first fix (namely, 
BarLine.bar-extent = #'(0 . 1) and transparent = ##t) DOES solve the 
issue WITH “Bar_engraver” consisted. How does that make sense? I 
probably don’t get what "Span_bar_stub_engraver getting tripped up by 
the Bar_engraver” entails. It might be useful to keep it in mind, in 
order to identify cases where the fix messes up something.



In reviewing the code for Span_bar_stub_engraver, it intentionally does 
not create stubs for contexts that have the Bar_engraver.  But the stubs 
are not specifically needed if you have an actual BarLine grob.  That is 
why my earlier workaround worked.


Neither Lyrics nor ChordNames consist the Bar_engraver, so they rely on 
Span_bar_stub_engraver.  And the issue for ChordNames was the lack of 
Pure_from_neighbor_engraver.


Dynamics is interesting because it does consist the Bar_engraver, so it 
needs to be handled a little differently.  Of course, there are some 
elements of Dynamics such as hairpins that normally are acceptable to 
span across measures.  So, we would need to be careful that any changes 
to Dynamics does not break how people expect it to work.



-- Aaron Hill



Re: Dynamics collide with span bar (was Re: Chord names collide with span bar)

2024-03-22 Thread Aaron Hill

On 2024-03-22 4:08 pm, Michael Bret wrote:

Dear Werner, Aaron and Knute,
(it is y first time attempting to contribute to such lilypond 
discussion so I don’t dare cc-ing the whole mailing list)



(Adding the mailing list for visibility...)

Regardless of your experience or comfort level, it is always recommended 
to include the mailing list in all discussions unless something must be 
privately communicated.  The reason is simple: All of us are volunteers, 
in one form or another.  Our time and availability are subject to change 
on a whim.  Directly emailing individuals greatly limits your chances of 
getting a prompt response (or any response at all), whereas writing to 
the broader audience increases the likelihood of a reply from someone 
who has the time to get back to sooner.  It is also very helpful to have 
email archives that are complete.  Off-list messages can disrupt proper 
threading of emails.



Is this issue related to this one (collision between dynamic text and 
span bar)?

https://music.stackexchange.com/questions/116312/lilypond-auto-horizontal-space-for-dynamic-text

Root cause seems similar since it is about the skyline of span-bar not 
being extended.


However, the solution provided by Werner doesn’t seem to transpose 
effectively. I tried this to no avail:



This would appear to be related, although a new wrinkle has appeared.

Something to note is that the Dynamics context already consists the 
Bar_engraver in order to make use of the to-barline property.  In my 
testing, I found that having the Bar_engraver consisted is getting in 
the way.  If you remove Bar_engraver and consist 
Pure_from_neighbor_engraver within Dynamics, it behaves similar to the 
ChordNames fix.  So, it would seem the Span_bar_stub_engraver is perhaps 
getting tripped up by the Bar_engraver.



\version "2.25.13"
\language "italiano"

common = {
  \key sol \minor
  \time 4/4
  \tempo "Largo [Широко]"
}

right = \relative do'' {
  \key sol \major
  sol8 (fad re mi sol fad re4) |
  sol8 (fad re mib sol fad re4)
}

left = \relative do' {
  \key sol \major
  sol,8 (re' si' re,) sol, (re' do' re,) |
  sol, (re' sib' re,) sol, (re' do' re,) |
}

dynamics = {
  s1 |
  \override DynamicText.extra-spacing-width = #'(-1 . 1)
  s8 \ppp s8 s8 s8 s8 s8 s4
}

%% #(ly:set-option 'debug-skylines #t)
\layout {
  \context { \Dynamics
\consists Pure_from_neighbor_engraver
\remove Bar_engraver
  }
}

\score {
  \new PianoStaff <<
\new Staff = "right" \right
\new Dynamics \dynamics
\new Staff = "left" { \clef bass \left }
  >>
}



-- Aaron Hill



Re: Tie an afterGrace note produces warning

2024-03-22 Thread Aaron Hill

On 2024-03-22 8:24 am, Knute Snortum wrote:

Hi all,

I am trying to tie an afterGrace note to the next note and I get a
warning.  This code:

\version "2.25.13"

\relative {
  \afterGrace c''4\trill { b16 c~ } c4
}

...produces this warning:

/tmp/frescobaldi-ieh3nrny/tmpq4qpjmjp/document.ly:4:33 <0>: warning:
unterminated tie

\afterGrace c''4\trill { b16 c

~ } c4


Is there any way around this, as I need this for my current project?




\version "2.25.13"

\relative {
  \afterGrace c''4\trill { b16 \set tieWaitForNote = ##t c~ } c4
}



-- Aaron Hill



Re: How to use define-music-function?

2024-03-20 Thread Aaron Hill

On 2024-03-20 8:53 am, enejati--- via LilyPond user discussion wrote:

Hello,
I'm a new lilypond user. I want to create multiple scores in a single
file. These scores have some values on common. So I want to use
`define-music-function` in order to avoid repetition.

[ . . . ]



A few things.  Firstly, you must prefix make-score with a slash, just 
like any other music function.  Secondly, define-music-function is not 
structured the same as Scheme's define.  The procedure name will go 
outside:



myFunction = #(define-music-function (arg1 arg2) (type? type?) ...)


Lastly, a music function must return what LilyPond considers music.  
Top-level things like a \score or \book will not count.  Instead, what 
you will need is define-void-function, which does not return anything.  
Within this function, you can call the internal functions for processing 
scores and books directly:



make-score =
#(define-void-function
  (instrumentName bookSuffix musicContent)
  (string? string? ly:music?)
  (toplevel-score-handler #{
\score {
  \new Staff \with {
instrumentName = #instrumentName
  } { #musicContent }
  \layout { }
}
  #})
  (toplevel-book-handler #{
\book {
  \bookOutputSuffix #bookSuffix
  \score {
\new Staff \with {
  midiInstrument = "piccolo"
} { #musicContent }
\midi {
  \tempo 4 = 80
}
  }
}
  #}))

% Usage
\make-score "۱" "1" { b'4 4 2 }
\make-score "۲" "2" { b'4 4 2 }
\make-score "3" "3" { b'4 4 2 }




-- Aaron Hill



Re: Wanting to parenthesize (b5) superscript

2024-03-19 Thread Aaron Hill

On 2024-03-19 10:13 pm, John Helly wrote:

Aloha.

I'm trying to improve a score that my colleagues find confusing since 
they mis-interpret A(b5) as Ab5; that is, when cis1:5- is transposed to 
A(b5).


The transpose (cis to a) is not applied in the example below and that 
may further complicate things as I'm not sure whether parentheses 
could/should be added before the transpose or after. So, this may 
actually be two problems.


So I'm seeking a way to put parentheses around the (b5) superscript.  I 
found this related snippet in the docs but can't seem to apply it 
usefully to this situation.


Suggestions would be much appreciated.



Does this help?


\version "2.22.0"

% Exception music is chords with markups.
% Specifically, chords rooted on C.
chExceptionMusic = {
  1-\markup \super { ( \flat 5 ) }
}

% Convert music to list and prepend to existing exceptions.
chExceptions = #(append
  (sequential-music-to-chord-exceptions chExceptionMusic #t)
  ignatzekExceptions)

theMusic = \chordmode {
  \set chordNameExceptions = #chExceptions
  cis1:5-
  des1:5-
}

\layout {
  ragged-right = ##t
}

\new ChordNames { \theMusic }



-- Aaron Hill



Re: Footer text from header

2024-03-19 Thread Aaron Hill

On 2024-03-19 1:50 pm, Johannes Roeßler wrote:

thx again Aaron,

I tried it with
%%%
 \line  {\fromproperty #'header:composer " - "  \as-string 
\fromproperty #'header:title }

%%%
- then the title (in the footnote) was empty.

But you gave so many valuable insights, that I'll use it to make it in 
a better way - very instructive,

thank you very much!



Aha!  \as-string (as I defined it) is not going to work with 
\fromproperty.  The problem is that \fromproperty needs to be 
interpretted to get its contents.  \as-string is processing too soon, so 
it will not work.  Also, once markup is interpretted, it becomes a 
stencil.  And that is basically useless for our purposes.


One solution would be to customize \fromproperty itself:


\version "2.22.0"

%% Based on code from define-markup-commands.scm:
#(define-markup-command
  (frompropertystring layout props symbol) (symbol?)
  (let ((m (chain-assoc-get symbol props)))
(if (markup? m)
(interpret-markup
  layout
  (cons (list (cons symbol `(,property-recursive-markup 
,symbol))) props)

  (markup->string m))
empty-stencil)))

\header {
  asdf = \markup \with-color #red \bold \line { "Hello," "World!" }

  title = \markup \fromproperty #'header:asdf
  subtitle = \markup \frompropertystring #'header:asdf
}

\score { { b'1 } }


Again, this is probably not the best approach.  For instance, a nested 
\fromproperty within a field is going to fail much the same way.  So, 
then we are looking at redefining \fromproperty itself to be able to 
call markup->string as needed.  Doable, but it really starts to feel 
like a clunky hack.


I think the best approach is to avoid putting markup around data that 
needs to be accessed in different ways.  Keep the fields as simple text, 
so there is no need for an \as-string or \frompropertystring command.



-- Aaron Hill



Re: Footer text from header

2024-03-19 Thread Aaron Hill

On 2024-03-19 11:15 am, Johannes Roeßler wrote:
And I aim to separate content from style - but in order to have the 
right (and changing) footer text for each piece in a book environment, 
I need to get this information from the header and can't define it in 
the common \paper env - or do I miss something?


You should be able to define oddFooterMarkup in a suitably generic 
manner.  All of the related markup paper variables are intended to work 
this way, so anything specific to a score lives in a \header block.



And defining and adding your idea with the \as-string command seems not 
to work:


The idea is that \as-string strips any commands for the markup you 
provide it.  But the usage you wrote is not what was intended.  
\as-string would be used just before the \fromproperty commands.  
Something closer to this:



  oddFooterMarkup = \markup {
    \fill-line {
  \tiny {
   { "Edited by Joei" }
   \line {
 \as-string \fromproperty #'header:composer " - "
 \as-string \fromproperty #'header:title
   }
   "Copyright 2024"
  }
    }
  }


NOTE: You should probably be using \header fields for copyright and 
editor.


Here's a more complete example with the goal of keeping the \header 
blocks free of \markup commands:




\version "2.22.0"

\paper {
  bookTitleMarkup = \markup
\override #'(baseline-skip . 1.75) \column {
  \fill-line {
\override #'(font-name . "Lobster") \line {
  \fontsize #6 \fromproperty #'header:title
  \fontsize #3 \fromproperty #'header:subtitle
}
\bold \fromproperty #'header:composer
  }
  \override #'(thickness . 2) \draw-hline
}

  oddFooterMarkup = \markup \tiny \fill-line {
\line { Edited by \fromproperty #'header:editor }
\line {
  \fromproperty #'header:composer
  – % en-dash
  \fromproperty #'header:title
}
\fromproperty #'header:copyright
  }
}

\header {
  editor = "Anon E. "
}

%% - - -

\header {
  title = "Lorem Ipsum"
  subtitle = "(dolor sit amet)"
  composer = \markup { "John Doe" \smallCaps (asdf) }
  copyright = "© 2024 John Doe Music"
}

\score { { b'1 } }



In this case, the composer's affiliation with the fictitious ASDF group 
is written in small caps.  This markup command belongs in the \header 
block as we would ideally want it included anywhere that field is 
referenced.  Now, that is only one way to achieve things, as we could 
have just as easily defined a new header field instead:



\header {
  title = "Lorem Ipsum"
  subtitle = "(dolor sit amet)"
  composer = "John Doe"
  affiliation = "ASDF"
  copyright = "© 2024 John Doe Music"
}


Of course, the \paper block would need to be updated to support this new 
field.  (I'll leave that as an exercise for the reader.)


It will be up to you to determine where you are going to strike the 
balance between markup in the \paper block versus the \header block.  As 
in the example above, I think that it is perfectly fine to mix a little 
bit of useful formatting in the metadata, especially if such a thing is 
going to be relatively rare across the majority of your scores.  
Otherwise, anything that is shared should ideally be defined once, in 
some globally-referenced resource.


It can be a little tricky to plan out how to build your \paper markup 
variables, so that they function well when fields are defined or left 
undefined.  In the example I provided, the subtitle can be safely 
omitted.  However, note that I opted to put the parentheses within the 
subtitle field itself.  Had I put them in the \paper block, then you'd 
find an empty set of parens next to any title that did not also include 
a subtitle; not really what you'd want.  So, either one would need some 
clever custom \markup commands to automatically do the work, or we just 
"cheat" and put the parens in the header field.  Again, it comes back to 
that balancing act.


(The careful reader should observe that due to how the footer was 
defined, editor is effectively not an optional field.  The text "Edited 
by" will still appear even when the editor field is undefined.  I would 
encourage you to consider how you could improve this, assuming such 
flexibility is necessary.  The advanced exercise involves showing 
"Edited by" only when the editor field is defined without moving such 
text to the field itself.  Of course, consider your own real-world 
scenario.  Are you the editor for all of your scores?  If so, there may 
be no need to add complexity where it is otherwise wasted effort.)



-- Aaron Hill



Re: Footer text from header

2024-03-19 Thread Aaron Hill

On 2024-03-19 9:35 am, Johannes Roeßler wrote:

Hi,

I'd like to make an automatic footer, using infos from the header 
block.


What do I have to change, to get rid of (or override) the format from 
the title?


-8<--

\version "2.24.0"

{a4}

\header {

  title =
  \markup
  \fill-line {
    \override #'(font-name . "Calluna")
    \abs-fontsize #22 "Title"
    \null
  }

  composer = "Composer"

}

\paper {

  oddFooterMarkup = \markup {
    \fill-line {
  \tiny {
    {"Edited by Joei"}
    \line  {\fromproperty #'header:composer " - " \fromproperty 
#'header:title }

   "Copyright 2024"
  }
    }
  }
}

-->8---


It should be possible to strip markup down to a simple string with the 
Scheme function markup->string.



\version "2.22.0"

foo = \markup \huge \bold "Hello"

#(define-markup-command
  (as-string layout props arg) (markup?)
  (interpret-markup layout props (markup->string arg)))

\markup \foo

\markup \as-string \foo


However, the best approach would be to separate content from styling.  
When you define things like title, specify only the simple string value. 
 Place all formatting/styling commands instead within the paper 
variables like bookTitleMarkup, scoreTitleMarkup, oddHeaderMarkup, etc.


Reference the file titling-init.ly within your LilyPond installation to 
see what the default values are for these markup paper variables.  
Copy-and-paste the default definitions and adjust to your needs.  NOTE: 
These are the sort of things that are best put into include files, so 
you can reuse them and easily standardize your formatting across many 
scores.



-- Aaron Hill



Re: B.A.C.H. motif

2024-03-19 Thread Aaron Hill

On 2024-03-19 5:55 am, Peter Mayes wrote:
Being relatively new to this forum, I suspect I am not the first person 
to ask this.


And it is more out of curiosity than necessity.

But does anybody have lilypond code to engrave the famous B.A.C.H. 
motif in the attached image?


I did not check for prior work, so here is what I just put together:


\version "2.22.0"
\language deutsch

\layout { \context { \Score
  \omit SystemStartBar
  \omit TimeSignature
  \omit BarLine
} }

%% Offsets
#(define x1 -0.88)
#(define y1 0.062)
#(define x2 0.438)
#(define y2 0.88)
#(define x3 -0.15)
#(define y3 0.03)

accLeft = \once \override
  Accidental.extra-offset = #'(-1 . 0)
noNH = \once \hide NoteHead

\markup \overlay {

  \translate #(cons (+ x1 x3) (+ y1 y3))
  \general-align #X #CENTER \vcenter
  \score { { \clef treble \accLeft b'1 } }

  \translate #(cons (- x2 x3) (- y2 y3))
  \general-align #X #CENTER \vcenter
  \rotate #-90
  \score { { \clef tenorvarC \noNH a1 } }

  \translate #(cons (- x3 x1) (- y3 y1))
  \general-align #X #CENTER \vcenter
  \rotate #180
  \score { { \clef altovarC \noNH c'1 } }

  \translate #(cons (- 0 x2 x3) (- 0 y2 y3))
  \general-align #X #CENTER \vcenter
  \rotate #90
  \score { { \clef treble \accLeft \noNH h'! 1 } }

}



-- Aaron Hill

Re: coloring notes with more voices in a staff

2024-03-18 Thread Aaron Hill

On 2024-03-18 9:41 am, Go77 wrote:

Hi,

I'm trying to color the note heads of a single voice in a staff. I 
tried to do that with the following code:


/\version "2.24.3"
\relative c
  {
   f'2( g4.)
    << { d8 | f4 f4 g16 a }
   { \override NoteHead.color = #red
 g8 | d4 d4 e16 f
 \revert NoteHead.color } >>
    a8 r4
  } /

This results in the noteheads of /both /voices being colored instead of 
only the upper one (in this case):


So, is there any way to achieve my goal of coloring only the upper 
notes?


Since you did not use \\ within the << >>, there is no implicit voice 
creation.  As it stands, you only have one voice.


You can review the documentation ([1] and [2]) for more information on 
creating voice contexts.


[1]: 
https://lilypond.org/doc/v2.24/Documentation/learning/i_0027m-hearing-voices
[2]: 
https://lilypond.org/doc/v2.24/Documentation/learning/explicitly-instantiating-voices



-- Aaron Hill



Re: Best way to center beam between upper/lower staff?

2024-03-07 Thread Aaron Hill

On 2024-03-07 9:12 pm, Andy Bradford wrote:

Hello,

This has to be a FAQ, yet all my searching turned up a mixed bag.

I'm trying to have some notes cross from the lower staff to the upper 
staff but want the beam to automatically center.  In my example this is 
accomplished in measure 3 with much manual work.  Is there a better 
way?




Is `\autoChange` [1] what you were looking for?

[1]: 
https://lilypond.org/doc/v2.25/Documentation/notation/changing-staff-automatically


You might also need to play with `Beam.auto-knee-gap` [2].

[2]: 
https://lilypond.org/doc/v2.25/Documentation/notation/automatic-beams



-- Aaron Hill



Re: search and replace on all included files on compile

2024-03-06 Thread Aaron Hill
On 2024-03-06 10:56 am, Michael Winter via LilyPond user discussion 
wrote:
I have a programmatically generated score and am now realizing that I 
want to make a small tweak to text markups that are throughout the 
score in multiple files that are included at multiple levels. 


" 1↑"  replace with " 1" (e.g. remove the up arrow when it is preceded 
by a 1)


Is it possible to do this with a global search and replace on compile 
such that I do not need to edit each individual file (of which there 
are hundreds) manually?


LilyPond does support basic replacements for text markup:


\paper {
  #(add-text-replacements! '(("1↑" . "1")))
}



-- Aaron Hill



Re: warning

2024-03-05 Thread Aaron Hill

On 2024-03-05 1:53 pm, ming tsang wrote:

Hi users,
I got the following warning message. I read some where one should not
ignore the warning message.

warning: cannot find context Voice = soprano

how to make context specification?


Without more information or a MWE, we are going to be making blind 
guesses.


But the most likely cause for a context not being found is that it was 
not kept alive.


Please review the information here [1] and see if that helps in your 
situation.


[1]: 
https://lilypond.org/doc/v2.24/Documentation/notation/keeping-contexts-alive



-- Aaron Hill



Re: How to align second repeat verse against second voice

2024-02-24 Thread Aaron Hill

On 2024-02-24 4:04 pm, Andy Bradford wrote:

Hello,

I have  a piece  with two verses  in a repeat.  The second  time 
through
there  is  a  slight  alteration  in one  of  the  measures  which  
adds
additional notes.  I've been able  to accomplish this using  a 
temporary
voice, but I'm  not sure if this is  the best way as the words  "ma - 
mo
mu" end up shifted down another  line. Here is the smallest section 
that

I could provide, but I wonder if I can align the text better?

[ . . . ]


Each new Lyrics context will appear on its own line.  This is sometimes 
desirable, but if you need to keep lyrics on the same line, they will 
have to share the same Lyrics context.


Probably the easiest the option is to \set associatedVoice to 
temporarily align your lyrics to the alternate notes.  The important 
quirk of associatedVoice is that you must make the change a syllable 
ahead of when you need it:



<<
  \new Voice = melody \relative {
  | c'4 d
<<
  \once \voiceOne e2
  \new Voice = alt \magnifyMusic #0.618 {
\voiceTwo
e8 f e4
  }
>>
  | g1
  }
  \new Lyrics \lyricsto melody { a i u o }
  \new Lyrics \lyricsto melody {
% a i u e u o
%  ↑ │   ↑ │  We switch voices one syllable earlier.
%  └─┘   └─┘

a \set associatedVoice = alt
i u e \unset associatedVoice
u o
      }
>>



-- Aaron Hill

Rousseau's boustrophedon notation

2024-02-23 Thread Aaron Hill
Just read a side note on Wikipedia about a supposed "boustrophedon" 
notation.  The citation does not link to the image in question, which is 
an unfortunate oversight.  I was curious whether this approach applied 
only to Rousseau's numeric notation or if it was intended to work with 
standard notation.  I suspect his numeric notation is more vulnerable to 
misreading as it would be harder to jump from the end of one line to the 
beginning of the next.


It seems like LilyPond could theoretically support this by alternately 
reflecting every other system, assuming the intention is to mirror image 
all symbols in the right-to-left systems.


Does anyone have more details about this?


-- Aaron Hill



Re: define-music-function with afterGrace and {}

2024-02-23 Thread Aaron Hill

On 2024-02-23 4:46 am, jca...@web.de wrote:

My previous attempt:

   graceGliss =
   #(define-music-function
  (starttone endtone)
  (ly:music? ly:music?)
  #{
    \afterGrace #starttone \glissando {\once \hide Stem
   \parenthesize #endtone}
  #})

doesn't work, Return Code 1.


You will need to include whitespace between #endtone and the closing 
brace that follows.



-- Aaron Hill



Re: markup for circular bowing

2024-02-14 Thread Aaron Hill

On 2024-02-14 1:59 am, Orm Finnendahl wrote:

Hi,

 I'd like to make a sign for circular bowing like in the attached
png. The example was done using an epsfile, but unfortunately that
doesn't export to svg, which I need. So it should be done using
lilypond's builtin markup commands (or scheme code). Can someone point
me to examples to do circular arcs with attached arrows (can also be
scheme code)?

I couldn't find anything similar in the docs/internet.


Here's a pretty simple attempt:


\version "2.22.0"

circular-bow =
-\tweak parent-alignment-X #CENTER
-\markup \overlay {
  \path #0.15
  #'((moveto 1 0)
 (curveto 1 -0.55 0.55 -1 0 -1)
 (curveto -0.55 -1 -1 -0.55 -1 0)
 (curveto -1 0.55 -0.55 1 0 1)
 (curveto 0.33 1 0.55 0.85 0.707 0.707)
  )

  \translate #'(0.707 . 0.707)
  \rotate #-45
  \fontsize #-5
  \general-align #X #0.2
  \arrow-head #X #RIGHT ##t
}

{ c''1^\circular-bow }



-- Aaron Hill

Re: Skipping syllables from lyrics

2024-02-13 Thread Aaron Hill

On 2024-02-13 11:05 am, Morten Lemvigh wrote:

Hi,

I have some choir pieces, where all voices are singing the same verses, 
but
in some places one voice is omitting one or a few words. Is there some 
way
of skipping syllables from the lyrics from within the voice context. 
Like
entering "null notes" that would be bound to lyrics but cause them to 
not
be rendered? For example in the music for the tenor voice I would like 
to

enter "skip 2 syllables from the lyrics at this point".

My current alternative is to create lyric snippets for all the 
consecutive

parts and then glue them together for each voice. But with just a few
skipped words in a couple of voices it quickly becomes unmanageable.
Alternatively I could have complete copies of each verse for each 
voice,

but making corrections to that is not very attractive.

Any ideas for a better approach are highly appreciated.


Tags can be useful for keeping things organized:


\version "2.22.0"

words = \lyricmode {
  one two
  \tag soprano { three four }
  \tag alto { \markup \italic three __ _ }
  five
}

soprano = \relative {
  c''4 a g b | c1
}

alto = \relative {
  e'4 f e8 d~ 4 | e1
}

\new ChoirStaff <<
  \new Staff = staff <<
\new Voice = soprano { \voiceOne \soprano }
\new Voice = alto { \voiceTwo \alto }
  >>
  \new Lyrics \with { alignAboveContext = staff }
\lyricsto soprano { \keepWithTag soprano \words }
  \new Lyrics
\lyricsto alto { \keepWithTag alto \words }
>>



-- Aaron Hill

Re: Compute \tempo from variables

2024-02-01 Thread Aaron Hill

On 2024-02-01 7:36 am, David Hobach wrote:

Hi all,

I'd like to compute the \tempo directive from variables, but couldn't 
yet figure out how to do it.


For example, let's say I have two variables such as
myTempoBase = 4
myTempo = 80

Then I'd like to do something such as
global = {
\key c \major
\time 4/4
\tempo \myTempoBase = \myTempo
}

I'd expect it to resolve to \tempo 4 = 80. The above code however fails 
on 2.24.1.


Any ideas?



myTempoBase = ##{ 4 #}


That seems to work.  Otherwise, myTempoBase is just a number and not a 
duration.



-- Aaron Hill



Re: In 2.24, EADG string tuning for bass guitar tablature?

2024-01-30 Thread Aaron Hill

On 2024-01-30 8:20 am, Kevin Cole wrote:

Are you able to provide a link to the source score?  If it shows both
the tablature as well as standard notation, it should be pretty easy 
to

verify the intended tuning.


A newer MWE plus images that illustrate my question... a bit:


\version "2.24.2"
\language "english"

riff = \relative {
  \time 5/4
  \clef "bass_8"% I assume from examples that's right.
  c8[ g8] r8 c,8 ds8[ g8] f4 f'8 r8
}

\score {
\new Staff
  <<
\new Voice\with { \omit StringNumber }   \riff
\new TabStaff \with { stringTunings = #bass-tuning } \riff
  >>
}


original.png is what I'm copying from and mwe.png is what the above 
produces.


NOTE: I've changed mandolin-tuning back to bass-tuning.


Ok, the source does just use the standard EADG tuning.

But the reason mandolin-tuning did not work is that the strings are 
tuned too high for the notes.  Compare from string-tunings-init.ly:



\makeDefaultStringTuning #'bass-tuning \stringTuning 
\makeDefaultStringTuning #'mandolin-tuning \stringTuning 


Now LilyPond is going to prefer fretting closer to the nut, so you will 
need to use string numbers to get the output to match the source 
tablature which is the ideal fretting position for that measure.


And be careful with the \clef command being inside the \riff music 
variable.  TabStaff has its own specialized clef for printing the word 
"TAB".  You'll only want to apply the \clef to the Staff.



\version "2.22.0"
\language "english"

riff = \relative {
  \time 5/4
  c8\2[ g8\3] r8 c,8\4 ds8\4[ g8\3] f4\3 f'8\1 r8
}

\score {
  \new StaffGroup <<
\new Staff \with { \omit StringNumber } { \clef "bass_8" \riff }
\new TabStaff \with { stringTunings = #bass-tuning } { \riff }
  >>
}


(StaffGroup will also get you that nice bracket out front.)


-- Aaron Hill



Re: In 2.24, EADG string tuning for bass guitar tablature?

2024-01-30 Thread Aaron Hill

On 2024-01-30 7:17 am, Kevin Cole wrote:

I don't play bass guitar and my music theory-fu leaves a lot to be
desired, but I am attempting to transcribe from an existing score that
shows a tablature staff explicitly saying that it uses EAGD tuning.
After poking around a bit, I found that the mandolin uses the same
tuning (? I don't play any stringed instruments. So maybe that's not
right.)



Speaking as a bass player, EAGD just looks like someone fat-fingered the 
standard EADG tuning.  You would almost certainly have to re-string with 
lighter gauge to achieve it (especially if that D is a high D).  That, 
or the tuning results from swapping the D and G strings of the standard 
form, producing more interesting fingerings that the original bassist 
preferred.  (Some lefties who learned on right-handed basses are used to 
the upside-down fingerings, so it is not impossible to imagine a lefty 
getting a true left-handed bass but still wanting an upside-down or 
nearly upside-down layout.)


Are you able to provide a link to the source score?  If it shows both 
the tablature as well as standard notation, it should be pretty easy to 
verify the intended tuning.



-- Aaron Hill



Re: Piece, to be centered and \Large

2024-01-28 Thread Aaron Hill

On 2024-01-28 6:06 am, Bernhard Kleine wrote:

ERROR: In procedure ly:parse-file:

In procedure reverse!: Wrong type argument in position 1:
("print-all-headers" . #f)


Drat, was hoping I could cheat a bit and use an older version of 
titling-init.ly as a reference.  Obviously something changed so that the 
code is not correct.


Okay, so 2.25.x titling-init.ly should look something like this:


scoreTitleMarkup = \markup { \column {
  \if \should-print-all-headers { \bookTitleMarkup \hspace #1 }
  \fill-line {
\fromproperty #'header:piece
\fromproperty #'header:opus
  }
}
}


Just apply the changes to the \fill-line section as you need.


-- Aaron Hill



Re: Piece, to be centered and \Large

2024-01-28 Thread Aaron Hill

On 2024-01-28 3:44 am, Bernhard Kleine wrote:

I am sorry: I can read it having some experience with latex, but I am
unable to twist it to my purpose.


No worries.

One option would be to insert a \null markup so \fill-line has three 
things it needs to play with (i.e. something to the left, something 
centered, and something to the right).



\paper {
  scoreTitleMarkup = \markup { \column {
    \on-the-fly \print-all-headers { \bookTitleMarkup \hspace #1 }
    \fill-line {
  \null
      \fromproperty #'header:piece
      \fromproperty #'header:opus
    }
  }
  }
}


If you do not care about the opus header field, you could just omit it 
altogether. Then \fill-line only needs to deal with one thing:



\paper {
  scoreTitleMarkup = \markup { \column {
    \on-the-fly \print-all-headers { \bookTitleMarkup \hspace #1 }
    \fill-line { \fromproperty #'header:piece }
  }
  }
}


Oh, and in your original question you mentioned wanting to adjust font 
size, so you can do that too:



  \larger \fromproperty #'header:piece



-- Aaron Hill



Re: Piece, to be centered and \Large

2024-01-28 Thread Aaron Hill

On 2024-01-28 12:09 am, Bernhard Kleine wrote:

\header {
  title = "Pastoral-Messe in C"
  piece = "Kyrie"
}


If you take a look at titling-init.ly, you'll see the default definition 
of scoreTitleMarkup.



scoreTitleMarkup = \markup { \column {
  \on-the-fly \print-all-headers { \bookTitleMarkup \hspace #1 }
  \fill-line {
\fromproperty #'header:piece
\fromproperty #'header:opus
  }
}
}


From this, we can see that piece and opus normally occupy the same line 
(piece to the left, opus to the right).  All you need to do is provide a 
customized scoreTitleMarkup in your \paper that applies the header 
fields how you wish.



-- Aaron Hill



Re: Include all files in a folder

2024-01-21 Thread Aaron Hill via LilyPond user discussion

On 2024-01-21 4:43 pm, Karlin High wrote:

The question was answered in 2016:

<https://lists.gnu.org/archive/html/lilypond-user/2016-08/msg00560.html>

What would be the current version of the answer?


\includePattern [1] has a \version statement with 2.24.0, so it would 
appear to still be relevant.


[1]: 
https://github.com/openlilylib/oll-core/blob/master/util/include-pattern.ily



-- Aaron Hill



Re: Two novice questions

2024-01-17 Thread Aaron Hill via LilyPond user discussion

On 2024-01-17 10:00 am, Knute Snortum wrote:
On Wed, Jan 17, 2024 at 9:48 AM Peter Mayes  
wrote:

2. I have a lot of consecutive notes all staccato. Marking each one
individually is a bit of pain. Any way to specify that the next *n* 
notes

are all staccato?



I'd like to know the answer to that one too!  It may be something that
could go in Frescobaldi, if you use that editor.



What about LSR 82?
https://lsr.di.unimi.it/LSR/Item?id=82


-- Aaron Hill



Re: Including input files via command line

2024-01-16 Thread Aaron Hill via LilyPond user discussion

On 2024-01-16 10:12 am, Benjamin Bruce wrote:
Is there a way to compile multiple input files into one output file via 
the command line? Currently I am using \include, but I would like to be 
able to choose the included file on the fly without editing the main 
file.


If I recall correctly, LilyPond will process each source file included 
on the command-line individually.  You could use the shell to 
concatenate all your sources together and pass them via standard input.  
(Pass the filename "-" to LilyPond to instruct it to read from STDIN.)



Another thought I had was maybe there is a way to pass a value to the 
.ly file via the command line and use Scheme to choose the appropriate 
file to import based on that value. But that may be even more 
far-fetched.


You could do this, but my Spidey-Sense™ tingles and suggests this may be 
an XY problem.  But I simply do not have enough information about what 
you are needing to accomplish.


But for reference:

lilypond -e '(define-public a 42)'

Then within your .ly source, you'll need to bring in the guile-user 
module:



#(use-modules (guile-user))

%% The variable `a` should now be in scope.




NOTE: All of the above is documented in the first sections of the Usage 
manual.

https://lilypond.org/doc/v2.24/Documentation/usage/command_002dline-usage


-- Aaron Hill



Re: Setting the emoji font

2024-01-16 Thread Aaron Hill via LilyPond user discussion

On 2024-01-16 9:12 am, YTG 1234 wrote:
I want to use emoji within markup, and I can see in the output log that 
Lilypond can't find a character in its default emoji font (Symbola). I 
can't figure out how to override the default font.


%%%

\markup {
    "" %% This character isn't be found
}

%%%

I saw an old thread recommending to use \override #'(font-name . 
"..."), but that doesn't seem to work in modern versions (I'm on 
2.25.11). Overriding the serif font doesn't work either, as I don't 
think Lilypond tries it at all.


Cannot reproduce locally running either 2.22.0 or 2.25.11.


\version "2.22.0"

\markup
{     }

\markup
\override #'(font-name . "DejaVu Sans")
{     }

\markup
\override #'(font-name . "Segoe UI Emoji")
{     }


This probably has less to do with LilyPond and nearly everything to do 
with FontConfig and what fonts are installed and accessible.  At the 
very least, the markup \override command has not changed behavior, as 
far as I can tell.  And what works on my machine is largely irrelevant 
to what you'll need to do on your system.


Things to check: Run LilyPond with the -dshow-available-fonts option and 
grep the output to ensure the font in question appears.  If it does not, 
then something may be screwy with FontConfig.  If the font does appear, 
then make sure you input the name fully with the font-name override.  
Some fonts include as part of their family name what appears to be a 
style, and this has been known to cause problems.  Adding a trailing 
comma seems to help, e.g. use "Times New Roman," instead of "Times New 
Roman".



-- Aaron Hill



Re: Can I define custom bar lengths in LilyPond?

2024-01-16 Thread Aaron Hill via LilyPond user discussion

On 2024-01-16 8:06 am, Hajo Baess wrote:

Hello LilyPond users,

I wonder if there is a possibility to define a custom bar length, thus
for once cancelling LilyPond's automatic insertion of bar lines.

I have a complicated measure here with quite a bit of markup to
accommodate in one bar. I have worked out a solution which is maybe
good enough, but it contains lots of tweaks in order to squeeze
everything into the automatically assigned bar length.

If I could define my own bar lengths, I would get more space in the
bar, so I hope at least. My search in the documentation did not yield a
result for me, but maybe I did not look in the right places.

Hopefully someone here can troubleshoot me.
Any help is much appreciated.


I suspect we are going to need more information as there are at least 
two interpretations of "length" here.


This is why we highly recommend including MWEs (minimum working 
examples) with questions, as this gives us a common starting point 
without having to make potentially derailing guesses.




Length interpretation one: Metrical length (i.e. number of beats in a 
bar)


If you need to momentarily step away from the defined time signature, 
the easiest option I find is to use a cadenza--a section of music that 
is not bound by the time signature.  Begin the section with \cadenzaOn, 
cram whatever notes you want, and then end the section with \cadenzaOff 
to resume the original time signature.


NOTE: LilyPond will not attempt to subdivide a cadenza on its own for 
the purposes of line breaking.  You can of course provide hints using 
\bar "" as needed.


For more information, see: NR 1.2.3 - Displaying Rhythms; Unmetered 
Music

https://lilypond.org/doc/v2.24/Documentation/notation/displaying-rhythms#unmetered-music



Length interpretation two: Dimensional width (i.e. physical space on the 
paper)


LilyPond's spacing engine tries to keep things unified across the music, 
so notes should look consistently spaced throughout the piece.  You can 
define a new "spacing section" within your score with the aptly named 
\newSpacingSection command.  Each use of this command will break up the 
larger score into chunks that the spacing engine will handle 
independently.  There are several context properties that affect note 
spacing, and these can be adjusted within each spacing section as 
desired.


For your scenario of a measure that just needs to be wider than everyone 
else, you would at a minimum need to start a new spacing section coming 
into the measure and then start yet another section for the subsequent 
measure--a total of three sections: one before, one for the "fat" 
measure, and one after.


For more information, see: NR 4.5.2 - New Spacing Section
https://lilypond.org/doc/v2.24/Documentation/notation/new-spacing-section



If you are talking about something else entirely, please see about 
providing a brief example of what you have tried.



-- Aaron Hill



Re: Error with \layout and \context

2024-01-12 Thread Aaron Hill via LilyPond user discussion

On 2024-01-12 5:00 pm, Ivan Kuznetsov wrote:


  \layout {

\context {
   \Score
   \override BarLine.transparent = ##t
   \override SpacingSpanner.base-shortest-duration = 
#(ly:make-moment 1  8)

   \override Stem.transparent = ##t
}
\context {
   \Voice
\consists Horizontal_bracket_engraver
}
  }

}


You need to do your mods in separate \context sections.  See above.


-- Aaron Hill



Re: Transpose from major to minor key

2024-01-10 Thread Aaron Hill via LilyPond user discussion

On 2024-01-10 6:30 pm, Freeman Gilmore wrote:

Aaron Does LP have that?That would be a trick for modes other than
between major and minor and that may not work well.
Thank you, ƒg


Sorry for not linking the docs directly.

https://lilypond.org/doc/v2.25/Documentation/notation/modal-transformations


On Wed, Jan 10, 2024 at 5:20 PM Aaron Hill via LilyPond user discussion 
<

lilypond-user@gnu.org> wrote:


On 2024-01-10 1:26 pm, Butter Cream wrote:
> Hi, I have a piece of music written in the key of G major and I want
> the pitches to transpose to e minor. How do I do this.
>
> When I use the command \transpose g e it changes to E major (all g
> notes are sharped)

I think you'll need to use \modalTranspose to achieve what you want.



-- Aaron Hill



Re: Transpose from major to minor key

2024-01-10 Thread Aaron Hill via LilyPond user discussion

On 2024-01-10 1:26 pm, Butter Cream wrote:
Hi, I have a piece of music written in the key of G major and I want 
the pitches to transpose to e minor. How do I do this.


When I use the command \transpose g e it changes to E major (all g 
notes are sharped)


I think you'll need to use \modalTranspose to achieve what you want.


-- Aaron Hill



Re: Question about \include options

2024-01-08 Thread Aaron Hill via LilyPond user discussion

On 2024-01-07 11:14 pm, John Helly wrote:

Aloha.

In reading the documentation about \include 
(https://lilypond.org/doc/v2.24/Documentation/notation/including-lilypond-files), 
I find the following sentence but can't find any explanation anywhere 
about what *#f and #t *are or do.  Can anyone enlighten me, please?  
They seem to have something to do with the file system but...?


#t and #f are just the Scheme ways of indicating the Boolean values of 
true and false, respectively.  So, for a setting like relative-includes, 
#t would enable the feature; #f would disable it.



'... Complex file structures, that require to|\include|/both/files 
relative to the main directory and files relative to some other 
directory, may even be devised by 
setting|relative-includes|to*|#f|or|#t|***at appropriate places in the 
files. ...'


This part of the documentation is simply indicating that the 
relative-includes setting can be freely changed during input processing 
as needed.  So when you go to \include something, it is the current 
setting that will affect where LilyPond will search for the file in 
question.



-- Aaron Hill



Re: remove extra line in outside staff notes

2023-12-29 Thread Aaron Hill via LilyPond user discussion

On 2023-12-29 7:01 am, Cordelia wrote:

Hello,

is it possible to remove the outside staff lines notes in a "\override 
StaffSymbol.line-count =  #1"?

Thank you,
Cordelia


Are you referring to ledger lines?


\layout {
  \context {
\Staff
\override StaffSymbol.line-count =  #1

\remove "Ledger_line_engraver"
% or %
\omit LedgerLineSpanner

  }
}



-- Aaron Hill



Re: Help with music function

2023-12-18 Thread Aaron Hill via LilyPond user discussion

On 2023-12-17 9:33 pm, Mark Probert wrote:

Hi.

I'm struggling some with writing a music function for rests.  Basically 
I

want to be able to write something like

 \rel-rest( b', 1)


Minor nit: Functions in LilyPond do not use parentheses and commas for 
arguments in this way.  You need only say something like the following 
to invoke your function:



 \rel-rest b' 1



which would place a dotted quarter rest on the indicated pitch (the
equivalent of

  b'1\rest

I'm starting with

rel-rest =
#(define-music-function (pit dur) (ly:pitch? ly:duration?)
  #{
#pit#dur\rest
  #})

but that gives me an error.

Any suggestions?


There are a few things the errors in the output log should be 
communicating.



Unbound variable: #{pit\#dur\\rest}#


Firstly, whitespace is important in Scheme.  Jamming together 
#pit#dur\rest gives the parser little hope to understand what you mean.  
It thinks this refers to a singular named thing, which in this context 
does not exist.


So, give each part of that expression some room to breathe:


 #pit #dur \rest


But then LilyPond is not satisfied that this represents a valid music 
expression.  When using variables, often the number sign (#) is correct, 
however there are some spots when you need to use the dollar sign ($) 
instead.



 $pit $dur \rest


Lastly, I am not sure why using the duration "1" as you indicated would 
result in a dotted quarter rest.  Did you mean "4." or is the point of 
the music function to manipulate the inputs in some way?  I am not sure 
I see the connection/logic there, so you are going to be a bit on your 
own there.


But with the modification indicated above, you can now do this:


{ \rel-rest b' 4. }

%% ...or even...

{ \rel-rest b'4. }


However, this feels like more typing than just using the \rest 
post-event, apart from being prefixed.



-- Aaron Hill



Re: Can't call some functions from translation-functions

2023-12-16 Thread Aaron Hill via LilyPond user discussion

On 2023-12-16 5:27 am, Aaron Hill wrote:

On 2023-12-16 5:20 am, Sebastian Käppler wrote:

Hello Aaron,

thanks for your response. I tried use-modules and got "

no code for module (scm display-lily)".

If that is of interest, I use Frescobaldi on Windows with lilypond 
2.24.1.


Oh, whoops.  I'm still back on 2.22.0, myself.

I think it's (use-modules (lily display-lily)) now.


Sigh, and adding the mailing list back to the thread for visibility.  
Sorry about that.



-- Aaron Hill



Re: Can't call some functions from translation-functions

2023-12-16 Thread Aaron Hill via LilyPond user discussion

On 2023-12-16 4:48 am, Sebastian Käppler wrote:

Hello,

I'm trying to use some of the functions in translation-functions.scm to
create my own note name markup. However, if I use 
note-name->lily-string or
octave->lily-string, I get an "unbound variable" error for that 
function. I
even tried to copy the whole note-name-markup code from the source to 
my
code and rename it to note-name-custom-markup. But if I use this in 
\set

noteNameFunction, I get that same error.
Sorry if this is a dumb question, but I'm still trying to familiarize
myself with most concepts of scheme...


Odd.  A function like note-name->lily-string is exported from 
define-music-display-methods.scm.


Have you tried adding an explicit...

  (use-modules (scm display-lily))

...in your source file?


-- Aaron Hill



Re: lilypond "preprocessor"?

2023-12-12 Thread Aaron Hill

On 2023-12-12 1:04 pm, David Kastrup wrote:

Aaron Hill  writes:


#(define (add-midi-to-score score)
  (define (has-midi? score)
(any (lambda (x) (ly:output-def-lookup x 'is-midi))


Wouldn't that need to be (ly:output-def-lookup x 'is-midi #f) ?


The default is to return '() which I thought was falsey.


-- Aaron Hill



Re: lilypond "preprocessor"?

2023-12-12 Thread Aaron Hill

On 2023-12-12 12:06 pm, Stefano Antonelli wrote:

On Tue, 2023-12-12 at 02:31 -0800, Aaron Hill wrote:

Would this not work?


#(define (add-midi-to-score score)
   #{ \score { $score \midi {} } #})

toplevel-score-handler =
#(lambda (score)
   (collect-scores-for-book (add-midi-to-score score)))



Indeed it does!

Without a \midi block one midi file is produced.

However, if there is already a \midi block, two midi files are
produced.  I'm not sure if that's going to be a problem aside from the
extra processing time.


Any better?


#(define (add-midi-to-score score)
  (define (has-midi? score)
(any (lambda (x) (ly:output-def-lookup x 'is-midi))
 (ly:score-output-defs score)))
  (if (has-midi? score) score
#{ \score { $score \midi {} } #}))



-- Aaron Hill



Re: lilypond "preprocessor"?

2023-12-12 Thread Aaron Hill

On 2023-12-12 2:01 am, Jean Abou Samra wrote:

One thing occurred to me.  If the original \score did not have a \midi
block, would it be possible to ask lilypond to produce midi output
without modifying the input file?




No, this is not currently possible, although it would be a nice 
addition.


Would this not work?


#(define (add-midi-to-score score)
  #{ \score { $score \midi {} } #})

toplevel-score-handler =
#(lambda (score)
  (collect-scores-for-book (add-midi-to-score score)))



-- Aaron Hill



Re: lilypond "preprocessor"?

2023-12-11 Thread Aaron Hill

On 2023-12-10 9:33 pm, Stefano Antonelli wrote:

On Sun, 2023-12-10 at 08:46 -0500, Michael Werner wrote:

I'm not at all familiar with ly2video, so I really have no idea if
this'll be directly useful to you. But for getting the headers from
an included file, this is how I do it with nearly all the music I
engrave. Maybe it can serve as a starting point.


The issue is that ly2video parses anotherFile.ly directly and it can't
see the fields in the header block because they are defined in song.ly.
 It doesn't have lilypond's smarts to parse "\include song.ly".


(Apologies for jumping in here.)

Why should ly2video need any such smarts at all?  Since there are myriad 
ways an end user can structure their input files, let LilyPond do its 
job and have ly2video ask it for all the information needed.  It sounds 
like ly2video is already injecting code to add new engravers and what 
not for extracting timing details.  Do the same but dump all of the 
relevant header fields while you are at it.  At this point, ly2video 
only needs to parse this extracted data and can completely ignore what 
the end user is doing in their source.


P.S.  I should note that I have never used ly2video before, so I am 
commenting mainly as an outside observer to this use case.



-- Aaron Hill



Re: Lyricmode and fonts

2023-12-06 Thread Aaron Hill

On 2023-12-06 12:32 am, Henning Hraban Ramm wrote:

You can override a whole Lyrics context with
\override Lyrics.LyricText.font-shape = #'italic

But that’s only suitable if you have your versions in different lines.


Pretty sure this would work for a single Lyrics context:


\lyricmode {
  nor -- mal text
  \override LyricText.font-shape = #'italic
  i -- tal -- ic text
  \revert LyricText.font-shape
  nor -- mal text a -- gain
}



-- Aaron Hill



Re: Pickup measure

2023-10-27 Thread Aaron Hill

On 2023-10-27 6:13 pm, Will Turner wrote:

I imported a Musicxml file of a hymn. The first measure is a pickup
measure but it imports as a full measure 3/4 with only a quarter note
in it. You can see that the measure appears to contain room for 3
beats instead of one. When I play this in Musescore, it plays as a
pickup measure, and the measure doesn't have all that space in it.

Using \partial 4 on the first measure, I'm trying to make the existing
first measure look like a pickup measure and, if possible, actually be
a pickup measure. The result I get looks like this. It redistributes
the other measures and the end of every line is now a pickup measure.
How do I make only the first measure a pickup measure?


Without the .ly file itself, it is hard to say.

But I suspect the quarter notes from the first measure are being 
converted to something like 4*3, essentially making a quarter take up 
the whole time of the measure, which sort of looks like a pickup note.  
(This would likely be a problem with the source XML or the converter.)


When you add the \partial 4, the first quarter duration of the 4*3 is in 
the anacrusis and then its other two quarters of time push the dotted 
quarter to beat three, which leads to all the other alignment errors.



-- Aaron Hill



Clipping of ornamentation glyphs (was: what is the musical ornament...)

2023-10-27 Thread Aaron Hill

On 2023-10-27 6:57 am, Mark Stephen Mrotek wrote:

\downprall

See:
https://lilypond.org/doc/v2.22/Documentation/notation/list-of-articulations#ornament-scripts


I just noticed something with both that version of the documentation as 
well as 2.25 [1].  The curl of the "up" or "down" is getting clipped at 
the top and bottom of the ornamentation snippets.  However, "line" seems 
to be intact.  Are the bounds of these curl glyphs not being calculated 
correctly in the underlying font?  Or is something else causing the 
snippets to clip too tightly?


[1]: 
https://lilypond.org/doc/v2.25/Documentation/notation/ornament-scripts



-- Aaron Hill



Re: Setting line-width for individual lines

2023-10-16 Thread Aaron Hill

On 2023-10-16 7:15 pm, Benjamin Bruce wrote:
I know how to set line-width in the \layout block to apply it to the 
whole score. But is it possible to set line-widths on an individual 
line basis (or for groups of lines), for example one width for lines 
1-2, and then a different width for lines 3-4? I know about 
ragged-right, but I don't like the look of the ragged edge and would 
rather have the power to specify just how wide I want each line to be.


Perhaps something like \pseudoIndents from LSR 1098 [1] would be 
helpful.


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


-- Aaron Hill



Re: lilypond 'not recognized'

2023-09-28 Thread Aaron Hill

On 2023-09-28 12:22 am, Jean Abou Samra wrote:

Le jeudi 28 septembre 2023 à 06:26 +, bobr...@centrum.is a écrit :
Understood.  As noted in my original post, I also still have v2.22.2 
installed
which I installed with the installer.  The fact that I installed 
2.22.2 with
the installer leaves me puzzled as to why I can't invoke it without 
the full

path.


I think you might need to call it as "lilypond.exe", not "lilypond". Or 
maybe
"lilypond-windows.exe". I don't really know much about Windows 
terminals though.


lilypond-windows.exe differs only in that the executable targets the GUI 
subsystem.  The effect is that it runs without needing to spawn a 
visible terminal window with the process.  When setting up file 
association for .ly files, it can be very useful.  If you are already in 
a console environment however, then there should be no functional 
difference between lilypond.exe versus lilypond-windows.exe.


In general, executable types (.exe, .com, .bat, .cmd...) are assumed by 
the classic* command prompt, so typing "lilypond" should be able to find 
and resolve to a "lilypond.exe" in the PATH if it exists.  You can run 
"where lilypond" to verify not only that it is being found but also the 
locations of all matches if there are multiple.


(* By "classic", I mean the old-school cmd.exe shell.  If you are 
running an alternate shell such as PowerShell, then you will need to 
consult its documentation.)



-- Aaron Hill



Re: Initial rests in MIDI not included?

2023-09-27 Thread Aaron Hill

On 2023-09-27 4:20 am, Kevin Cole wrote:
I just tried it again with the attached, and still do not get "The 
Sound of

Silence" ;-)

$ cat mwe.ly
\version "2.24.2"
\language "english"
global = {
  \time 4/4
  \key f \major
  \tempo 4=150
}
PartFour = \relative a {
  \global
  \clef "treble"
  \partial 4 a4
}
\score {
  \new Voice = "PartFour" {
R1*32 R1*24
\repeat unfold 4 {
  \transpose c c,, { \PartFour  }
}
  }
  \midi { }
}

$ lilypond mwe.ly
GNU LilyPond 2.24.2 (running Guile 2.2)
Processing `mwe.ly'
Parsing...
Interpreting music...
MIDI output to `mwe.midi'...
Success: compilation successfully completed

$ timidity mwe.midi
Playing mwe.midi
MIDI file: mwe.midi
Format: 1  Tracks: 2  Divisions: 384
Text: creator:
Text: LilyPond 2.24.2
Track name: \new:PartFour
Playing time: ~5 seconds
Notes cut: 0
Notes lost totally: 0


Loads into a sequencer as expected, so the MIDI file itself seems fine.


-- Aaron Hill

Re: Voice synthesis

2023-04-25 Thread Aaron Hill

On 2023-04-25 4:34 am, Andrew Bernard wrote:
As an aside, MIDI has no representation of text so the VST I pointed 
out and other suggestions will be best done in a DAW.


There are lyric meta events [1] that you can include in a standard MIDI 
file.


[1]: 
https://www.midi.org/specifications/file-format-specifications/standard-midi-files/smf-lyric-meta-event-definition



-- Aaron Hill



Re: Voice synthesis

2023-04-25 Thread Aaron Hill

On 2023-04-25 3:53 am, J Martin Rushton wrote:

I was playing back a MIDI piece and wondered if anyone had ever
combined voice synthesis with MIDI?  I know that you can get MIDI
"ah"s, but I was meaning voiced from the text like a text reader.

Purely idle wondering, no-one need to make any great effort and I don't
(currently) have a use case.  It just seemed the next step in the
development of computer music.


You could look into Vocaloid.  Its origins are with Japanese phonetics, 
but I have heard folks use it for other languages.



-- Aaron Hill



Re: How to fix markup horizontal position relative to edge of page

2023-04-12 Thread Aaron Hill

Hello all,
I am trying to layout some documents where the score is centered on the 
page, and underneath it is some markup text that is aligned left, 
relative to the edge of the page. In some documents the score will be 
wider, in some it will be narrower, but the text below it should always 
be in the same horizontal position relative to the page.


One option I did not see mentioned was putting the score into a markup 
to horizontally center it:



asdf = \score {
  \relative { c'4 d e f \break g a b c }
  \layout { line-width = 4\in }
}

\markup \fill-line { \null \score { \asdf } \null }



-- Aaron Hill



Re: How to fix markup horizontal position relative to edge of page

2023-04-10 Thread Aaron Hill

On 2023-04-10 2:35 pm, Ya Gloops wrote:

...Bacon ipsum...


Ah, I see you are an individual of culture.  :)


-- Aaron Hill



Re: conflict in dymanics signs

2023-04-06 Thread Aaron Hill

On 2023-04-06 2:26 pm, Dario Marrini wrote:

Thanks Aaron,
but, forgive me because I' wasn't clear in my request, my goal is to 
get a
MIDI file performing the crescendo while making the right expression 
inside

of it, then my request; if it'd be possible get it while keeping the
original writing it'd be better


I am not sure LilyPond is able to accurately perform this passage as 
intended via MIDI.


If I were sequencing this, I would use a combination of CC messages for 
both channel volume to perform the overall crescendo up to the 
fortissimo and expression level to perform the swelling/damping of the 
paired hairpins.  (Channel or key aftertouch is another option, but that 
requires a synth/patch that support it.)  That is not to say this is the 
only way to sequence this passage, but LilyPond is going to be limited 
to note-on velocities.




The crescendo and decrescendo events are indeed in conflict and cannot 
coexist on the same Voice.  You could move the \cresc and terminating 
\ff to another Voice or a Dynamics context (as shown below):



  << { b\> g\! es\< g\! f\> es\! b\< es\! f2\) f-> f-> f-> }
 \new Dynamics { s2*7\cresc s2\ff } >>


Note that the \cresc above results in a dynamics line spanner which you 
could remove:



  s2*7 -\tweak DynamicTextSpanner.style #'none \cresc


Also note the fortissimo lives vertically aligned to the "cresc." text.  
But a little tweak moves it closer to the note:



  s2 -\tweak Y-offset #1 \ff


Of course, I think the line spanner helps clarify the passage, so I 
would keep it and leave the \ff position alone.



-- Aaron Hill



Re: conflict in dymanics signs

2023-04-06 Thread Aaron Hill

On 2023-04-06 1:39 pm, Dario Marrini wrote:

Hi lilypond people,
I'm trying to transcribe an orchestral part; this is a solo Oboe part;
there is a "cresc" ending in a "ff", but in the meanwhile there are
other dynamics signs (expression?); I don't know how to combine the
general crescendo with single dynamics expression signs; lilypond
warning me about a conflict, and it ignores the two 'decrescendo'
signs; how to do for nesting expression signs inside the longer and
general crescendo? I would get it keeping the score original signs.

the original

the lily output :

the code :

as'\(\! b\cresc\> g\! es\< g\! f\> es\! b\< es\! f2\) f-> f-> f->\ff


Probably the easiest option is to use markup for the "cresc." text:

%%%%
  b\>_\markup \italic "cresc."



-- Aaron Hill



Re: -dgui option dropped in 2.24 - how to stop the black box on Windows now?

2023-04-03 Thread Aaron Hill

On 2023-04-03 10:31 am, Jean Abou Samra wrote:
Le 3 avr. 2023 à 12:21, Richard Shann  a 
écrit :


Is there any chance the developers might re-instate the
lilypond-windows.exe?


Maybe. Is it as easy as compiling with -mconsole ? Does that have other 
effects to take care of? Is there a use case where the current mode is 
important or could we just switch to the other mode?


LilyPond would still need to be able to be run purely from the terminal, 
so the main target should continue to use the console subsystem.  This 
importantly covers the scenarios of scripting and automation where you 
need standard I/O to be mapped properly.


The use case for a third-party GUI application running LilyPond 
behind-the-scenes is where the "windows" subsystem could be useful, 
providing the application is unable to spawn the child process in a 
hidden manner.


This goes to my question of which application has the real problem.  
Denemo relied on LilyPond providing two entrypoints, so it was not 
really at fault.  But Denemo probably should have been spawning the 
worker process hidden to begin with, thus never relying on 
lilypond-windows.exe in the first place.  However, that would require 
working around glib to use the Win32 API directly (and adding 
platform-specific development overhead), or by getting the glib 
developers to expose the underlying process creation flag.  But for all 
I know, it might be out-of-scope for glib to support this scenario, thus 
pushing the work back to Denemo.


It should be noted that this dual subsystem approach is very common on 
Windows.  Take the Windows scripting host itself.  It comes in two 
flavors: wscript.exe and cscript.exe.  The first is for use without an 
attached terminal, and the second is meant to be run from the 
command-line.  Java likewise has always shipped with two frontends: 
java.exe and javaw.exe.  So, LilyPond would not be doing anything 
unusual by shipping two executables.



-- Aaron Hill



Re: -dgui option dropped in 2.24 - how to stop the black box on Windows now?

2023-04-03 Thread Aaron Hill

On 2023-04-03 3:19 am, Richard Shann wrote:

On Sun, 2023-04-02 at 11:54 -0700, Aaron Hill wrote:

I have never looked at Denemo or its source code, so what I am going
to
say might not be so trivially applicable.
 But in the Win32 API, you can
call CreateProcess and use the process flag CREATE_NO_WINDOW.


You were quite right to be doubtful - Denemo tries to off-load the
target machine dependent stuff onto libraries, in this case glib which
provides the routine to spawn a process, and sadly does not expose the
CREATE_NO_WINDOW part of the Win32 API.


Ah, such is the bane of cross-platform programming.  Often these edge 
cases get overlooked with API abstractions.




For now I'll disable the autocompilation option for Windows with
LilyPond 2.24. Is there any chance the developers might re-instate the
lilypond-windows.exe?


The question of the hour is: Is this a LilyPond problem or a Denemo 
problem?  (Well, one could also ask whether this is a glib problem.)  If 
another third-party tool like Frescobaldi is still working given the 
change in LilyPond, then the case could be made that this is something 
best addressed in Denemo itself.  However, if LilyPond could easily 
provide both entrypoints as it used to, then the issue should be filed 
against LilyPond.




This is something I have not tested, but there are some indications that 
the subsystem of a Windows portable executable can be changed after it 
has been built.  There are two references to Perl modules that do this:


  https://metacpan.org/pod/Win32::Exe
  https://metacpan.org/dist/Tk/view/exetype

It sounds like you could manually copy lilypond.exe to 
lilypond-windows.exe and then change the copy's subsystem.  Not really a 
long-term solution, but it might help you keep auto-compilation as that 
really does sound like a useful workflow.



-- Aaron Hill



Re: -dgui option dropped in 2.24 - how to stop the black box on Windows now?

2023-04-02 Thread Aaron Hill

On 2023-04-02 8:38 am, Richard Shann wrote:

there used to be an executable lilypond-windows.exe in addition to the
lilypond.exe which has also vanished. I suspect it was compiled using
the option

-mconsole

passed to gcc as this is how Denemo is compiled to avoid leaving a
terminal around that would tempt the user to kill everything by
dismissing it (Windows users are generally not familiar with
terminals).


Yup.  On Windows, the executable takes two forms based on whether it is 
CLI-based or GUI-based.  lilypond-windows.exe was in all practical ways 
identical to lilypond.exe except that it had WinMain as its entrypoint 
instead of main.  This meant Windows did not automatically allocate a 
console window.  Do note that even GUI-based applications are afforded a 
text console but they must explicitly call the AllocConsole API.




If I understand this correctly, it looks like I will have to spawn a
process that runs a windows batch file that processes the command line
parameters and synthesizes the names of the log file that LilyPond used
to create and then calls LilyPond with re-direction of the output. I'm
not sure that this can be done without a terminal popping up to annoy
the user.


I have never looked at Denemo or its source code, so what I am going to 
say might not be so trivially applicable.  But in the Win32 API, you can 
call CreateProcess [1] and use the process flag CREATE_NO_WINDOW [2].  
This should prevent the console window appearing if the child process is 
CLI-based.


[1]: 
https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa
[2]: 
https://learn.microsoft.com/en-us/windows/win32/procthread/process-creation-flags




Is there anyway of spawning a LilyPond 2.24 process on Windows now
without plaguing the user with terminals?


You might be able to shim with a VBS wrapper.  I do this a lot for 
custom scheduled tasks that would normally run in the terminal but that 
I do not want to interrupt what I am doing by spawning a window at odd 
times.  Something like this should work, passing arguments to the script 
along to LilyPond:



' Turn WScript.Arguments into a proper array.
Dim args()
ReDim args(WScript.Arguments.Count - 1)
For i = 0 To WScript.Arguments.Count - 1
  args(i) = Chr(34) & WScript.Arguments(i) & Chr(34)
Next

Dim shell
Set shell = WScript.CreateObject("WScript.Shell")
shell.Run "lilypond.exe " & Join(args), 0, True


NOTE: The important parameter here is the zero (0) to shell.Run.  This 
hides the spawned process.  The True waits for the child process to 
finish, which probably is what you need for this use case.  But if you 
just want to fire off a child process and not have the scripting host 
stick around, change that to False.



-- Aaron Hill



Re: temporarily overriding paper variables

2023-03-29 Thread Aaron Hill

On 2023-03-29 1:51 am, Werner LEMBERG wrote:

Alas, it *still* doesn't work as expected.  Obviously, I have
simplified the code example too much: adding a `ChordNames` context
prevents alignment.  Note that the top skyline of the chord symbol
doesn't show anything suspicious.


Okay, then I think we are hitting something else.

I imagine this whole business with inverted vertical extents working 
only sometimes is by fluke, not by intentional design.


Would it suffice for you to remove the global padding and manually 
insert any spacing where it is needed as opposed to trying to remove the 
padding in the spot where you do not need it?  Not knowing what you are 
trying to tackle, this might be a non-trivial amount of work.  But I 
think it might be best option given that it does not rely on the 
uncertain behavior of internal arithmetic.



-- Aaron Hill



Re: temporarily overriding paper variables

2023-03-29 Thread Aaron Hill

On 2023-03-28 11:51 pm, Werner LEMBERG wrote:

\markup \with-dimensions #'(0 . 0) #'(0 . -2.5) \column {
  \vspace #0.55
  "foo"
}

I want the violin clef touch the top edge of the page.


Ah, you need to adjust the vertical extent in the other direction:


\markup \with-dimensions #'(0 . 0) #'(2.5 . 0)
  \general-align #Y #UP "foo"


The vertical extents #'(0 . -2.5) and #'(2.5 . 0) both have the same 
effective height of -2.5 units, however they have a different relative 
starting point which is important for what may appear *below* the 
markup.  In my example, I needed the red rectangle to snugly fit with 
the scores on both sides, so I apologize that it was not very clear how 
the vertical extent had been altered to achieve that.


Also, do use \general-align to avoid futzing with \vspace in your 
markup.



-- Aaron Hill



Re: temporarily overriding paper variables

2023-03-28 Thread Aaron Hill

On 2023-03-28 8:26 am, Werner LEMBERG wrote:

It would be cool if this worked some day.  However, the next best
thing would probably be to allow negative widths and heights for
`\markup` boxes (if set with `\with-dimensions` and friends).


Was messing about a bit.  Does this work on your side?


\version "2.22.0"

\paper {
  score-markup-spacing =
  #'((basic-distance . 0) (minimum-distance . 0)
 (padding . 4) (stretchability . 0))

  markup-system-spacing =
  #'((basic-distance . 0) (minimum-distance . 0)
 (padding . 4) (stretchability . 0))
}

\score { { b'4 } \layout { indent = 0 } }

\markup
  \with-color #green \filled-box #'(0 . 10) #'(0 . 5) #0

\score { { b'4 } \layout { indent = 0 } }

\markup
  \with-dimensions #'(0 . 0) #'(-1 . -4)
  \general-align #Y #UP
  \with-color #red \filled-box #'(0 . 10) #'(0 . 5) #0

\score { { b'4 } \layout { indent = 0 } }



-- Aaron Hill

Re: temporarily overriding paper variables

2023-03-28 Thread Aaron Hill

On 2023-03-28 2:34 am, Werner LEMBERG wrote:

```
\markup \with-dimensions #'(0 . 0) #'(0 . 0) {
  ...
}


If you don't want vertical padding, your horizontal dimensions must
be an empty interval, not a point interval.


OK, but how do I do that for `\markup`?


Maybe this:   \markup \with-dimension #X #empty-interval ...

(Assumes you are using 2.24 that supports the axis-specific command.)


-- Aaron Hill



Re: Vertical position of Tie and Script

2023-03-26 Thread Aaron Hill

On 2023-03-26 4:45 am, Mark Mathias wrote:

Perhaps try:



\version "2.24.0"
{
   \override Tie.outside-staff-priority = #1375
   c''1--~ c''
   c''1--~ c''
}

%

And, of course, add "\once" for a particular instance.


When you find you are doing \once \override, you should consider \tweak:


{ c''1-- \tweak outside-staff-priority 12345 ~ c'' }


If this is something you need to do a lot, you can define a cheeky 
shorthand:



veryOutside = \tweak outside-staff-priority 8675309 \etc

{ c''1-- \veryOutside ~ c'' }



-- Aaron Hill



Re: Coda/Segno sign color override not working: LiliyPond 2.24.0

2023-03-25 Thread Aaron Hill

On 2023-03-25 7:58 am, Mark Mathias wrote:

Oops... Except it doesn't. The accent remains black when I run it in
2.24.0. (I'm only beginning to get a glimmer of how to use Scheme with
LilyPond.)


Hmm... I currently run 2.22 for my scores, and the snippet from the 
email thread does appear to work.  Perhaps something changed in 2.24 
that breaks the snippet's usage of a before-line-breaking procedure.


Here is something I threw together that utilizes a custom music function 
to do something similar, albeit with a local effect rather than global:



\version "2.22.0"

tweakArticulations =
#(define-music-function
  (articulation property value music)
  (string? key-list? scheme? ly:music?)
  (define (process-articulation art)
   (let ((type (ly:music-property art 'articulation-type)))
(if (string=? articulation type)
#{ \tweak $property $value $art #}
art)))
  (define (process-music mus)
   (let ((arts (ly:music-property mus 'articulations #f)))
(if (list? arts)
(ly:music-set-property! mus 'articulations
  (map process-articulation arts)))
mus))
  (music-map process-music (ly:music-deep-copy music)))

asdf = { b'4 -. -+  2 -\tweak font-size 3 -> -. 4 -+ -> }

{
  %% Example of applying one tweak:
  \tweakArticulations accent color #red \asdf

  %% Example of chaining multiple tweaks:
  \tweakArticulations stopped color #green
  \tweakArticulations stopped padding 2 \asdf
}



-- Aaron Hill

  1   2   3   4   5   6   7   8   9   10   >