Re: Altering beamed stem lengths

2021-12-11 Thread Aaron Hill

On 2021-12-11 8:29 pm, Ahanu Banerjee wrote:

Hello,

I am working with 2 simultaneous voices, and I want to increase the
distance between the beamed stems of one voice and the noteheads of the
other voice. Is there some way to set a minimum distance between the 
beams

and noteheads, i.e., "padding"? I don't want to manually override
Stem.details.beamed-lengths or Beam.positions each time.

Here is an example:

\version "2.20.0"
%normal output%
<< { g'8 [ s e' s f' s d' ] } \\ { \repeat unfold 4 { s b'8 } } >>
%desired output%
<< { \override Beam.positions = #'(2.2 . 1.8)
 g'8 [ s e' s f' s d' ] } \\ { \repeat unfold 4 { s b'8 } } >>


This seems to get pretty close to what you want:


<< { g'8 -\tweak details.collision-padding 1 [ s e' s f' s d' ] } \\ { 
\repeat unfold 4 { s b'8 } } >>




-- Aaron Hill



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

2021-07-20 Thread Aaron Hill

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

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

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


AND I never got an error message.


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


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



-- Aaron Hill



Re: Forcing display of a time signature

2021-07-21 Thread Aaron Hill

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

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

it for all voices?


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



\version "2.22.0"

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



-- Aaron Hill

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

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


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


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

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


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


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

I had this:   2.22.0-1  on OS X 10.14.6

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

thanks for the quick reply.


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



-- Aaron Hill



Re: Distance between staffs

2021-07-22 Thread Aaron Hill

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

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

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

The result was this

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

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


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


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



\version "2.22.0"

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



-- Aaron Hill

Re: Extra padding between ChordNames and custom headers

2021-07-17 Thread Aaron Hill

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

Robin Bannister wrote:

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


Forget that!

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


On the contrary, it led me to this variation:


\version "2.22.0"

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

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

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

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

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



-- Aaron Hill

Re: Extra padding between ChordNames and custom headers

2021-07-17 Thread Aaron Hill

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

Any other thoughts?


Does this approach help?


\version "2.22.0"

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

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

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

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


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



-- Aaron Hill

Fix submitted for Frescobaldi #1379

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


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


-- Aaron Hill



Re: Feedback wanted: syntax highlighting in the LilyPond documentation

2022-01-04 Thread Aaron Hill

On 2022-01-04 4:19 am, J Martin Rushton wrote:

Sorry to disagree, but fixed pitch is _so_ much easier to lay out in an
editor.  Documentation flows nicely with variable pitch and fancy
hidden formats, but for code (and Lily's input is a programming
language) you just want the plain line-by-line ASCII.  It is, as you
say, industry standard; and that is for a good reason.


As a counterpoint, Knuth's work with literate programming [1] showed it 
was possible to have typographically beautiful setting of code for use 
in print.  His style largely used proportional fonts though some 
elements were still rendered in fixed width to provide useful contrast.  
While Knuth's approach is not perfect for every language, I argue the 
vast majority of programming books out there really should have followed 
suit.  Editors (the people, not programs) seem to struggle with 
fixed-width typefaces, and typos were abundant.


Going beyond printed documentation, some IDEs like Source Insight 
enabled and encouraged programmers to use proportional fonts, where 
horizontal alignment was something handled by the system not the 
programmer.  Though I do concede this was probably a novelty, seeing as 
these days terminals and editors still rely on fixed pitch.


[1]: http://www.literateprogramming.com/knuthweb.pdf


-- Aaron Hill



Re: Beam slopes

2022-01-09 Thread Aaron Hill

On 2022-01-09 12:30 pm, Виноградов Юрий wrote:

Hello. How to make a connecting beam at an angle of 90 degrees in this
code


Please review this thread [1] from last year, as I think you are looking 
for the same behavior.


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



-- Aaron Hill



Re: alternate notes within a part

2022-01-09 Thread Aaron Hill

On 2022-01-09 2:50 pm, Valentin Petzel wrote:
It depends a bit on how structured your music is. If you’ve got two 
Voices it

is reasonable to give both their own relative clause.

If you music does not have a lot of complex structure a top level 
relative is
very much find. Problematic are cases where notes within the music 
might
change, thus affecting stuff after it. This might be the case with 
tags, but
also with cues or scores in footnotes (where also someone might think 
about

adding something, and suddenly the main music body has problems.


Having been bitten more times than worth counting, I have almost 
exclusively moved to using \fixed.  The level of consistent and precise 
control means I can add, change, or remove notes as well as freely copy 
and paste music around without fear of notes being thrown off into the 
wrong octave.


That said, I think \relative is still useful as a tool for 
reasonably-scoped melodic phrases where there is much less chance for 
things to go awry.  So, if a song had, say, three main sections, I would 
probably use one \relative per, decoupling the sections from each other. 
 (Also, there is a good chance each section ends up as its own variable 
anyway.)  Going more granular might make sense if a section was 
particularly long.  At that point, the early and later notes just stop 
having any practical relationship with one another, so they might be 
better placed in their own blocks.



-- Aaron Hill



Re: alternate notes within a part

2022-01-09 Thread Aaron Hill

On 2022-01-09 2:05 pm, David Zelinsky wrote:

Is there a better way to accomplish what I'm trying to do?  Or do I
really just need to maintain completely separate versions for the two
instruments?


You can certainly use the tag approach, just keep a few things in mind.

Firstly, you should use simultaneous music in places where the tagged 
parts are in parallel.  This should avoid the issues with bar check 
failures as the music remains valid time-wise without needing to remove 
tags.


Secondly, \relative should be used in a more restrictive scope, not as a 
top-level tool where changes to pitches often have unexpected side 
effects, or you run into issues with tagged material.  \fixed is 
certainly an option to consider, although for many melodic phrases 
\relative is really quite handy.


Consider this below:


foo = {
 \relative b' { | b4 a8 g fis2 }
 << \tag one \relative g' { | g8 a b d e2 }
\tag two \relative e' { | e4 d cis2 } >>
 \relative g' { | g1 \bar "|." }
}

<< \new Staff \with { instrumentName = "both" } \foo
   \new Staff \with { instrumentName = "one" } \keepWithTag one \foo
   \new Staff \with { instrumentName = "two" } \keepWithTag two \foo >>



-- Aaron Hill



Re: Hebrew and Latin fonts

2022-01-07 Thread Aaron Hill

On 2022-01-07 6:13 am, Hilber, Simon wrote:

in 2019 I produced a little booklet with Hebrew and German songs - in
version 2.18.2. The German text was rendered in a font with serifs, the
Hebrew text was in a font without serifs. Now (with a new pc and 
version
2.20) with the input, text in both languages is produced in a serif 
font. I
would prefer the previous fonts. How is it possible to globally define 
the
fonts for Latin and Hebrew fonts respectively? I know how to change it 
for

a particular text with \override - but I need a solution for the whole
document since it is a lot of text.


At some point, LilyPond changed the default fonts to the TeX Gyre family 
(Schola, Heros, and Cursor).


You just need to switch the global font back to whatever you liked 
before, for instance:



\paper {
  #(define fonts
(set-global-fonts
 #:roman "New Century Schoolbook"
 #:factor (/ staff-height pt 20)))
}



-- Aaron Hill



Re: Ornament question

2022-01-14 Thread Aaron Hill

On 2022-01-14 12:13 am, Jacques Menu wrote:

What is the name of the ‘up arc’ ornament on the first note in this
score? Then I’ll look it up in the LPNR.


I think "scoop" might be the term.  Did we ever get a \bendBefore as the 
logical companion to \bendAfter?



-- Aaron Hill



Re: fonts on windows

2022-01-15 Thread Aaron Hill

On 2022-01-15 5:43 pm, Michael Rivers wrote:

That sounds exactly like the case. Would anyone happen to know how to
install the fonts system-wide?


It is an option when you right-click to install a font.  Look for 
"Install for all users" which should have the elevation shield next to 
it.



-- Aaron Hill



Re: fonts on windows

2022-01-15 Thread Aaron Hill

On 2022-01-15 5:52 pm, Michael Rivers wrote:

Yes, I managed to figure that out. It would be nice if Lilypond could
find fonts for the current user too.


Definitely.  Looks to be an issue with fontconfig [1] and not LilyPond.

[1]: https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/144


-- Aaron Hill



Re: fonts on windows

2022-01-15 Thread Aaron Hill

On 2022-01-15 5:14 pm, Michael Rivers wrote:
I'm pretty sure text fonts on Windows are kaput. Some work, some don't. 
The
fonts I'd like to use show up as installed properly in Settings and 
work in
all other apps I've tried, but not Lilypond. I'm on Windows 11, but 
I've

also tried on Windows 10.


Are your fonts installed for all users or just your own account?  Back 
in the day, fonts were always stored system-wide in %WinDir%\Fonts.  At 
some point, Microsoft introduced an option for user-specific fonts which 
are located in %LocalAppData%\Local\Microsoft\Windows\Fonts.  Depending 
on how LilyPond enumerates fonts, it might only be picking up the 
system-wide ones.



-- Aaron Hill



Re: fonts on windows

2022-01-15 Thread Aaron Hill

On 2022-01-15 5:40 pm, Aaron Hill wrote:

which are located in %LocalAppData%\Local\Microsoft\Windows\Fonts.


No, stupid webmail client.  That is not the path I pasted into the 
message.  Where did that extra \Local even come from?!  (Roundcube is 
getting really buggy lately.)


%LocalAppData%\Microsoft\Windows\Fonts is the correct path.


-- Aaron Hill



Re: How to input a diminished7 (maj7) chord?

2022-01-11 Thread Aaron Hill

On 2022-01-11 12:21 pm, Flaming Hakama by Elaine wrote:

%  I am not sure why this one does not work
-\markup { \super "o7(△7)" }


Wrong octave for the C flat.  Use .


-- Aaron Hill



Re: More about stencil

2022-02-13 Thread Aaron Hill

On 2022-02-13 11:43 am, Rip _Mus wrote:

Hello everyone,
thanks to your many suggestions, I was able to get a little into the
perspective of modifying the stencils.
I created a stencil modification that adds a small arrow (sort of a
glissando) to the left of the note or accident.
However, I cannot understand why the ascending arrows let the stem no
longer attached to the notehead. Do you have any ideas?


Modifying the NoteHead stencil as you are doing changes its extents, 
thus affects the attachment point.  One option is to add the arrow to 
the final stencil but preserve the original extents:



  (ly:stencil-outline
(ly:stencil-combine-at-edge arr X RIGHT note 0)
note)


(The above approach might result in collisions.)

Another option would be to utilize Fingering as a host grob, as that 
already handles alignment with notes whether or not accidentals are 
present:


(Below also I show an alternate method for defining the arrows, so that 
a shared symbol is simply rotated.  Custom extents are specified so that 
the arrows align as desired.)



double-right-arrow =
#(ly:stencil-add
  (make-line-stencil 0.1 -0.9 0.1 -0.1 0.1)
  (make-line-stencil 0.1 -0.9 -0.1 -0.1 -0.1)
  (make-line-stencil 0.15 -0.3 0.3 0 0)
  (make-line-stencil 0.15 -0.3 -0.3 0 0))

glis-su-arrow =
#(ly:make-stencil
  (ly:stencil-expr
   (ly:stencil-rotate double-right-arrow 45 RIGHT CENTER))
  '(-0.7 . -0.2) '(-0.3 . 0.7))

glis-giu-arrow =
#(ly:make-stencil
  (ly:stencil-expr
   (ly:stencil-rotate double-right-arrow -45 RIGHT CENTER))
  '(-0.7 . -0.2) '(-0.7 . 0.3))

glis-giu =
#(define-music-function
  (note) (ly:music?)
  (ly:music-set-property! note 'articulations
   (cons
(make-music 'FingeringEvent 'digit 1
 'tweaks (list (cons (quote stencil) glis-giu-arrow)))
(ly:music-property note 'articulations '(
  #{ \once \set fingeringOrientations = #'(left)
 #(make-event-chord (list note)) #})

glis-su =
#(define-music-function
  (note) (ly:music?)
  (ly:music-set-property! note 'articulations
   (cons
(make-music 'FingeringEvent 'digit 1
 'tweaks (list (cons (quote stencil) glis-su-arrow)))
(ly:music-property note 'articulations '(
  #{ \once \set fingeringOrientations = #'(left)
 #(make-event-chord (list note)) #})

\new Staff {
  \relative c' {
\once \override Score.FootnoteItem.annotation-line = ##f
\footnote "*" #'(-0.2 . -1) "* glissando at the end of previous 
note" NoteHead

\stemDown \glis-giu f2 \glis-su b |
\glis-giu fis4 \glis-su bes2.
\glis-giu c32 \glis-su c c c c c c c
\glis-giu c \stemUp \glis-giu c
  }
}


Since Fingerings must be inside a chord (i.e. <>) construct in order to 
respect fingeringOrientations, the music functions above have to do some 
manipulation of the argument.  Depending on how you intend on using 
these arrows in context, it might be worth the time to invent a custom 
grob instead rather than cannibalize something built-in.



-- Aaron Hill



Re: DynamicTextSpanner spacing

2022-03-05 Thread Aaron Hill

On 2022-03-05 3:49 pm, Erika Pirnes wrote:

I would like the dotted line of the crescendo to start a bit later and
end a bit earlier. It is too close to "cresc.", in my opinion at
least. And sometimes too close to the "f" as well. (A tiny detail, for
sure, but it looks annoying.) Any ideas?
[...]
music = \relative c' {
  \repeat unfold 5{c8 \p \cresc d e f g a b4 c8 \f b c2.}
}


You will need to play around with the bound-details for the 
DynamicTextSpanner:



\version "2.18.2"

\relative c' {
  %% The space before the left side of the spanner.
  %% (NOTE: This includes the attached stencil.)
  %% Default is 0.75; we are adding two units of space.
  \override DynamicTextSpanner.bound-details.left.padding = #2.75

  %% Since we want the space between the stencil and
  %% line, we need to shift the stencil over a bit.
  %% Default is (-0.75 . -0.5); we move it left by the
  %% same increment we applied to the padding above.
  \override DynamicTextSpanner.bound-details
.left.stencil-offset = #'(-2.75 . -0.5)

  %% The space after the right side of the spanner.
  %% Default is 0.75; we are adding two units of space.
  \override DynamicTextSpanner.bound-details.right.padding = #2.75

  %% (For debugging only...)
  %% Highlight the grob in red for better visibility.
  %% Also make the line solid to show its extents clearly.
  \override DynamicTextSpanner.color = #red
  \override DynamicTextSpanner.dash-fraction = #1

  \repeat unfold 5{ c8 \p \cresc d e f g a b4 c8 \f b c2. }
}



-- Aaron Hill



Re: VS: DynamicTextSpanner spacing

2022-03-06 Thread Aaron Hill

On 2022-03-05 5:26 pm, Erika Pirnes wrote:

Thank you Aaron, it seems to work! But what does stencil mean exactly?


Sorry for the delay.  Within the bound-details, the stencil refers to 
the associated text or graphic that is attached to the left (or right) 
end of the spanner line.  In this case, it would be the text "cresc.".



-- Aaron Hill



Re: Should \partial accept music instead of duration?

2022-03-19 Thread Aaron Hill

On 2022-03-19 7:53 pm, Dan Eble wrote:

On Mar 19, 2022, at 20:53, Aaron Hill  wrote:
...
A convert-ly rule would probably not be possible given the limited 
power
of regular expressions.  As such, \partial might need to support 
both

duration and music arguments.  Initially I thought this might not be
possible, given that a naked duration can be treated as music; but 
the

following does seem to work:

...

I wouldn't want to have to explain to users why these turn out 
different.


\score {
  \fixed c' {
\partial 4. 4.
  }
}

\score {
  \fixed c' {
\partial c4. c4.
  }
}



Fair point, though the intention here would be that backwards 
compatibility would only need to exist for a time.  A warning could be 
issued whenever a user applies the older syntax; this would inform the 
user of the impending breaking change while still allowing existing code 
to compile.  When it is convenient, a future release would only support 
music as the argument.



-- Aaron Hill



Should \partial accept music instead of duration?

2022-03-19 Thread Aaron Hill

Here would be a possible refactoring:


\version "2.22.0"

partial =
#(define-music-function (mus) (ly:music?)
  (_i "Make a partial measure.")
  (let* ((mom (ly:music-length mus))
 (dur (make-duration-of-length mom)))
(make-music 'SequentialMusic
  'elements
  (list (context-spec-music
  (make-music 'PartialSet
  'origin (*location*)
  'duration dur)
  'Timing)
mus


\fixed c' {
  \time 3/4
  \partial { g8 a4 }
  | g2. \bar "||"
  \partial { \grace { g16 } a8 b }
  | a2. \bar "||"
  \partial \tuplet 3/2 { g8 fis }
  | g2. \bar "|."
}


A convert-ly rule would probably not be possible given the limited power 
of regular expressions.  As such, \partial might need to support both 
duration and music arguments.  Initially I thought this might not be 
possible, given that a naked duration can be treated as music; but the 
following does seem to work:



\version "2.22.0"

#(define (duration-or-music? arg)
  (or (ly:duration? arg) (ly:music? arg)))

partial =
#(define-music-function (arg) (duration-or-music?)
  (_i "Make a partial measure.")
  (if (ly:duration? arg)
(context-spec-music
  (make-music 'PartialSet
  'origin (*location*)
  'duration arg)
  'Timing)
(let* ((mom (ly:music-length arg))
   (dur (make-duration-of-length mom)))
  (make-music 'SequentialMusic
'elements
(list (context-spec-music
(make-music 'PartialSet
'origin (*location*)
'duration dur)
'Timing)
  arg)


\fixed c' {
  \time 3/4
  \partial 4. g8 a4 %% Original syntax works.
  | g2. \bar "||"
  \partial { \grace { g16 } a8 b }
  | a2. \bar "||"
  \partial \tuplet 3/2 { g8 fis }
  | g2. \bar "|."
}



-- Aaron Hill

Re: Should \partial accept music instead of duration?

2022-03-19 Thread Aaron Hill

On 2022-03-19 5:46 pm, Thomas Morley wrote:

Am So., 20. März 2022 um 00:02 Uhr schrieb Aaron Hill
:


Here would be a possible refactoring:


\version "2.22.0"

partial =
#(define-music-function (mus) (ly:music?)
   (_i "Make a partial measure.")
   (let* ((mom (ly:music-length mus))
  (dur (make-duration-of-length mom)))
 (make-music 'SequentialMusic
   'elements
   (list (context-spec-music
   (make-music 'PartialSet
   'origin (*location*)
   'duration dur)
   'Timing)
 mus


\fixed c' {
   \time 3/4
   \partial { g8 a4 }
   | g2. \bar "||"
   \partial { \grace { g16 } a8 b }
   | a2. \bar "||"
   \partial \tuplet 3/2 { g8 fis }
   | g2. \bar "|."
}


A convert-ly rule would probably not be possible given the limited 
power

of regular expressions.  As such, \partial might need to support both
duration and music arguments.  Initially I thought this might not be
possible, given that a naked duration can be treated as music; but the
following does seem to work:


\version "2.22.0"

#(define (duration-or-music? arg)
   (or (ly:duration? arg) (ly:music? arg)))

partial =
#(define-music-function (arg) (duration-or-music?)
   (_i "Make a partial measure.")
   (if (ly:duration? arg)
 (context-spec-music
   (make-music 'PartialSet
   'origin (*location*)
   'duration arg)
   'Timing)
 (let* ((mom (ly:music-length arg))
(dur (make-duration-of-length mom)))
   (make-music 'SequentialMusic
 'elements
 (list (context-spec-music
 (make-music 'PartialSet
 'origin (*location*)
 'duration dur)
 'Timing)
   arg)


\fixed c' {
   \time 3/4
   \partial 4. g8 a4 %% Original syntax works.
   | g2. \bar "||"
   \partial { \grace { g16 } a8 b }
   | a2. \bar "||"
   \partial \tuplet 3/2 { g8 fis }
   | g2. \bar "|."
}



-- Aaron Hill


Hi Aaron,

I really like it! Always wondered why we need to specify a duration,
if it can be taken from the music.
I'd suggest to propose it on devel. Preferable the second coding,
because we could nicely deprecate the old syntax for some versions.


*facepalm*  I thought I was sending to devel.  Well, folks on user might 
want to chime in too.



-- Aaron Hill



Re: partCombine misinterprets Solo

2022-03-23 Thread Aaron Hill

On 2022-03-23 1:52 am, David Santamauro wrote:

mm 1- 3 and 3-6 are note-identical. The only difference is the
decrescendo in m. 1, terminated in m. 2. I believe the terminating
decrescendo in vTwo/m. 2 causes the partCombine code to think there's
music in vTwo/m. 2 -- I could be wrong, but the result is wrong
nevertheless.


The part combiner sometimes needs hints.

Consider adding...

  \once \partCombineSoloI

...at the beginning of the second measure.


-- Aaron Hill



Re: Ignore stems

2022-03-25 Thread Aaron Hill

On 2022-03-25 5:11 am, Simon Albrecht wrote:

Hello everybody,

I want to try having Lyrics placed without regard for any stems in the
adjacent staff (and then using whiteout to remedy the clash, of
course). The below approach doesn’t work. Why? Can I make it work?


You'll typically need to use negative padding to get overlapping ink.


  \override VerticalAxisGroup.nonstaff-relatedstaff-spacing =
#'((minimum-distance . 4.5) (padding . -2))



-- Aaron Hill



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Aaron Hill

On 2022-03-20 3:17 am, David Kastrup wrote:

Aaron Hill  writes:

Fair point, though the intention here would be that backwards
compatibility would only need to exist for a time.


I strongly disagree since \partial with a duration is the natural and
proper expression when writing a separate timing track.


Natural, I can see.  Proper... I would need more information backing 
that claim.  Certainly if there is a technical basis, I would be eager 
to review it.  If sound, then I could retract my proposal and answer the 
email subject with "no".


In my timing/global/structure variables, expressions like \partial 4 s4 
are common.  Certainly \partial 4 would be most succinct, but it creates 
no actual duration in sequential music.  Naturally, the spacer rest is 
used so later commands occur when I need them.  My proposal leads to 
\partial s4 as a reasonable construct that avoids redundancy.  (See 
below regarding NullVoice.)




A warning could be issued whenever a user applies the older syntax;
this would inform the user of the impending breaking change while
still allowing existing code to compile.  When it is convenient, a
future release would only support music as the argument.


4. _is_ valid music.


Yes, and it works with the updated \partial function.  The only side 
effect is that it might produce a visible note (of unspecified pitch), 
because that is what 4. as music means.  If used in a NullVoice context, 
it should work the same as s4. which means we are back to the original 
syntax.  The key difference is that \partial 4. would now have musical 
length.



-- Aaron Hill



Re: Should \partial accept music instead of duration?

2022-03-20 Thread Aaron Hill

On 2022-03-20 1:13 am, Leo Correia de Verdier wrote:

Entirely replacing the actual syntax would not be desirable in my
opinion. Consider the case when it is used in a “global” part/variable
in an orchestral score that usually contains rehearsal marks, tempo,
key and time signature changes and such. As I understand it having
\partial to accept only music as argument would have to move to each
part, which would introduce unnecessary typing and disrupt the logic
of the structure. Sure it can be worked around, but I would see it as
a step backwards. Or have I misunderstood?


All of those things *are* music, as far as LilyPond is concerned.  It is 
just that commands like \tempo have no duration, so the following is 
nonsensical since the music has zero length:


   \partial \tempo 4 = 90

Your "global" variable likely uses spacer rests which are providing the 
length information, so the change to \partial usage ultimately looks 
like this:


   \partial 4 s4   =>   \partial s4

This removes the otherwise redundant specification of the duration.


-- Aaron Hill



Re: Delay for list posts to arrive

2022-02-01 Thread Aaron Hill

On 2022-02-01 2:50 pm, Jean Abou Samra wrote:

Lately I've found myself a couple times duplicating answers
already provided on this list by others up to almost three
hours earlier because I had not received these replies yet.
Now the little delay for posts to get in inboxes is a quirk
inherent to mailing lists, but three hours seems a bit much.
I'm wondering: are others experiencing this as well?


Yes.  Though it is inconsistent.

Check the timestamps in the email headers.  This tends to be what I see:

- Original sender's mail goes from their server to the eggs.gnu.org (the 
spam filter, IIUC).

- eggs.gnu.org processes the mail and hands it off to lists.gnu.org.
- The email goes from "localhost" (?) to lists.gnu.org.  [This is where 
the delay usually happens.]

- My mail server gets the email from lists.gnu.org.


-- Aaron Hill



Re: Right justifying text between systems

2022-02-08 Thread Aaron Hill

On 2022-02-07 11:04 pm, Alasdair McAndrew wrote:
\markup {\hspace #70 \fontsize #2 {\italic {Au Rondeau puis au 
premier}}}


For right-alignment, you should use \fill-line:


\markup \fill-line { \null \italic "Lorem ipsum..." }




I could do this by adding the text as a markup to one of the notes in
the bottom staff of Rondeau II, but then it's too close to the score
block.


You could use a RehearsalMark at the very end with appropriate padding:


\paper { #(set-paper-size "a5") }

Rondeau.I = { R1*13 \bar "||" }
Rondeau.II = { R1*13 \bar "||" }
Bourree.I = { R1*13 \bar "|." }

\score { \header { piece = "Rondeau I" } { \Rondeau.I } }
\score { \header { piece = "Rondeau II" }
 { \Rondeau.II
   \tweak break-visibility #end-of-line-visible
   \tweak direction #DOWN
   \tweak font-size #0
   \tweak padding #2
   \tweak self-alignment-X #RIGHT
   \mark \markup \italic "Repeat Rondeau I" }
}
\score { \header { piece = "Bourree I" } { \Bourree.I } }



-- Aaron Hill



Re: Moving a tie horizontally

2022-02-07 Thread Aaron Hill

On 2022-02-07 3:28 pm, Jean Abou Samra wrote:

For now, you have to use the \shape command documented at


The shape seems fine, just needs to be offset to optically align with 
the slashed note heads:



music = { \time 3/4 2~4~8~8~2~16~8~16~4.~8 }

<<
\new RhythmicStaff { \music }
\new RhythmicStaff \with {
  \improvisationOn
  \override Tie.extra-offset = #'(-0.4 . -0.6)
} { \music } >>


NOTE to OP: For a single-line rhythm, consider using RhythmicStaff.


-- Aaron Hill



Bar numbers on lines beginning with a partial measure

2022-02-06 Thread Aaron Hill
I have for quite some time just relied on the default behavior where bar 
numbers are printed only for the first measure in each line (save the 
very first measure).  This works reasonably well as my musicians are 
able to locate measures by number fairly quickly.  However, there is an 
issue when I opt to split measures over a line break.  (This practice is 
quite common in hymnals, though I find it equally effective for modern 
music to avoid having pickup/trailing notes/lyrics straddling a line 
break.)  When the first measure on a line is a partial measure, no bar 
number is shown.  This means some lines in my lead sheets have no bar 
number for reference.  In some cases, I end up with no automatic bar 
numbers at all.


(Some code for context/reference...)


midMeasureBreak = { \bar "" \break }
forceBarNumber =
\once \override Score.BarNumber
  .break-visibility = #all-visible

{ R1*4 \break
  R1*4 r2 r4 \midMeasureBreak r4
  R1*4 r2 r4 \midMeasureBreak r4
  \forceBarNumber
  R1*4 \bar "|." }


As can be see above, I can manually override the bar number visibility, 
but it is not very elegant.  If I opt to reflow music, I would have to 
revisit the bar numbers to make sure only the ones I want are there.  It 
would be very nice if LilyPond could treat the first full measure as the 
effective first measure on the line w.r.t. break visibility settings.


Has anyone else encountered this and come up with a solution?  If not, I 
will dig around the existing engraver logic and see about submitting a 
patch should folks find the updated behavior desirable.



-- Aaron Hill



Re: associate text with chords

2022-02-06 Thread Aaron Hill

On 2022-02-06 5:08 am, achar wrote:

P.S.: I already received answers but, they evaporated before I could
read them


You can review the archives [1] if you lose track of a message.  
Although, since your original thread is barely two days old, you should 
strongly reconsider your service provider if they are purging emails 
that quickly.


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



-- Aaron Hill



Re: Bar numbers on lines beginning with a partial measure

2022-02-06 Thread Aaron Hill

On 2022-02-06 1:37 am, Jean Abou Samra wrote:

Are you aware of the options to print a parenthesized bar number at
the start of the line if it's the continuation of a measure? See
input/regression/bar-number-visibility-* (sadly missing documentation
at the moment). I don't have an opinion on whether that is better
practice or not than what you suggest. It is, at any rate, what Gould
recommends (Behind Bars p. 490).


Thanks, Jean.  first-bar-number-invisible-save-broken-bars is one of the 
undocumented options that seems almost perfect.


At first glance, though, the parenthesized numbers stand out too much.  
Thankfully, the parenthesization logic is within 
robust-bar-number-function, which is easily adaptable as Scheme code.  
Some quick testing with the \parenthesize markup command looks better 
than relying on the glyphs of the number font which are a little too 
wide.



;; ...preamble from robust-bar-number-function...
  (let*
   ((number-and-power (get-number-and-power 0 0))
(begin-measure (= 0 (ly:moment-main-numerator measure-pos)))
(text (string-append (number->string barnum)
   (make-letter "" (car number-and-power) (cdr 
number-and-power)

  (if begin-measure text
   (markup #:override '(line-thickness . 0.05)
   #:override '(padding . 0.05)
   #:override '(width . 0.2)
   #:parenthesize #:smaller text


I will have to try this for awhile to see if I like it better than 
labelling the first full measure.  It is interesting that all bar 
numbers would be consistently aligned on the left margin, so that might 
prove useful.



-- Aaron Hill



Re: Add text to score without affecting spacing

2022-02-09 Thread Aaron Hill

On 2022-02-09 4:12 pm, Valentin Petzel wrote:

Hi Kieren,

thank you. Yes, currently I am using some tweaked Rehearsal Marks mit 
0-

dimensions and some tweaks. Just asking if there was a better way.


There are a number of grobs that normally have no visual representation. 
 You could attach your content there:



\version "2.22.0"

overlayText =
#(define-music-function
  (grob-path text)
  (key-list? markup?)
  (define (print-with-point-outline grob)
   (ly:stencil-outline
(ly:text-interface::print grob)
point-stencil))
  (define (proc grob . args)
(ly:grob-set-property! grob 'font-size -6)
(ly:grob-set-property! grob 'layer 1000)
(ly:grob-set-property! grob 'stencil
 print-with-point-outline)
(ly:grob-set-property! grob 'text text))
  #{ \applyOutput $grob-path #proc #})

{
  b'4
  \overlayText Score.PaperColumn
\markup \general-align #Y #UP "Lorem"
  4
  \overlayText Score.NoteColumn
\markup \vcenter \whiteout \box "Ipsum"
  2
}



-- Aaron Hill

Re: associate text to chord

2022-02-05 Thread Aaron Hill

On 2022-02-05 2:49 am, Kevin Barry wrote:

Hi Achar,

Let me specify : in the following example V7 / IV is not associated 
with the Eb7 chord
but with the note G. Is it possible to pair it with the Eb7 chord ? 
Thanks


We don't have a code example, so it's hard to answer your question. At
a guess, it looks like you're attaching markup to the notes and you
need to attach it to the space between A flat and G. A quick solution
could be to add a spacer rest, e.g.:

f_"II" aes2*1/2 s4_"V" g

If this is something that happens frequently in your score, I would
recommend having a separate voice - with only spacer rests - for your
Roman numerals.


Another option is to use a dedicated context for analysis.  The Lyrics 
context is a good candidate, as it supports arbitrary markup that can be 
given rhythm independant of the associated Staff.  Consider LSR 710 [1] 
as a starting point.


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


-- Aaron Hill



Re: Descenders affecting line height calculation for lyrics in columns?

2022-01-20 Thread Aaron Hill

On 2022-01-19 11:41 pm, Bernhard Fisseni wrote:

[ . . . ] In the
song, there are some lines with descenders (p, g, q going below the
baseline).  I show the effect here by inserting "q" in the left
column. Lilypond seems to calculate the "real" line height of the
writing, not some kind of nominal text line height, so that a line
with descenders is higher than a line without. [ . . . ]
Is this the expected behaviour?


No (but kind of yes).

Firstly, \column and \line work properly, respecting baseline-skip and 
word-space:



\markup
  \override #'(baseline-skip . 4)
  \override #'(word-space . 0.5)
  \box \line {
\box \line \box {
  \column \box { q q q }
  \column \box { x x x }
  \column \box { b b b }
}
\box \column \box {
  \line \box { q x b }
  \line \box { q x b }
  \line \box { q x b }
}
  }


In your code, you have nested \columns within \columns, which does not 
work the same as a singular \column would.  \column attempts to align 
the contains markups by their respective baselines.  The baseline of a 
\column ends up being the baseline of its first markup.  See:



\markup \concat {
  \column { q x b }
  "q x b"
}


Your inner \columns involve two lines of text which makes them much 
taller than the default baseline-skip would permit.  \column avoids 
overlapping ink, so it moves markups further down based on their actual 
extents.  Descenders, then, could definitely result in a taller stencil.


There are likely many ways to tackle this.  (Other folks on the list 
might chime in with their preferred method.)  The simplest option I see 
is manually adjusting the baseline-skip between the inner and outer 
\columns:



\markup {
  \fill-line {
\hspace #1
\override #'(baseline-skip . 7)
\column {
  \line { \bold "2."
\override #'(baseline-skip . 3)
\column {
  "q This is verse two."
  "q It has two lines."
}
  }
  \line { \bold "3."
\override #'(baseline-skip . 3)
\column {
  "q This is verse three."
  "q It has two lines."
}
  }
}
\hspace #1
\override #'(baseline-skip . 7)
\column {
  \line { \bold "4."
\override #'(baseline-skip . 3)
\column {
  "This is verse four."
  "It has two lines."
}
  }
  \line { \bold "5."
\override #'(baseline-skip . 3)
\column {
  "This is verse five."
  "It has two lines."
}
  }
}
\hspace #1
  }
}


The math above is that two lines at baseline-skip of three plus an extra 
staff space means an effective baseline-skip of seven.




Secondly, the stanza commands seem to call for defining a two-argument
macro like \columnstanza, but I got lost in the documentation on the
different ways and the different types of objects.


Perhaps something like this:


#(define-markup-command
  (my-stanza layout props number lines)
  (markup? markup-list?)
  (interpret-markup layout props #{
\markup \line {
  \bold #number
  \override #'(baseline-skip . 3)
  \column #lines
}
  #}))

\markup {
  \fill-line {
\hspace #1
\override #'(baseline-skip . 7)
\column {
  \my-stanza "2." {
"q This is verse two."
"q It has two lines."
  }
  \my-stanza "3." {
"q This is verse three."
"q It has two lines."
  }
}
\hspace #1
\override #'(baseline-skip . 7)
\column {
  \my-stanza "4." {
"This is verse four."
"It has two lines."
  }
  \my-stanza "5." {
"This is verse five."
"It has two lines."
  }
}
\hspace #1
  }
}



-- Aaron Hill



Re: adjusting double glissandi

2022-01-25 Thread Aaron Hill

On 2022-01-25 11:46 am, Rachel Green wrote:

Hi,
I’m trying to adjust the glissandi in this excerpt so that the lines
are parallel and not too close to each other. I found some settings
for adjusting a single glissando, but not for a double glissando. Any
ideas?


There is prior work on this subject.  Harm has provided some code [1] 
before.


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


Here is an adaptation of that logic:


glissandoTweak =
#(define-music-function
  (after? tweaks) ((boolean? #t) list?)
  (define (proc grob)
   (if after? (ly:spanner::kill-zero-spanned-time grob))
   (for-each
(lambda (x)
 (let ((prop (car x)) (value (cdr x)))
  (if (key-list? prop)
   (ly:grob-set-nested-property! grob prop value)
   (ly:grob-set-property! grob prop value
(ly:assoc-get
 (ly:grob-property grob 'glissando-index) tweaks '(
  (if after?
   #{ \once \override Glissando.after-line-breaking = #proc #}
   #{ \once \override Glissando.before-line-breaking = #proc #}))

{
 \glissandoTweak
 #`((0 . ((color . ,red)
  (Y-offset . -0.5)))
(1 . ((color . ,blue)
  ((bound-details right arrow) . #t
 2\glissando 
}



-- Aaron Hill



Re: Question on multiple markups

2022-04-12 Thread Aaron Hill

On 2022-04-12 12:25 pm, Evan Driscoll wrote:

http://lilybin.com/vhf35h/5 for example.

I have a note that has two text decorations on it, c^"pizz"_"marc", as 
well

as a dynamic \f.

By default everything gets stacked (http://lilybin.com/vhf35h/6), but 
that
gets really busy -- there's actually a tempo marking and rehearsal mark 
at
that place as well. (I also left off \italic on the marc. but it's in 
my

real version.)

I can move the TextScript object*s* with *\once \override
TextScript.extra-offset = #'(2.1 . 1.7)*, but that moves both. I'd like 
to
get the 'marc' side by side with the \f obviously without moving the 
arco

instruction.

I suspect this has to do with \tweak in there somehow but I can't 
figure

out the right incantation.


You need to use the post-event form for \tweak.  Consider:


marc = -\markup \italic "marc."

\relative c' {
 c4
  -\tweak extra-offset #'(2.1 . 1.7) _\marc
  ^"arco"
  \f
 c c c
}

\relative c' {
 c4
  -\tweak X-offset #2 _\marc
  ^"arco"
  \f
 c c c
}


NOTE: I think the X-offset tweak looks a little cleaner.


-- Aaron Hill



Re: Temporary div. multiple staffs

2022-04-06 Thread Aaron Hill

(Please keep the mailing list on all replies.)

On 2022-04-05 11:06 pm, Evan Driscoll wrote:
On Wed, Apr 6, 2022 at 12:37 AM Aaron Hill  
wrote:



Unsure there is a definitively "right" way... but here's an option:

http://lilybin.com/1l8whf/12

Move the StaffGroup declaration outside the music.  Also, you can name
contexts so you can reference an existing one to avoid creating new 
ones

(explicitly or implicitly).



Perfect, thanks!

As a final tweak, in case anyone finds this thread in the future, 
here's

how to omit the time signature on the new staff:
http://lilybin.com/1l8whf/15

Though a question -- I discovered that adding *just* the \new 
StaffGroup on

the "outside" made things work -- on the simplified example, that'd be
something like http://lilybin.com/1l8whf/16. In other words, that works
even without explicitly naming the existing Staff context and referring 
to

it with \context. Is there any difference between these, aside from
possible readability arguments?


In many cases, you can rely on the implicit handling of contexts.  Your 
example #16 above relies on the implicit continuation of the current 
context as only the divisi staff is explicitly created, so things do 
work as expected.


But note that this new staff appears below the original one.  If you 
wanted it to be above, consider:


http://lilybin.com/1l8whf/17

(I added color just to make it easier to see which context is which.)


-- Aaron Hill



Re: how to repeat a scheme function that creates a Score

2022-04-05 Thread Aaron Hill

On 2022-04-05 10:40 pm, Jeff Olson wrote:

Question (b):

My secondary question is very simple.  How do you set the seed for
scheme's "random" function (used in my gen-music.ily).  I'd like to
get the repeatability of a pseudo-random number generator.



(set! *random-state* (seed->random-state 42))


Review the Guile documentation [1]:

[1]: 
https://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/Random.html#Random



-- Aaron Hill



Re: Temporary div. multiple staffs

2022-04-05 Thread Aaron Hill

On 2022-04-05 10:20 pm, Evan Driscoll wrote:

Another question, one I've struggled with before.

The part splits out temporarily into divisi parts on multiple staffs. I
always have trouble getting the correct incantations to get the correct
result.

A naive attempt results in http://lilybin.com/1l8whf/5. This is enough 
to
keep working, but it looks bad -- barlines don't cross between staffs, 
and

there's no grouping a la
https://lilypond.org/doc/v2.22/Documentation/69/lily-9c91c2b7.png from 
the

manual.

I can get a pair of staffs that are correct on their own by creating a
StaffGroup with two new staffs -- http://lilybin.com/1l8whf/9 -- but 
the

original staff continues through. Omitting the explicit \new Staff
invocations doesn't help -- http://lilybin.com/1l8whf/11.

What's the right way to do this?


Unsure there is a definitively "right" way... but here's an option:

http://lilybin.com/1l8whf/12

Move the StaffGroup declaration outside the music.  Also, you can name 
contexts so you can reference an existing one to avoid creating new ones 
(explicitly or implicitly).



-- Aaron Hill



Re: how to repeat a scheme function that creates a Score

2022-04-06 Thread Aaron Hill

On 2022-04-05 10:40 pm, Jeff Olson wrote:

Question (a):

My main question is how to write a scheme function that will invoke my
scr function N times, where N could be a number like 1000.



#(for-each add-score (map (lambda (x) #{ \scr #}) (iota 5)))


Replace 5 with whatever.


-- Aaron Hill



Re: Temporary div. multiple staffs

2022-04-09 Thread Aaron Hill

On 2022-04-09 8:45 am, David Zelinsky wrote:

A question about Aaron's example:


You are referencing an aspect of the original source, not what was being 
demonstrated in the updated version.




What is the purpose of the following
line (line 12)?

   \once \override Staff.TimeSignature #'break-visibility = ##(#f #f 
#f)


The "\omit TimeSignature" on line 7 seems to do the trick, and in fact
as far as I can tell the above \override has no effect, even when the
\omit TimeSignaure is removed.


You are correct that the \omit alone is sufficient.  I am unsure why the 
original had the break-visibility override.


That aside, it would probably be best to use \once \omit to limit the 
scope of the command's effect.



-- Aaron Hill



Re: Generate music with scheme

2022-04-11 Thread Aaron Hill

On 2022-04-11 9:10 am, Henrik Frisk wrote:

\version "2.22.2"

{
   $(make-sequential-music
 (map (lambda (x)
(make-sequential-music
 (list
  (make-music 'NoteEvent
  'pitch
  (ly:make-pitch 0 x)
  'duration
  (ly:make-duration 2))
  (make-music 'MarkEvent
  'label
  (markup
   #:line
   (#:override (cons (quote font-size) -3)
"10"))
  (list 1 2 3 4)))
}


Thanks Jean,

It was the (make-sequential-music) after the lambda expression that I 
had
missed, without it it doesn't help to combine the two music events in 
one

list.


You could also use append-map which will concatenate the lists without 
the inner call to make-sequential-music:



{
 $(make-sequential-music
  (append-map
   (lambda (x) (list
#{ $(ly:make-pitch 0 x) 4 #}
#{ \mark \markup \override #'(font-size . -3) 10 #} ))
   (iota 4 1)))
}


In fact, using list-splicing, you can eliminate the outer call to 
make-sequential-music as well:



{
 $@(append-map
  (lambda (x) (list
   #{ $(ly:make-pitch 0 x) 4 #}
   #{ \mark \markup \override #'(font-size . -3) 10 #} ))
  (iota 4 1))
}


Also note the above use of #{ #} to escape music syntax within scheme, 
which can often be more abbreviated.



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



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: 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



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: 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: Offset ClefTransposition number

2022-05-17 Thread Aaron Hill

On 2022-05-17 7:05 am, Dimitris Marinakis wrote:

Is it possible to offset the little number that indicates the clef
transposition?
I searched the Clef internals but couldn't find anything relevant.


It is called the ClefModifier.  It would be useful to know what terms 
you used to search so we can improve the ability to find the grob for 
others in the future.



{ \override Staff.ClefModifier.color = #red
  \override Staff.ClefModifier.padding = #1
  \clef "treble_8" b4 \clef "treble^8" b''4
  \clef "bass_8" d,4 \clef "bass^8" d'4 }



-- Aaron Hill



Re: ottava spanner terminates at the end of the note, not the end of the bar

2022-05-13 Thread Aaron Hill

On 2022-05-13 8:28 pm, Kenneth Wolcott wrote:

  The ottava spanner terminates at the end of the note, not at the end
of the bar.

  How to change this?

  Screenshots attached.


Consider the following:


\version "2.22.0"

\relative c'' {
  % Be careful not to stop the ottava too soon.
  \ottava 1 c4 e g f8 d | c2. \ottava 0 r4

  % This encompasses the rest as well but is still a little too short.
  \ottava 1 c4 e g f8 d | c2. r4 \ottava 0
  c8 d b c~ c2

  % This would be nice...
  % \override Staff.OttavaBracket.to-barline = ##t
  % ...but it would appear OttavaBracket is not a
  % line-spanner-interface, where to-barline lives.

  % A manual adjustment is possible:
  \once \offset shorten-pair #'(0 . -1) Staff.OttavaBracket
  \ottava 1 c4 e g f8 d | c2. r4 \ottava 0
  c8 d b c~ c2
  \bar "|."
}


Assuming you only have a few of these you need to manage, the manual 
offset might be sufficient to let you move onto other things in your 
score.  But you will need to review these if you make any changes that 
affect the measure length.  An automated approach might be possible, but 
really I think OttavaBracket should support to-barline.  Something to 
submit to the bug mailing list I guess.




Was almost about to hit send, but then I thought... what if you hid the 
OttavaBracket but used a TextSpanner in its place?



\relative c'' {
  \once \hide Staff.OttavaBracket
  \ottava 1

  c4 -\tweak to-barline ##t
 -\tweak dash-fraction #0.3
 -\tweak dash-period #1
 -\tweak bound-details.left.text
   \markup \vcenter \bold 8
 -\tweak bound-details.right.stencil
   #(make-line-stencil 0.1 0 0 0 -0.8)
 \startTextSpan
e g f8 d

  | c2. r4 \ottava 0
  c8\stopTextSpan d b c~ c2
}


Hmm... maybe not.  That is a lot of tweaks, and I do not think I matched 
the original OttavaBracket well enough.



-- Aaron Hill



Re: Problem with a snippet "shorthand for triplets [0.21429]"

2022-06-27 Thread Aaron Hill

On 2022-06-27 6:18 am, Jean Abou Samra wrote:

The LSR runs LilyPond 2.22 and you have 2.18. You need to upgrade
LilyPond. Frescobaldi makes it easy to use several versions in
parallel.


As far as I can see, the LSR only notes the current version in 
Contributing [1].


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

Would it be possible to have this information displayed prominently on 
the search page itself?  Unless users are following the mailing list 
threads, they would not be aware of the recent upgrade to 2.22.



-- Aaron Hill



Re: Lilypond not generating PDF

2022-07-04 Thread Aaron Hill

On 2022-07-04 1:50 am, Andrew Bernard wrote:

I see from searching that the issue is with elevated and non elevated
permissions.


Where do you see this?  Drag-and-drop is a simple feature of the Windows 
shell that should require no special permission.


What are the details of the LilyPond shortcut on the desktop?  Which 
executable does it reference?  Does it specify any additional arguments? 
 What is the start directory?  etc.


For additional diagnostics and troubleshooting, I would recommend 
reviewing the behavior logged by Process Monitor [1] (from 
Sysinternals).  In particular, take note of any errors originating from 
LilyPond or its child processes.


[1]: https://docs.microsoft.com/en-us/sysinternals/downloads/procmon


-- Aaron Hill



Re: Lilypond not generating PDF

2022-07-04 Thread Aaron Hill

On 2022-07-04 3:03 pm, Paul Hodges wrote:

Blocking dropping onto elevated targets from a non-elevated desktop
has been a security feature of UAC since it was introduced a decade
and a half ago.

You can remove the restriction by running with UAC
turned off, which the security-minded will of course advise you not to
do, and many people have no clue about anyway (it is, however, the way
I run my machine, because I choose how to control my security myself).

Alternatively, you can get a third-party file manager, run it with
elevated permissions, and then drop and drop within it - but you can't
elevate Windows Explorer to try to get the same effect.


LilyPond does not require nor does it request elevation.

The UAC limitation you refer to is irrelevant, as that only concerns 
cross-application behavior where one process has a lower privilege 
level.  There would be no such problem when you are dragging and 
dropping files within the shell itself, as would be the case when 
dropping onto a desktop shortcut.



-- Aaron Hill



Re: Lilypond not generating PDF

2022-07-04 Thread Aaron Hill

On 2022-07-04 5:49 pm, Aaron Hill wrote:

On 2022-07-04 5:07 pm, Andrew Bernard wrote:

I'm sorry, I don't understand this. Dragging test.ly on the desktop to
the LilyPond icon on the desktop fails to produce the PDF output. Both
on Windows 10 and 11.


That is a different issue than the UAC drag-and-drop limitation that
was mentioned.  Elevated permissions is almost certainly a red
herring, and something bigger is likely being masked.

I will take a look and see what is going on.  Just give me some time,
as I will need to set up a test environment first.


As expected, elevation is masking an underlying issue.

The desktop shortcut is wrong.  It specifies a start directory of 
"C:\Users\Public\Desktop" which is coincidently the location in which 
the shortcut is created.  The public desktop is a special directory 
transparently replicated to all individual user desktops.  By design, it 
does not offer write permission to users.


LilyPond is failing to compile because it attempts to create a temporary 
file at that location.  Open question: Why is LilyPond not using the 
%TEMP% directory for such things?


Leaving the start directory field blank within the shortcut appears to 
fix things.



-- Aaron Hill



Re: Lilypond not generating PDF

2022-07-04 Thread Aaron Hill

On 2022-07-04 5:07 pm, Andrew Bernard wrote:

I'm sorry, I don't understand this. Dragging test.ly on the desktop to
the LilyPond icon on the desktop fails to produce the PDF output. Both
on Windows 10 and 11.


That is a different issue than the UAC drag-and-drop limitation that was 
mentioned.  Elevated permissions is almost certainly a red herring, and 
something bigger is likely being masked.


I will take a look and see what is going on.  Just give me some time, as 
I will need to set up a test environment first.



-- Aaron Hill



Re: Lilypond not generating PDF

2022-07-04 Thread Aaron Hill

On 2022-07-04 8:03 pm, Andrew Bernard wrote:

We are getting to the nub of it. When you save the test.ly file you
have to save it to C:\Users\\Desktop not the default which is
C:\Users\Public\Desktop. And make the start directory in the link
C:\Users\\Desktop [...]


Nothing should ever be defaulting to the public desktop.  Under normal 
operation, that folder will not have write permissions.  In fact, it 
should be a hidden folder and not normally visible.


Since users are able to remap their profile directory, a path like 
%userprofile%\Desktop would be better, however users with OneDrive 
enabled would find their desktop at %userprofile%\OneDrive\Desktop.




(making it blank did not work for me)


When I drag-and-drop a file onto a shortcut without a start directory, 
the current directory is getting set based on the file being dragged.  I 
see the same behavior when dropping onto the target program itself.



-- Aaron Hill



Re: Override NoteHead glyph

2022-06-22 Thread Aaron Hill

On 2022-06-22 12:19 pm, Ahanu Banerjee wrote:

Hello,

I am trying to create noteheads (without stems) that have a duration 
longer

than a quarter note (crotchet) but are filled-in. They are meant to
represent the notes that will be heard when a harmonic is played. I am 
not
sure how to do this; one workaround is to use a quarter note value and 
a
spacer rest, but this results in too much empty space. I tried 
\override

NoteHead.glyph-name = #'"noteheads.s2", but that did not work.

Example below (the notes are arbitrary):

\version "2.23.7"
\relative c''
{ << { \override Parentheses.font-size = #-1.5 \omit Flag \omit Stem
   \teeny \tweak X-offset #0.2

%% the higher voice should have filled-in noteheads

   <\parenthesize d \parenthesize f>2 } \\
 { 2 } >>  }


You can scale the duration of any note so as to preserve its normal 
appearance but take up the required length:



\fixed c' { b4*2 a | b4*3 a4 | b4*4 | a1 }



-- Aaron Hill



Re: color individual characters

2022-06-05 Thread Aaron Hill

On 2022-06-05 1:13 pm, Лысов Дмитрий wrote:

Hi. How to color individual characters in the UNICODE encoding text?


The examples did not come through for me--perhaps an encoding issue 
between our mail clients, or my mail server is just being overly 
paranoid about attachments that could contain executable code.


--

Here is an example of applying unique colorization to a character and a 
combining character:



\version "2.22.0"

\markup {
  \concat {
jalape
\with-color #blue n
\with-color #red \char ##x0303
o
  }
}


The above usage pattern does break up the input into separate pieces.  
As such, Pango observes the 'n' distinctly from the combining tilde, 
effectively preventing it from converting to the pre-composed glyph 'ñ'. 
 (In the case above, we would not want the pre-composed glyph anyway 
because we desire independent coloring.)


Fonts with more advanced replacement rules for handling complex scripts 
and ligatures will not work, as Pango needs to see the whole input to 
apply the proper logic.  And at that point, \with-color is only left 
with the option to apply color to the entire resulting stencil.



-- Aaron Hill

Re: Passing arguments to grob-transformer

2022-06-17 Thread Aaron Hill

On 2022-06-17 3:35 pm, Jean Abou Samra wrote:

Le 18/06/2022 à 00:24, Leo Correia de Verdier a écrit :

#(define elongate (lambda (grob amt)
 (let ((stil (ly:grob-property grob 'stencil)))
   (ly:grob-set-property! grob 'stencil 
(ly:stencil-scale stil 1 amt)
{  \override Accidental.before-line-breaking = #(lambda (grob) 
(elongate grob 2))

cis'2 }


#(define (elongate amt)
   (grob-transformer
    'stencil
    (lambda (grob original)
  (ly:stencil-scale original 1 amt
{  \override Accidental.stencil = #(elongate 2)
   cis'2 }


Also consider expressing this as music function:


elongate =
#(define-music-function
  (grob-path amount) (key-list? number?)
  (define proc
   (grob-transformer 'stencil
(lambda (grob orig)
 (ly:stencil-scale orig 1 amount
  #{ \override $grob-path . stencil = #proc #})

{ \elongate Staff.TimeSignature -1.5
  \once \elongate Accidental 2 cis'2 ees' }



-- Aaron Hill



Re: Left-hand end of tuplet bracket sometimes wrong

2022-06-03 Thread Aaron Hill

On 2022-06-03 10:10 am, Paul Hodges wrote:

I find that even using shorten-pair (with a negative first value)
fails to do this as I expected.  So now I don't know any way to print
the bracket with the preferred layout...


You would want to adjust the X-positions, so that the TupletNumber is 
centered properly.  See the difference:



\version "2.22.0"

{
  \offset shorten-pair #'(-1 . 0)
  \tuplet 3/2 \relative { f'4 g a }

  \offset X-positions #'(-1 . 0)
  \tuplet 3/2 \relative { f'4 g a }
}


Since an offset of one staff space is only approximate, you would need 
to consult the bounds of the NoteColumns directly:



{
  \override TupletBracket.X-positions =
  #(lambda (grob)
;; NOTE: The logic here does not fully replace
;;   ly:tuplet-bracket::calc-x-positions
(let* ((nc (ly:grob-object grob 'note-columns))
   (xref (ly:grob-common-refpoint-of-array grob nc X))
   (lb (ly:spanner-bound grob LEFT))
   (lbex (ly:generic-bound-extent lb xref))
   (lbrc (ly:grob-relative-coordinate lb xref X))
   (rb (ly:spanner-bound grob RIGHT))
   (rbex (ly:generic-bound-extent rb xref)))
(cons (- (car lbex) lbrc) (- (cdr rbex) lbrc

  \tuplet 3/2 \relative c' { 4 g  }
  \tuplet 3/2 \relative c'' { 4 d  }
}


Tuplet_Bracket::calc_x_positions relies on Item::get_x_bound_item, which 
includes the logic to prefer using the Stem of a NoteColumn as the bound 
item if the direction matches.


The code above simply ignores that behavior and computes X-positions 
purely based on the extents of the NoteColumns.  Mind you, 
Tuplet_Bracket::calc_x_positions does more work to account for 
properties like connect-to-neighbor, break-overshoot, and 
full-length-to-extent, so this is not a true replacement/fix.



-- Aaron Hill



Re: Fretboard diagrams: Why does LilyPond sometimes try to interpret ":7" as a duration?

2022-07-25 Thread Aaron Hill

On 2022-07-25 1:56 pm, Kevin Cole wrote:

frets = \chordmode { f4 c4:7 g4:7 c4 bf4 d4:m }

   ^^
Input is in chord mode.  Modifiers like :m and :7 work.


frets = { g4 c4 a4 d4:7 }

  ^
Missing \chordmode.  :7 indicates a tremolo with an invalid duration.


-- Aaron Hill



Re: Last note of a first alternative is a tie to the first note in the repeat; how to engrave this?

2022-07-28 Thread Aaron Hill

On 2022-07-28 6:29 am, David Kastrup wrote:

\laissezvibrer might be an alias,
though I am not sure whether it would not, in that function, be
deserving of some tweaks giving it a longer minimal visual length.


Isn't it also conventional to annotate it "l.v."?

If we had a more general semi-tie command, \laissezVibrer could sit on 
top of that and, as you say, tweak it to be more fitting of the original 
function name.



-- Aaron Hill



Re: Is there a SIMPLE way to embed an href in a title?

2022-07-21 Thread Aaron Hill

On 2022-07-21 8:07 pm, Kevin Cole wrote:

Hi,

The subject line pretty much says it all (or most).

Ideally, I'd like to be able to do something like:

\header {
  title = "This is the title"
}

and have Lilypond generate a PDF with the tile linking to wherever I 
point it/


I'm hoping to avoid lots of Scheme, lilypond-book, TeX, etc, etc. that
I don't understand. The cost / benefit isn't worth writing a whole lot
of additional code to accomplish the linking. (The linking isn't
critical enough to be worth a lot of time, and I can think of simpler,
though less satisfactory solutions.)


Pretty sure \with-url does that:


  title = \markup \with-url #"https://example.com/; example
%%%%


-- Aaron Hill



Re: Ties between voices

2022-07-27 Thread Aaron Hill

On 2022-07-27 1:41 am, Thomas Morley wrote:

I stumbled across a certain condition. In tie-column::add_tie there is
  (> (car (ly:grob-spanned-column-rank-interval 
tie-column))
 (car (ly:grob-spanned-column-rank-interval 
tie-column)))

How could this ever be true?


Looks to be a transcription error.  The original C++ looks like this:


if (!me->get_bound (LEFT)
  || (me->get_bound (LEFT)->get_column ()->get_rank ()
  > tie->get_bound (LEFT)->get_column ()->get_rank ()))
{
  me->set_bound (LEFT, Tie::head (tie, LEFT));
  me->set_bound (RIGHT, Tie::head (tie, RIGHT));
}


The relevant conditional check is regarding the "me" grob versus the 
"tie" grob.



-- Aaron Hill



Re: Searching fonts?

2022-07-13 Thread Aaron Hill

On 2022-07-13 10:35 pm, Alasdair McAndrew wrote:

Hello,

I'm trying to find a suitable system font for use with some tablature 
I'm
typesetting.  The command "lilypond -dshow-available-fonts" does indeed 
do
exactly that, but there are so many fonts on my system that this 
command is
not helpful on its own.  What I'd like is some way of searching the 
font

list.  For example, I'd hope to write that font list to a file, which I
could explore at leisure.

I'm using Linux, and normally I can redirect the output of a command to 
a

file, such as

ls -l > list.txt

But this doesn't work with the lilypond font command.  I'm quite 
mystified

that the lilypond somehow ignores shell commands; at least in this
instance.

This same behaviour means I can't pipe the output of the font command 
to

grep for searching.

How can I search the list of available fonts?


The fonts are output via stderr.  You'll need to use 2>&1 to redirect 
the stream.


lilypond -dshow-available-fonts 2>&1 | grep -i 'something'


-- Aaron Hill



Re: hspace in markup cancels other directives

2022-07-30 Thread Aaron Hill

On 2022-07-30 8:12 pm, Jim Cline wrote:

I am trying to use \hspace to adjust the horizontal position of a text
markup.


\hspace is probably not the best tool.  Consider \tweaking the text 
script:


  bes-\tweak self-alignment-X #RIGHT
 ^\markup \smaller \with-color #blue text

  bes-\tweak X-offset #-3
 ^\markup \smaller \with-color #blue text



  In addition I want the text to be colored and smaller.  But
the \hspace directive somehow disables the others, as in this example.

\version "2.20.0"
lower =
  \relative c {
   \time 3/4
  \clef bass
  bes^\markup{\smaller  \with-color #blue \hspace #-3 text} r4
bes^\markup{\smaller  \with-color #blue  text}
}


The effects of markup commands only apply to their specific markup 
arguments.


What you have effectively done is this:

  \markup {
\smaller { \with-color #blue { \hspace #-3 } }
text
  }

You could explicitly group the space and text:

  \markup \smaller \with-color #blue { \hspace #-3 text }

Alternately, move the space outside the other commands:

  \markup { \hspace #-3 \smaller \with-color #blue text }


-- Aaron Hill



Re: Engraving for harp as a member of an ensemble, to play midi, use piano as midi instrument?

2022-07-29 Thread Aaron Hill

On 2022-07-29 8:33 pm, Kenneth Wolcott wrote:

  SInce a harp is not a recognized midi instrument, when using midi to
verify that the rhythm and pitches are correct, should one designate
the midi instrument as an "acoustic grand" or will it automatically
resolve to that instrument?


As a long time user of General MIDI, harp is most definitely a supported 
instrument in the original specification.  It is in the "Strings" block:


47 = Orchestral Harp


-- Aaron Hill



Re: Strange issue where lilypond runs a line off the page

2022-08-29 Thread Aaron Hill

On 2022-08-29 4:03 pm, Galen Hazelwood wrote:

I don't see what other event it could be talking about. I don't know if
this is an actual problem, or my understanding of lilypond isn't good
enough yet.


It is an unbreakable beam that is blocking things.  Your \override for 
Beam.breakable applies only to the current Voice context.  When you 
create the two new Voices within the << >> construct, neither will see 
the overridden property.


You have a few options.  You can move the \override to the inner Voice 
that has the problematic beam, or you can make the outer \override apply 
to the Staff context instead:



  \override Staff.Beam.breakable = ##t
%%%%


-- Aaron Hill



Re: stringNumber fontsize and half position

2022-08-29 Thread Aaron Hill

On 2022-08-29 10:28 pm, Christophe Godefroy wrote:
Thanks a lot for the hints this was very useful.  Half position is 
noted 1/2.

I've tested the markup option but the font is quite different so to
uniform it I was looking for the same syntax


Depending on your needs, the \finger or \number markup commands might be 
sufficient.  You could also set the font to fetaText directly:



\markup {
  \finger { 1 2 } \number { 3 4 }
  \override #'(font-encoding . fetaText) { 5 6 }
}



-- Aaron Hill



Re: Why not have a Lilypond documentation set arranged as layman's Q: does LP do this?

2022-08-18 Thread Aaron Hill

On 2022-08-18 8:49 am, Kenneth Wolcott wrote:

What even makes it more difficult is when I don't even know what
something is called at all (no terminology) and/or when I have no clue
how to succinctly describe what it is that I don't know.  For example,
the tremolo; I recognized the graphic but I had no way to search for
it by appearance, only read every line of the documentation until I
find it and the "ah ha".


This is where I imagine the visual index is most helpful.  But I do 
wonder how often the Music Glossary is overlooked as a resource.  It 
includes pictures for entries; in this case, tremolo is represented.  
Going outside of LilyPond's manuals, Wikipedia has a good list [1].


[1]: https://en.wikipedia.org/wiki/List_of_musical_symbols


-- Aaron Hill



Re: How to get .ly from .pdf

2022-09-07 Thread Aaron Hill

On 2022-09-07 1:44 am, Paul McKay wrote:

Hi
I'm planning to learn Chopin's Prelude Op28 No4. I looked on Imslp and
found that Mr Snortum has already turned it into .ly. That was going to 
be
my next move because I need to add my own fingering and dynamics. On 
the
IMSLP page Knute says that the .ly files are included. (I have spotted 
that

exporting the lilypond source when making a PDF is an option in
Frescobaldi.) All the searches I have done just talk about how LilyPond
exports to PDF. Can someone please tell me how to retrieve such the .ly
from the .pdf.


There is a separate download link for the source files.

If you expand the entry, you can see the individual preludes and at the 
bottom is "Engraving Files (LilyPond)" [1].


[1]: https://imslp.org/wiki/Special:ImagefromIndex/800964/hfjn


-- Aaron Hill



Re: How to get .ly from .pdf

2022-09-07 Thread Aaron Hill

On 2022-09-07 4:04 am, Paul McKay wrote:

Thanks very much, Aaron. I hadn't noticed that. It worked perfectly.
Thanks to Knute for engraving them too. It will be *so *good to see how
real .ly files look. I will do my best to steal all the good ideas.


There is certainly no shortage of good ideas from the many users on the 
mailing list.  Anytime someone is able to publish the source for a 
real-world score, there is hope of finding some new pattern or structure 
that can streamline your own work.



-- Aaron Hill



Re: Three-column Table of Contents

2022-09-05 Thread Aaron Hill

On 2022-09-05 5:12 pm, Adam M. Griggs wrote:

That's wonderful! Exactly what I was after, all the way down to the
internal hyperlinking.


Well, all of the linking work is part of the built-in table of contents 
support in LilyPond.


For fun, though, I continued with the idea and came up with another 
approach that might be a little more extensible.  In this case, I 
demonstrate support for three data fields (not including the page 
number):



\version "2.22.0"

\paper {
  %% This is where you style an individual custom TOC item.
  %% Custom properties like toc:first should exist here.
  tocCustomItemMarkupInner =
  \markup
  \fill-line {
\line {
  \hspace #12
  \with-dimensions-from \hspace #1
  \general-align #X #RIGHT \fromproperty #'toc:first
  \bold \override #'(thickness . 2) \whiteout
  \fromproperty #'toc:second
}
\italic \override #'(thickness . 2) \whiteout
\fromproperty #'toc:third
\fromproperty #'toc:page
  }

  %% This is mainly a wrapper that stuffs the desired formatting
  %% above into a property that will be referenced by toc:text.
  tocCustomItemMarkup =
  \markup \overlay {
\fill-with-pattern #1 #RIGHT "." \hspace #13 \hspace #1
\override #(cons 'toc:inner tocCustomItemMarkupInner)
\fromproperty #'toc:text
  }
}

tocCustomItem =
#(define-music-function
  (first second third)
  (markup? markup? markup?)
  (add-toc-item!
   'tocCustomItemMarkup
   ;; This is where all of the custom properties are given
   ;; their values.  Note that we also reference toc:inner
   ;; which will get its value via tocCustomInnerMarkup.
   #{ \markup \override #(cons 'toc:first first)
  \override #(cons 'toc:second second)
  \override #(cons 'toc:third third)
  \fromproperty #'toc:inner #}
   '()))

\markuplist
\override #'(line-width . 80)
\table-of-contents

\tocCustomItem lorem ipsum dolor
\markup \null \pageBreak

\tocCustomItem sit amet consectetur
\markup \null \pageBreak

\tocCustomItem adipisicing elit sed
\markup \null \pageBreak

\tocCustomItem do eiusmod tempor
\markup \null \pageBreak

\tocCustomItem incididunt ut labore
\markup \null \pageBreak

\tocCustomItem et dolore magna
\markup \null \pageBreak

\tocCustomItem aliqua ut enim
\markup \null



-- Aaron Hill

Re: Three-column Table of Contents

2022-09-05 Thread Aaron Hill

On 2022-09-05 7:29 am, Adam M. Griggs wrote:

[ . . . ]
Given this rough mockup of the wanted end result, is it possible for me 
to

automatically generate such a ToC?


It requires working around some limitations of the built-in \tocItem.  
Importantly, \tocItem only supports providing a single markup for each 
item.  As such, \table-of-contents will only output two columns of data: 
the text for an item and its page number.


Short of ripping out the guts of \table-of-contents and allowing a more 
flexible input format, we can cheat a little.  The text of each item is 
itself markup, so you can provide much more than just a simple bit of 
text.  If we cram two pieces of data into that field, the final table of 
contents will appear to have three columns of data.


The main limitation is that we have to split up the formatting of each 
line into two parts.  So this requires careful coordination to ensure 
things lay out as expected.


Here is just one way of doing this:


\version "2.22.0"

\paper {
  myTocItemMarkup = \markup
\fill-line {
  \null
  \override #'(line-width . 50)
  \overlay {
\tiny \fill-with-pattern #0.75 #RIGHT "." \null \null
\fill-line \larger {
  \fromproperty #'toc:text
  \override #'(style . outline)
  \override #'(thickness . 3) \whiteout
  \fromproperty #'toc:page
}
  }
  \null
}

  tocDividerMarkup = \markup
\pad-around #3
\fill-line { \null ". . ." \null }
}

myTocItem =
#(define-music-function
  (piece parts)
  (markup? markup?)
  (add-toc-item!
'myTocItemMarkup
#{
  \markup \concat {
\with-dimensions-from \hspace #20
\override #'(thickness . 2) \whiteout
$piece
\override #'(thickness . 2) \whiteout
$parts
  }
#}
'()))

tocDivider =
#(define-music-function () ()
  (add-toc-item! 'tocDividerMarkup "" '()))

\book {
  \markuplist \table-of-contents

  \myTocItem "Piece I" "SSAA"
  \markup \null \pageBreak

  \myTocItem "Piece I" "SATB"
  \markup \null \pageBreak

  \myTocItem "Piece II" "SSAA"
  \markup \null \pageBreak
  \markup \null \pageBreak

  \myTocItem "Piece II" "SATB"
  \markup \null \pageBreak
  \markup \null \pageBreak
  \markup \null \pageBreak

  \myTocItem "Piece II" "TTBB"
  \markup \null \pageBreak
  \markup \null \pageBreak
  \markup \null \pageBreak
  \markup \null \pageBreak
  \markup \null \pageBreak

  \tocDivider

  \myTocItem \markup \bold "Piece XXVI"
 \markup \italic "SSAATTBB"
  \markup \null
}



-- Aaron Hill

Re: smaller Text at CueVoice

2022-08-28 Thread Aaron Hill

On 2022-08-28 1:41 pm, Alexander Weidner wrote:

how can I get a smaller fontsize for text under a CueVoice?

<<
  \new CueVoice = "Hirte" {
\relative c'' {
\autoBeamOff \stemUp
s4 s8 a16 a16 d8 d8 r16 d16 d16 e16 |%T1
   }
  \new Lyrics \lyricsto "Hirte" {
\override Lyrics.font-size = #-3
 Naht der Him -- mel?
 Bin ich im Him -- mel?
   }
>>


LilyPond's output should be calling your attention to a bad grob 
property path with your \override command.  Make sure to check the 
documentation (Notation Reference and Internals) to ensure you have the 
right name.  The Visual Index is also a helpful tool, which soon will be 
integrated into the official documentation.


In this case, LyricText and potentially also LyricHyphen would be the 
grobs you need to be modifying.  However, there is perhaps an easier 
option using a context property:



  \new Lyrics \with { fontSize = -3 }



-- Aaron Hill



Re: Passing a parameter to Scheme

2022-10-29 Thread Aaron Hill

On 2022-10-29 2:50 am, Paul Hodges wrote:

%%

speak = {
  \once \override Stem.stencil =
    #(lambda (grob)
       (let* ((x-parent (ly:grob-parent grob X))
              (is-rest? (ly:grob? (ly:grob-object x-parent 'rest
         (if is-rest?
             empty-stencil
             (ly:stencil-combine-at-edge
              (ly:stem::print grob)
              Y
              (- (ly:grob-property grob 'direction))
              (grob-interpret-markup grob
                                     (markup #:center-align #:fontsize 
-2
                                             #:musicglyph 
"noteheads.s2cross"))

              -2.3
}
%%

This works fine, writing "\speak c4" for instance.

However, I'd like to be able to parameterise the position of the cross 
which is hard-coded as -2.3, so that I can write "\speak #-3.8 c" for 
instance.  I've tried a couple of ways to write it, but I can't find 
one that works.  I suppose that I will need something like "lambda 
(grob posn)" to define the parameter for use at the end, but I can't 
see how to get the value of posn from the LilyPond source into the 
Scheme procedure.


Review the documentation on defining and using music functions:

[1]: 
https://lilypond.org/doc/v2.23/Documentation/extending/music-functions


You could end up with something like this:


speak =
#(define-music-function
  (position)
  (number?)

  (define (stencil-proc grob)
   (let* ((x-parent (ly:grob-parent grob X))
  (is-rest? (ly:grob? (ly:grob-object x-parent 'rest
(if is-rest?
 empty-stencil
 (ly:stencil-combine-at-edge
  (ly:stem::print grob)
  Y
  (- (ly:grob-property grob 'direction))
  (grob-interpret-markup grob
   (markup #:center-align #:fontsize -2
   #:musicglyph "noteheads.s2cross"))
  (- position)

  #{ \once \override Stem.stencil = #stencil-proc #})

{
  \speak 1.6 g'4
  \speak 2.2 b'8 8
  \speak 2.8 a'2
}



-- Aaron Hill



Re: Terminology question

2022-10-31 Thread Aaron Hill

On 2022-10-30 10:39 pm, Jacques Menu wrote:
Is there a LilyPond-specific term for the position of an element in a 
measure, such a 7/16?


I believe "moment" is what you are looking for.


-- Aaron Hill



Re: Tried to use "music box" with Lilypond 2.22.2, get lots of Scheme errors

2022-09-20 Thread Aaron Hill

On 2022-09-20 4:27 pm, Kenneth Wolcott wrote:

Hi;

Tried to use "music box" with Lilypond 2.22.2, get lots of Scheme 
errors.


https://lsr.di.unimi.it/LSR/Search?q=music+box

See attachments. I did not include my generated pdf file because it
pertains to the input file prior to trying to implement the music box.

Thanks,
Ken Wolcott

~/bin/engrave.pl --lpv=2.22.2 --s=O_Holy_Night.ly
GNU LilyPond 2.22.2 (running Guile 2.2)
Processing `O_Holy_Night.ly'
Parsing...Backtrace:
[...]
ice-9/eval.scm:159:9: Value out of range 0 to 18446744073709551615: -14


Review the documentation for LSR 346.  The transformation pattern must 
use notes starting from middle C.  Your pattern has notes in a much 
lower octave, which results in a negative index.  So, you would want to 
say something like this:



make_bass_pattern = \defineTransform \tuplet 6/4 \fixed c' { c8( d e f g 
a) }



However, you can do this more efficiently, removing the redundant notes:


make_bass_pattern = \defineTransform \tuplet 6/4 \fixed c' { c8( d e f d 
e) } % 1 2 3 4 2 3

% ...
| \make_bass_pattern { g, g d b } \make_bass_pattern { b, g d b }
| \make_bass_pattern { b, g d b } \make_bass_pattern { b, g d b }
| \make_bass_pattern { b, g d b } \make_bass_pattern { c g e c' }
% ...



-- Aaron Hill



Re: Four eighth note beamed when first eighth note looks like a half note

2022-10-13 Thread Aaron Hill

On 2022-10-13 1:31 pm, Knute Snortum wrote:

I have a situation that seems like it would be straightforward.  I
want four eighth notes beamed with the first eighth looking like a
half note.  I thought I could just do this:

{ b2*1/4[ b'8 b' b'] }

But that code doesn't attach the beam to the first note and produces
two warnings:

warning: stem does not fit in beam
warning: beam was started here

What am I doing wrong?


Does this help?


{ \tweak duration-log 1 b8[ b' b' b'] }


-- Aaron Hill



Re: 2.23..13 hairpins in brackets

2022-10-06 Thread Aaron Hill

On 2022-10-06 10:31 am, Paul Scott wrote:
In 2.23.13 Notation 1.3.1 shows how to mix normal text with dynamic 
text.


Is there a way to mix normal text, brackets specifically, with 
hairpins?

This is used in the U.S. Marine Band versions of the Sousa marches.


Have you looked further in the docs?  See the subsection on "New dynamic 
marks" [1], where there is a particular snippet that shows off 
customizing dynamics (including brackets) that work along side hairpins:



roundF = \markup { \center-align \concat {
   \normal-text { \bold { \italic ( } }
   \dynamic f
   \normal-text { \bold { \italic ) } } } }
boxF = \markup { \bracket { \dynamic f } }
mfEspress = \markup { \center-align \line {
  \hspace #3.7 mf \normal-text \italic espress. } }
roundFdynamic = #(make-dynamic-script roundF)
boxFdynamic = #(make-dynamic-script boxF)
mfEspressDynamic = #(make-dynamic-script mfEspress)
\relative {
  c'4_\roundFdynamic\< d e f
  g,1~_\boxFdynamic\>
  g1
  g'1~\mfEspressDynamic
  g1
}


[1]: 
https://lilypond.org/doc/v2.23/Documentation/notation/expressive-marks-attached-to-notes#new-dynamic-marks

[2]: https://lilypond.org/doc/v2.23/Documentation/b2/lily-b81795aa.png


-- Aaron Hill



Re: Music function help

2022-10-01 Thread Aaron Hill

On 2022-10-01 7:36 pm, Mark Probert wrote:
I'm just starting to play more with music functions and obviously 
haven't
got something. I'm want to create a basic substitution-style function 
to
create a vocal portamento. The code I have so far doesn't work 
correctly

and I wonder if someone can point me in the right direction.


Is this what you were intending?


\version "2.22"

portamento =
#(define-music-function
  (start end) (ly:music? ly:music?)
  #{
  \afterGrace { #start \glissando } #end
  #})

tune = \relative c'' {
  r2 \portamento g2 g'8 |
}

\score {
  <<
\new Staff \tune
  >>
}



-- Aaron Hill



Re: LilyPond-2.22.2 does not work on Windows XP

2022-10-14 Thread Aaron Hill

On 2022-10-14 12:18 am, J Martin Rushton wrote:

For some reason best known to Microsoft Windows held
systems down in 32-bit node for years after they were internally 64-
bit.


Microsoft did not "hold systems down".  In the era of XP, Windows came 
in a 64-bit version, colloquially known as XP64.  The main issue was 
that most consumers at that time only had access to 32-bit hardware, so 
it was not a priority to market 64-bit support.


Over time, computer manufacturers have made 64-bit hardware the norm; 
but as anyone with IT experience knows: clients are rarely eager to 
spend money upgrading when things are not completely broken.  (And even 
then when the office is on fire, some are still stingy.)  So 
notwithstanding the average home user facing rising costs of new 
computers, Microsoft has many business, educational, and government 
customers that would all have to get aboard the 64-bit train.


As I recall, Windows 10 was supposed to launch as 64-bit only; yet even 
it still has an installation option to run on 32-bit processors.  It is 
looking like Windows 11 will be the first release to draw the line in 
the sand and cut off old hardware.



-- Aaron Hill



Re: Score, DS and Coda Question

2022-09-30 Thread Aaron Hill

On 2022-09-30 11:22 am, Greg Lindstrom wrote:
I've engraved a score which includes a "D.S." and Coda. I had no 
problem
adding the Text (D.S. al Coda") and signs, but currently there is no 
break

in the score between after the measure to go back to the sign and the
actual coda. In other works I've seen, the Coda is "broken off" from 
the

main score to make it stand out.

I have ideas on how to do this but thought I'd ask because I went to 
the
trouble to manually combine two parts in the score only to later 
discover
the \partCombine feature. Before I try to "tong and hammer" this, is 
there

a better (easier, "lilypond") way?


Manually inserting a \break might suffice.  That's all I do in my 
scores.


If you need more than that, the LSR [1] offers several ways to handle 
coda positioning.  \pseudoIndent [2] is an especially powerful tool.


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


-- Aaron Hill



Re: very simple off-topic question regarding command line viewing of postscript files on macOS

2022-08-03 Thread Aaron Hill

On 2022-08-03 3:07 am, Lukas-Fabian Moser wrote:

Since we're both not English native speakers, there may be a problem
of missing the appropriate tonality involved. I'm positive that Jean
didn't mean to say "that's not a good question, go away" any more than
I did. Was this what our responses sounded like for a native speaker?


As a native English speaker, I can allay your concerns.  The original 
wording was reasonably clear to me.  Granted, if someone is unfamiliar 
with the term XY in this context, that might be a stumbling block.  
However, the follow-up question importantly sought out the missing 
information.


The only advice I could give is to try to lead with the actionable item 
first.  That is, ask for clarification and then qualify that such 
information would help resolve a possible XY problem.  This aligns with 
the tl;dr principle in online discourse.  Our attention spans often 
become quite short when we are struggling to meet a tight deadline.



-- Aaron Hill



Re: Controlling stem lengths in a global way

2022-08-15 Thread Aaron Hill

On 2022-08-15 4:15 pm, Knute Snortum wrote:
On Mon, Aug 15, 2022 at 4:00 PM Aaron Hill  
wrote:


On 2022-08-15 3:11 pm, Knute Snortum wrote:
> I am engraving a piece where there are many groups of 16th notes where
> the first note is normal size and the rest should look like grace
> notes.  I'm using \scaledDurations, \magnifyMusic and \normalsize to
> do this, but I'm running into a systemic problem: the stems of the
> normal size notes are mostly too short (they'd be fine if they were
> grace notes).  To get around this I'm using beam position overrides
> and tweaks, but this gets tedious quickly.  Is there a) a systemic way
> to tweak the stem lengths, and/or b) better way for me to do this?
>
> %%%
> \version "2.22.2"
> \language "english"
>
> ns = \once \normalsize
>
> % Short stems on the normalsize notes
> \relative d'' {
>   \magnifyMusic #2/3 {
> \scaleDurations 2/3 {
>   \ns d16 f, g c, f g  \ns c e, g c, e g
>   \ns c d, g c, d g  \ns c e, g c, e g |
> }
>   }
> }
>
> beamPositionA = \tweak Beam.positions #'(4 . 2) \etc
> beamPositionB = \override Beam.positions = #'(3 . 1)
>
> % Need to tweak or override many, many notes
> \relative d'' {
>   \magnifyMusic #2/3 {
> \scaleDurations 2/3 {
>   \ns \beamPositionA d16 f, g c, f g  \ns \beamPositionB c e, g c,
> e g
>   \ns c d, g c, d g  \ns c e, g c, e g \revert Beam.positions |
> }
>   }
> }
> %%%
>
> --
> Knute Snortum

Would \offsetting positions make more sense?  For instance, you could 
do

this:


ns = \once {
   \normalsize
   % Stem needs a little bit more length
   % to counteract magnifyMusic...
   \offset positions #'(1 . 0) Beam
}

\relative d'' {
   \magnifyMusic #2/3 {
 \scaleDurations 2/3 {
   \ns d16 f, g c, f g
   \ns c e, g c, e g
   \ns c d, g c, d g
   \ns c e, g c, e g |
 }
   }
}


This does assume that the amount of lengthening required is uniform.


-- Aaron Hill


Works like a charm.  Now I can have a couple of variables instead of
dozens.  Thanks!


Another option is to use grob-transformer, which allows for smarter 
logic such as handling stem direction:



ns = \once {
  \normalsize
  \override Beam.positions =
  #(grob-transformer 'positions (lambda (grob orig)
(let ((dir (ly:grob-property grob 'direction)))
 (cons (+ (car orig) (* dir 0.75)) (cdr orig)
}

\relative d'' {
  \magnifyMusic #2/3 {
\scaleDurations 2/3 {
  %% Some upward stem examples...
  \ns d16 f, g c, f g
  \ns c e, g c, e g
  %% Some downward stem examples...
  \ns f d' c e d c
  \ns g d' b f' d b |
}
  }
}



-- Aaron Hill



Re: Controlling stem lengths in a global way

2022-08-15 Thread Aaron Hill

On 2022-08-15 3:11 pm, Knute Snortum wrote:

I am engraving a piece where there are many groups of 16th notes where
the first note is normal size and the rest should look like grace
notes.  I'm using \scaledDurations, \magnifyMusic and \normalsize to
do this, but I'm running into a systemic problem: the stems of the
normal size notes are mostly too short (they'd be fine if they were
grace notes).  To get around this I'm using beam position overrides
and tweaks, but this gets tedious quickly.  Is there a) a systemic way
to tweak the stem lengths, and/or b) better way for me to do this?

%%%
\version "2.22.2"
\language "english"

ns = \once \normalsize

% Short stems on the normalsize notes
\relative d'' {
  \magnifyMusic #2/3 {
\scaleDurations 2/3 {
  \ns d16 f, g c, f g  \ns c e, g c, e g
  \ns c d, g c, d g  \ns c e, g c, e g |
}
  }
}

beamPositionA = \tweak Beam.positions #'(4 . 2) \etc
beamPositionB = \override Beam.positions = #'(3 . 1)

% Need to tweak or override many, many notes
\relative d'' {
  \magnifyMusic #2/3 {
\scaleDurations 2/3 {
  \ns \beamPositionA d16 f, g c, f g  \ns \beamPositionB c e, g c, 
e g

  \ns c d, g c, d g  \ns c e, g c, e g \revert Beam.positions |
}
  }
}
%%%

--
Knute Snortum


Would \offsetting positions make more sense?  For instance, you could do 
this:



ns = \once {
  \normalsize
  % Stem needs a little bit more length
  % to counteract magnifyMusic...
  \offset positions #'(1 . 0) Beam
}

\relative d'' {
  \magnifyMusic #2/3 {
\scaleDurations 2/3 {
  \ns d16 f, g c, f g
  \ns c e, g c, e g
  \ns c d, g c, d g
  \ns c e, g c, e g |
}
  }
}


This does assume that the amount of lengthening required is uniform.


-- Aaron Hill



Re: template for a "simple" theory exercise randomizer

2022-07-31 Thread Aaron Hill

On 2022-07-31 12:00 pm, Kieren MacMillan wrote:

Thanks for any help you can give!


Here is something I threw together quickly... Hope it offers some 
inspiration:



\version "2.22.0"

createExercise =
#(define-scheme-function
  (clef key root)
  (symbol? ly:pitch? ly:pitch?)
  #{
\markup \score {
  \new Staff {
\omit Score.TimeSignature
\clef #(symbol->string clef)
\key $key \major
$root 1
\bar "||"
  }
}
  #})

randomElement =
#(define-scheme-function
  (list-of-elements) (list?)
  (list-ref list-of-elements
(random (length list-of-elements

clefs = treble,bass

keys = #(music-pitches #{
  c des d ees e f fis g aes a bes b
#})

scaleDegreesFor =
#(define-scheme-function
  (key) (ly:pitch?)
  (music-pitches (ly:music-transpose
#{ { c d e f g a } #} key)))

\markup \wordwrap { #@(map
 (lambda args
  (let*
((clef #{ \randomElement \clefs #})
 (key #{ \randomElement \keys #})
 (root #{ \randomElement \scaleDegreesFor #key #}))
   (if (eq? clef 'treble)
   (set! root (ly:pitch-transpose root #{ c'' #})))
#{ \createExercise #clef #key #root #}))
 (iota 24))
}


NOTE: I omitted scale degree seven intentionally to focus only on major 
or minor triads.



-- Aaron Hill

Re: markups and accents inside staff

2022-07-31 Thread Aaron Hill

On 2022-07-31 2:11 pm, Jim Cline wrote:

Can you provide a MWE? (https://lilypond.org/tiny-examples.html)

--
Knute Snortum


Sure, here is one.  The vspace is ignored, no matter what value is 
given.


%%%
\version "2.20.0"
\relative c {
  \time 3/4
  g'' e' d_\markup{\hspace #-4 \vspace #-7 x}
}


I am not certain negative \hspace or \vspace is supported.  For \hspace, 
it probably only works by fluke.


Regardless, in order to overlap the staff, you must disable 
outside-staff-priority.  Additionally, you may need to specify negative 
padding.  Consider:



\relative c {
  \time 3/4
  g'' e' d-\tweak outside-staff-priority ##f
  -\tweak X-offset -1.2 -\tweak Y-offset 1
  _\markup \with-color #red \vcenter x
}

\relative c {
  \time 3/4
  g'' e' d-\tweak outside-staff-priority ##f
  -\tweak padding #-5
  _\markup \translate #'(-1.2 . 3.5)
   \with-color #red \vcenter x
}



-- Aaron Hill



Re: template for a "simple" theory exercise randomizer

2022-07-31 Thread Aaron Hill

On 2022-07-31 12:48 pm, Aaron Hill wrote:

On 2022-07-31 12:00 pm, Kieren MacMillan wrote:

Thanks for any help you can give!


Here is something I threw together quickly... Hope it offers some 
inspiration:


And here is a better and more readable version:

(Why I had all those unnecessary Scheme<->LilyPond escapes is beyond 
me...)



\version "2.22.0"

createExercise =
#(define-scheme-function
  (clef key root)
  (symbol? ly:pitch? ly:pitch?)
  #{ \markup \score {
\layout { indent = 0 }
\new Staff {
  \omit Score.TimeSignature
  \clef #(symbol->string clef)
  \key $key \major $root 1 \bar "||"
}
  } #})

randomElement =
#(define-scheme-function
  (list-of-elements) (list?)
  (list-ref list-of-elements
   (random (length list-of-elements

scaleDegreesFor =
#(define-scheme-function
  (key) (ly:pitch?)
  (music-pitches (ly:music-transpose
   #{ { c' d' e' f' g' a' } #} key)))

clefKeys.treble = { bes b c' des' d' ees' e' f' fis' g' aes' a' }
clefKeys.bass = { f, fis, g, aes, a, bes, b, c des d ees e }

\markup \wordwrap {
  #@(map (lambda _
   (let* ((clefKey (randomElement clefKeys))
  (clef (car clefKey))
  (keys (music-pitches (cdr clefKey)))
  (key (randomElement keys))
  (scaleDegrees (scaleDegreesFor key))
  (root (randomElement scaleDegrees)))
(createExercise clef key root))
  ) (iota 24))
}


-- Aaron Hill

Re: How to get cross-staff beaming? Should be automatic; it's not. Why?

2022-07-31 Thread Aaron Hill

On 2022-07-31 7:10 pm, Kenneth Wolcott wrote:

  However, the current incarnation of my Swan Lake harp part (one bar
so far), does not have a complete beam (only each triplet has a beam).
I thought that this would be automatic.


In 4/4 time, there is a default beam exception for "twelfth" notes.


\version "2.22.0"

\relative c' {
  \time 2,2 4/4  %% Set desired beat structure and time signature.
  \set Timing.beamExceptions = #'()  %% Clear default exceptions.
  \repeat unfold 4 \tuplet 3/2 { d8 e a }
}

%% Alternately...

\relative c' {
  \time 2/2
  \repeat unfold 4 \tuplet 3/2 { d8 e a }
}



-- Aaron Hill



Re: Alignment help

2022-08-17 Thread Aaron Hill

On 2022-08-17 12:30 pm, Rajesh Baskar wrote:

I'm trying to replace some of the notes with a question mark and I
achieved this with this group's help sometime back. Here is the


To get the alignment, you need to do a few things.  The markup itself 
needs to be vertically centered, and then the staff-position of the note 
can be forced to be on the middle line:



\version "2.22.0"
\language english

questionMarkMarkup =
\markup \vcenter \fontsize #7 \with-color "#6A00F4" "?"

questionMark =
\tweak text \questionMarkMarkup
\tweak stencil #ly:text-interface::print
\tweak staff-position #0
\etc

{
  \cadenzaOn \clef bass
  g,1
  \questionMark a,
  \questionMark b,
  \questionMark c
  d
}



-- Aaron Hill



Re: \sustainOff on \alternative

2023-01-06 Thread Aaron Hill

On 2023-01-06 5:39 am, Lukas-Fabian Moser wrote:

Hi, I am using 2.22.2,
\after 4 \sustainOff b2 r
​is useless, because of *unknown escaped string*


"Useless" sounds a bit harsh.


In the event OP's native language is not English, it might just be 
unfortunate word choice rather than a criticism of the function's value.


Could you consider upgrading to LilyPond 2.24? That's the current 
stable version (and my code was written for it). If that's impossible, 
I can sidestep the use of \after, but frankly, it's easier to help you 
if you provide a working example yourself.


I am fairly certain David K. wrote \after back in the 2.19 era, so there 
should be no particular need to run 2.24.  I found this version on an 
old thread:



after =
#(define-music-function (t e m) (ly:duration? ly:music? ly:music?)
  #{
\context Bottom <<
  #m
  { \skip $t <> -\tweak extra-spacing-width #empty-interval $e }
    >>
  #})



-- Aaron Hill



Quirk with short, but not too short, ties

2023-01-02 Thread Aaron Hill

Hi folks,

I noticed a peculiar quirk with how short ties are handled in LilyPond.  
Take a look at the attached image (source code provided below).  Notice 
that the ties are not positioned the same.  I suspect it might be 
because the Fs are not the same distance away from each other, so in one 
case LilyPond leaves the tie sitting on the staff line and in the other 
the tie is pushed down.


For my purposes, I prefer the second rendering.  Especially with the 
slur present, I find that the tie in the first version is getting lost 
between the notes.  This example is a contrived excerpt from a larger 
work, but this pattern shows up several times in the piece.  While I was 
proofreading, I almost thought one of the ties was missing.  Attached is 
a capture from my PDF viewer showing a particularly bad instance.


Is there a way for me to ensure that these short ties are consistently 
offset to improve readability?


Many thanks!


\version "2.22.0"

\paper {
  indent = 0
  line-width = 12\cm
  ragged-last = ##t
}

pattern = \relative c'' { c8 a a g16( f~ 8) r8 }
{
  \key f \major \time 6/8
  \pattern R2. \break \pattern
}


-- Aaron Hill

Re: Note head as a custom image chosen according to note duration

2022-11-21 Thread Aaron Hill

On 2022-11-21 3:36 pm, Jean Abou Samra wrote:

Le 22/11/2022 à 00:31, Aaron Hill a écrit :

But NoteHead has a duration-log property ready to go:


The OP says "according to the duration". I didn't know if using 
duration-log would be OK for this case, because duration-log does not 
make a difference between quarters, heighth notes and shorter notes.


Makes sense.  I was thinking only about the note heads themselves, where 
quarters and smaller share the same shape.


One detail that might be getting overlooked is stem-attachment.  If the 
custom shapes differ too much from the default note heads, one would 
need to adjust this property as well.



-- Aaron Hill



Re: Note head as a custom image chosen according to note duration

2022-11-21 Thread Aaron Hill

On 2022-11-21 3:13 pm, Valentin Petzel wrote:
The duration of the NoteHead is not in fact a property of the grob, but 
of the music event
that leads to creation of the grob, accessible from the grob by the 
"cause"-property. Thus

Jean uses

(ly:event-property (event-cause grob) 'duration)

to get the duration of the note head and then uses different markups 
for different values.


But NoteHead has a duration-log property ready to go:


\version "2.22.0"

\layout {
  \override Voice.NoteHead.stencil =
  #(grob-transformer 'stencil
(lambda (grob orig)
  (grob-interpret-markup grob  #{
\markup
\with-dimensions-from \stencil $orig
\overlay {
  \raise #1.25
  #(number->string
(ly:grob-property grob 'duration-log))
  \stencil $orig
}
  #})))
}
{ 1 2 4. 8 }



-- Aaron Hill

Re: defineBarLine confusion

2023-01-13 Thread Aaron Hill

On 2023-01-13 6:43 pm, Flaming Hakama by Elaine wrote:
Looking at your example, I think the first place you are going off is 
that

you do not define the barlines using ##t, ##f, you instead put the
characters that correspond to what you want to appear in those places.


#t and #f are valid in bar line definitions, as convenient short hand.  
See [1]:


The \defineBarLine arguments specifying replacement glyphs can be set 
to #t to copy the mid-line glyph or #f to create no bar line. The empty 
string, "", yields a zero-width bar line.


[1]: 
https://lilypond.org/doc/v2.24/Documentation/notation/bars#index-defining-bar-line



-- Aaron Hill



Re: irrational meters

2023-01-18 Thread Aaron Hill

On 2023-01-18 1:23 am, Paul Hodges wrote:
As for alternatives, I suppose dyadic will do; but irregular is 
certainly wrong - there is no reason for an irrational tempo to be 
irregular, in fact, anything that can be expressed as a time signature 
is being given a regular definition.


Church hymnary already uses the term "irregular meter" to describe hymns 
that have no consistent metrical structure.  ("Peculiar meter" is also 
used.)  Though to be clear, there one is talking about the poetry and 
verse as opposed to musical structures such as measures.  However, as 
there is a practical connection between texts and tunes, it might be 
best to avoid confusion with overloaded terms that span the topics.



-- Aaron Hill



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