Re: wront type for argument: on \note

2021-07-09 Thread Aaron Hill

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

I try to run the following lilypond code.

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


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



\markup \note { 16 } #UP



-- Aaron Hill



Re: Move chord name down onto staff?

2021-07-10 Thread Aaron Hill

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

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


Here's one way to do this:


\version "2.20"

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

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

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



-- Aaron Hill

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

2021-07-10 Thread Aaron Hill

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

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


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


-- Aaron Hill



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

2021-07-10 Thread Aaron Hill

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

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

lilypond version information.


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


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


The LSR is currently running LilyPond version 2.18.2.


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


-- Aaron Hill



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

2021-04-24 Thread Aaron Hill

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

Gianmaria Lari  writes:


Thank you Aaron and Jean, your code works!

But I have some trivial questions.
If I write:

\displayLilyMusic \chordmode {c}


I get:

{ < c' e' g' >4 }


It looks a good "compound music expression".


Try \displayMusic rather than \displayLilyMusic for more details.


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


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


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



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

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

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


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



-- Aaron Hill



Re: repeatTie question

2021-04-29 Thread Aaron Hill

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

Hi.

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


TIA
 .. mark.

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

tune = \relative c'' {
  \clef treble

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


Did you mean to use \laissezVibrer?


-- Aaron Hill



Re: Pitch value of previous note

2021-04-30 Thread Aaron Hill

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

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

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

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


What about the existing pitch-repeating functionality in LilyPond?


\version "2.22.0"

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


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


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


-- Aaron Hill



Re: Pitch value of previous note

2021-04-30 Thread Aaron Hill

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

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


What about the existing pitch-repeating functionality in LilyPond?


\version "2.22.0"

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


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



-- Aaron Hill



Re: align system to the right

2021-05-01 Thread Aaron Hill

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

Hi Davi,

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

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


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


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



-- Aaron Hill



Re: repeat barline after fine double-barline

2021-05-01 Thread Aaron Hill

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

Here you go:

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


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

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


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


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



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



-- Aaron Hill



Re: 2nd stanza lyrics cont.

2021-04-21 Thread Aaron Hill

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

Thank you Remy and Valentin for your replies 

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


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

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

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


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



\version "2.22.0"

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


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

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


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



-- Aaron Hill



Re: combining chords in chords

2021-04-22 Thread Aaron Hill

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

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

[...]

How can I solve this?


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


\version "2.22.0"

ja = 8
jb = 8
jc = 8

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

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

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


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



-- Aaron Hill



Re: Markup in a variable

2021-04-29 Thread Aaron Hill

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

Hi, all.

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

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

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

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


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


\version "2.22.0"

foo = \markup { lorem ipsum }

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



-- Aaron Hill



Re: Keeping original system distances

2021-02-08 Thread Aaron Hill

On 2021-02-08 1:50 am, Calvin Ransom wrote:
I am attempting to conserve the spacing when combining two scores 
together.
I want score one on one page and score two on the next page but when I 
use

\pageBreak it changes the spacing of the systems in an unwanted way, is
there a way for me to prevent this from happening?
I am using the \include command to combine multiple scores into one
document,
Any help would be greatly appreciated.


If I had to guess, you may need to use ragged-bottom [1].

[1]: 
http://lilypond.org/doc/v2.22/Documentation/notation/fixed-vertical-spacing-paper-variables



-- Aaron Hill



Re: Custom percussion staves

2021-01-28 Thread Aaron Hill

On 2021-01-28 4:35 am, ebenezer wrote:

Hello everyone,

I have noticed that use of a custom percussion staff is different from
the manner in which one of the pre-defined percussion staves is used:

partBongo = \new DrumStaff \with {
  drumStyleTable = #bongos-style
} \staffBongo

... compared to ...

partPercCustom = \new DrumStaff \with {
  % -- drumStyleTable = #defPercCustom  % -- this doesn't work
} <<
  \set DrumStaff.drumStyleTable = #(alist->hash-table defPercCustom)
% -- works this way




Is this just the way it is, or am I missing something?


bongos-style (and its kin) are hash tables, which is what drumStyleTable 
expects.  The documentation shows defining a custom drum style as an 
alist and then converting it to a hash table when you use it.  An 
alternative would be to do the conversion when you define the style:



\version "2.22.0"

custom-drum-style =
#(alist->hash-table
  '((bassdrum default "tenuto" -1)
(snare diamond #f 0)
(hihat cross #f 1)))

\new DrumStaff
\with { drumStyleTable = #custom-drum-style }
\drummode { bd4 hh8 8 sn2 }



-- Aaron Hill



Re: \path in markup dashed line

2021-01-28 Thread Aaron Hill

On 2021-01-28 6:39 am, Dimitris Marinakis wrote:

Both systems report this error

warning: unknown line-cap-style: (quote round)

/Applications/LilyPond23.app/Contents/Resources/share/lilypond/current/scm/output-ps.scm:275:49
<0>: In procedure symbol->string in expression (symbol->string join):

/Applications/LilyPond23.app/Contents/Resources/share/lilypond/current/scm/output-ps.scm:275:49
<1>: Wrong type argument in position 1 (expecting symbol): (quote 
round)




My apologies.  I made another change in the dashed-path markup command 
that mattered.  Here's the complete code for reference:



\version "2.22.0"

#(define* (dashed-path-ps thickness on off phase exps
  #:optional (cap 'round) (join 'round))
  (let* ((path (module-ref (resolve-module '(scm output-ps)) 'path #f))
 (ps (path thickness exps cap join))
 (lines (string-split ps #\nl)))
(set! lines (cons (car lines)
  (cons (ly:format "[ ~4f ~4f ] ~4f setdash" on off phase)
(cdr lines
(string-join lines "\n")))

#(let* ((module (resolve-module '(scm output-ps)))
(alist (module-ref module 'stencil-dispatch-alist '(
  (module-define! module 'stencil-dispatch-alist
   (acons 'dashed-path dashed-path-ps alist)))

#(ly:register-stencil-expression 'dashed-path)

#(define-markup-command
  (dashed-path layout props thickness commands)
  (number? list?)
  #:category graphic
  #:properties ((line-cap-style 'round)
(line-join-style 'round)
(on 1) (off 1) (phase 0))
  (let ((sten (path-markup layout props thickness commands))
(command-list (fold-right append '() commands)))
(ly:make-stencil
  `(dashed-path ,thickness ,on ,off ,phase
,command-list ,line-cap-style ,line-join-style)
  (ly:stencil-extent sten X)
  (ly:stencil-extent sten Y

samplePath =
  #'((moveto 0 0)
 (lineto -1 1)
 (lineto 1 1)
 (lineto 1 -1)
 (curveto -5 -5 -5 5 -1 0)
 (closepath))

\markup \path #0.25 #samplePath
\markup \dashed-path #0.25 #samplePath
\markup
  \override #'(on . 0.2)
  \override #'(off . 0.2)
  \override #'(line-cap-style . butt)
  \dashed-path #0.25 #samplePath


-- Aaron Hill



Re: Custom slurs

2021-03-23 Thread Aaron Hill

On 2021-03-23 6:41 pm, Andrew Bernard wrote:

I suggest using the shape functions in the OpenLilyLib library.

Or it sounds like a laissez vibrer slur maybe. You can use the
\extendLV function that is somewhere on LSR. If not, I can post it.


That's LSR 715 [1] in particular.

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

Below is an updated version of the function that I imagine would be 
easier to use in practice.  Plus it fixes an issue where the extended LV 
would be too close to the note.



\version "2.22.0"

%% Based on https://lsr.di.unimi.it/LSR/Snippet?id=715
%% Updated syntax for 2.20+
%% Embedded \laissezVibrer within the music function
%% Also using \tweak style instead of \once \override
%% Included the default note-head-gap (0.2) in computation
extendedLaissezVibrer =
#(define-music-function
  (further)
  (number?)
  #{ \tweak X-extent #'(0 . 0)
 \tweak details.note-head-gap #(- 0.2 (/ further 2))
 \tweak extra-offset #(cons (/ further 2) 0)
 \laissezVibrer #})

\fixed c' { \time 3/4
  \repeat percent 2 {
b2 c'4
g8 a b2 \extendedLaissezVibrer #4
  }
  \bar "|."
}



-- Aaron Hill

Re: How to make jazz-like leadsheets without melody, only chords, and text?

2021-03-23 Thread Aaron Hill

On 2021-03-23 9:09 pm, stefano franchi wrote:

I know how to enter chords (and how to use a jazzy font), but I can't
find out how to enter the beat marks, not the text underneath that
spans several bars (my chords also appear under the staff rather than
above it, but that's a minor issue).


See if something like this might work for you:


\version "2.22.0"

\new Voice
\with { \consists "Pitch_squash_engraver" }
{
  \improvisationOn \omit Stem
  \repeat unfold 8 { 4 }
}



-- Aaron Hill

Re: Single entry font

2021-03-23 Thread Aaron Hill

On 2021-03-23 7:24 pm, Calvin Ransom wrote:
I am trying to use the attached font for my title but I am not able to 
get

the title to switch to Odin Rounded, but it can switch to my other
installed fonts. I am using windows 10. I am also unsure how to run
"lilypond -dshow-available-fonts"


You just run that command from the terminal.  If the lilypond executable 
is not in the environment path, though, you will need to manually 
navigate to its folder (e.g. "C:\Program Files (x86)\LilyPond\usr\bin" 
or similar) to be able to run it.  Though, it has been too many years 
since I've used the Windows version of LilyPond, so I likely have 
misremembered the installation directory.




%SNIPPET BEGINS%%%
\header {
title = \markup{ \override #'(font-name ."OdinRounded"){"title"}}
}
%SNIPPET ENDS%


There is a space in the font family name, so it should read "Odin 
Rounded".  I tested it on Ubuntu, but it should work the same on 
Windows.



-- Aaron Hill



Re: Jazz chords above slash notation

2021-03-23 Thread Aaron Hill

On 2021-03-23 9:26 pm, Calvin Ransom wrote:

I am trying to write something like the image below. I was able to
typeset the more normal chords ok but I don’t know how to place parts
of them in parentheses or how to type the maj9


Review chordNameExceptions and the associated snippet [1] in the 
Notation reference.


[1]: 
http://lilypond.org/doc/v2.22/Documentation/notation/displaying-chords#index-chordNameExceptions-2



-- Aaron Hill



Re: How to make jazz-like leadsheets without melody, only chords, and text?

2021-03-24 Thread Aaron Hill

On 2021-03-24 1:07 am, Jacques Menu wrote:

This works, but with a second, empty staff:

\version "2.20.0"

\language "english"
\include "lilyjazz.ily"

global = {  \time 4/4   \key f \major  \tempo 4=100}
chordNames = \chordmode {f1:7 f:7 f:7 f:7}

\score {
  <<
\global

\new ChordNames {
  \chordNames
}

\new Voice
\with { \consists "Pitch_squash_engraver" }
{
  \improvisationOn \omit Stem
  \repeat unfold 16 { 4 }
}
  >>
}


You need to be more explicit about creating staves and voices.  Also, 
you will want to remove the Note_performer so that the dummy slash notes 
do not interfere with MIDI:



\version "2.22.0"

global = { \time 4/4 \key f \major \tempo 4=100 }
chordNames = \chordmode { f1:maj7 e:7 a:m bes/c }

\score {
  <<
\new ChordNames \chordNames
\new Staff <<
  \new NullVoice \global
  \new Voice
\with { \consists "Pitch_squash_engraver"
\remove "Note_performer" }
  {
\improvisationOn \omit Stem
\repeat unfold 16 { c4 }
  }
>>
  >>
  \layout {}
  \midi {}
}


And while we're at it... why not make the slashes automatically fit the 
chord music?



\version "2.22.0"

slashesForMusic =
#(define-music-function
  (slash-duration reference-music)
  (ly:duration? ly:music?)
  #{ \new Voice
 \with { \consists "Pitch_squash_engraver"
 \remove "Note_performer" }
 { \improvisationOn \omit Stem
   \repeat unfold
   #(ly:moment-main (ly:moment-div
 (ly:music-length reference-music)
 (ly:duration-length slash-duration)))
   { c $slash-duration } } #})

global = { \time 4/4 \key f \major \tempo 4=100 }
chordNames = \chordmode { f1:maj7 e:7 a:m bes/c }

\score {
  <<
\new ChordNames \chordNames
\new Staff <<
  \new NullVoice \global
  \slashesForMusic 4 \chordNames
>>
  >>
  \layout {}
  \midi {}
}



-- Aaron Hill



Re: Custom Format

2021-04-01 Thread Aaron Hill

On 2021-03-31 12:12 pm, Callum Cassidy-Nolan wrote:
Could you explain why 6 usually corresponds to the pitch B and not 
always?


B does not always mean B natural.  In systems where H is a note, B is 
the name for B flat.  The documentation here is perhaps a little 
misleading in that it implies the implementation is doing something 
conditionally.




Also I am new to Scheme and still trying to wrap my head around your
original function:

#(define (: n)
   (apply
ly:make-pitch
(cons (1- (floor (/ n 12)))
  (list-ref `((0 0) (0 ,SHARP) (1 0) (1 ,SHARP)
  (2 0) (3 0) (3 ,SHARP) (4 0)
  (4 ,SHARP) (5 0) (5 ,SHARP) (6 0))
(modulo n 12)

Here is my best guess, for each element in the following list - apply
the function make-pitch to each element.


There is no "for each" going on here.  apply lets you call a procedure 
and supply the arguments as a list.  Consider:



(apply proc '(1 2 3))
; ...is equivalent to...
(proc 1 2 3)


Upon reflection, I did not need to use cons to form the argument list.  
apply also supports this pattern:



(apply proc 1 '(a b))
; ...is equivalent to...
(proc 1 'a 'b)


The reason I need to use apply at all is because I need to customize the 
second and third arguments based on the input index n, and I wanted to 
avoid duplicating logic.




floor (/ n 12 ): is representing how many octaves fit into this
number? Why do you subtract this number from one?


The Scheme expression (1- n) must not be confused with the algebraic (1 
- n) [which would be written in Scheme as (- 1 n)].  The procedures 1+ 
and 1- are the increment and decrement operations.  So what I am doing 
is subtracting one from the number, not the other way around.


The reason for this is simply to follow existing LilyPond convention.  
The unadorned note { c } is (ly:make-pitch -1 0 0).  To get Middle C, 
you need to say { c' } which puts you in octave 0.




The list-ref thing is choosing one of the elements from that list ,
but I don't fully understand what an arbitrary element from that list
actually is, for example what does (3, SHARP) mean?


These are the second and third arguments for ly:make-pitch.  So using (3 
,SHARP) results in F#.


NOTE: As you are new to Scheme, the comma can be an unexpected item.  
The original list uses a feature called quasi-quotation.  This is 
indicated by the leading backtick (`) as opposed to a straight quote (') 
which is the shorthand for normal quoting.  Quasi-quoting lets you 
"unquote" by using the comma.  Since we need the value of SHARP, not its 
name as a symbol, this is useful.  Consider:



'(3 SHARP)  ;; => (list 3 (quote SHARP))
`(3 ,SHARP) ;; => (list 3 1/2)


I could avoid quasi-quoting by defining the list as follows:


'((0 0) (0 1/2) (1 0) (1 1/2) (2 0) (3 0)
  (3 1/2) (4 0) (4 1/2) (5 0) (5 1/2) (6 0))


But then one wonders what the magic 1/2 means.  Technically, I should 
have used ,NATURAL in place of zero in the original list since that is 
also a magic number.



-- Aaron Hill



Re: Custom Format

2021-03-31 Thread Aaron Hill
(For your reference, do try to remember keeping the mailing list on 
future emails.  This ensures wider visibility and continuity of the 
discussion for all users.  Also, those of us who participate on the list 
are sometimes busy with other work, so personal contact can often result 
in delayed or missing responses.)



Could you point me to a place in the docs where I could understand
what your solutions/functions are doing?


While not exhaustive, I would direct you to the Extending manual [1].  
It is a good starting point; in particular, it covers how LilyPond 
intermingles its own music syntax with that of Scheme.


[1]: http://lilypond.org/doc/v2.22/Documentation/extending/index.html



This looks like exactly what I want. Thank you for your efforts.
I will give each of these a shot and let you know how that goes.


Since LilyPond already uses numbers for durations, you might consider 
writing numeric pitches in alphabetic form, since this most clearly 
disambiguates pitches from durations.  Here is an example of defining 
custom note names in LilyPond:



\version "2.22.0"

#(define (define-custom-note-names language notes)
  (set! language-pitch-names
(acons language notes language-pitch-names)))

#(define-custom-note-names 'numeric-english
  `((zero . ,(ly:make-pitch -1 0 NATURAL))
(one . ,(ly:make-pitch -1 0 SHARP))
(two . ,(ly:make-pitch -1 1 NATURAL))
(three . ,(ly:make-pitch -1 1 SHARP))
(four . ,(ly:make-pitch -1 2 NATURAL))
(five . ,(ly:make-pitch -1 3 NATURAL))
; ...
  ))

#(define-custom-note-names 'numeric-roman
  `((z . ,(ly:make-pitch -1 0 NATURAL))
(i . ,(ly:make-pitch -1 0 SHARP))
(ii . ,(ly:make-pitch -1 1 NATURAL))
(iii . ,(ly:make-pitch -1 1 SHARP))
(iv . ,(ly:make-pitch -1 2 NATURAL))
(v . ,(ly:make-pitch -1 3 NATURAL))
; ...
  ))

\language "numeric-english"
{ zero'4 four'8 five' two'2 }

\language "numeric-roman"
{ z'4 iv'8 v' ii'2 }


NOTE: I've abbreviated the definitions above, but you should be able to 
continue the patterns as needed.



-- Aaron Hill



Re: Custom bar count

2021-04-06 Thread Aaron Hill

On 2021-04-06 9:02 pm, Gabriel Borin wrote:

Hello,

I am working on a part based on a manuscript. The arranger took many
liberties on bar count, and since I am just replacing one lost part, I 
need

to do 2 things:

   - I need the bar count to start at measure 7 (basically, mm.7 = 1).
   - I need to exclude a single bar in the middle from the bar count.

Could anybody give me some advice on that?


You can \set the currentBarNumber as you need to.  Additionally, you 
could use a function as follows to skip a particular number of bars if 
you do not easily know what the bar number should be:



\version "2.22.0"

skipBarNumbers =
#(define-music-function
  (count) (integer?)
  (define (proc context)
   (ly:context-set-property! context 'currentBarNumber
(+ count (ly:context-property context 'currentBarNumber
  #{ \context Score \applyContext #proc #})

{
  \override Score.BarNumber.break-visibility = #all-visible
  \set Score.currentBarNumber = 7
  R1*3 \bar "||" \skipBarNumbers 3 R1*2
}



-- Aaron Hill

Re: Midi volume?

2021-03-27 Thread Aaron Hill

On 2021-03-27 1:13 pm, David Kastrup wrote:

When I do
the result of
lilymidi --pretty /tmp/test.midi
[...]
No volume change.  What am I missing?


That's odd.  When I compiled your file, I got a MIDI that does have 
velocities ranging from 86 to 101.


For reference, I am using 2.22.0 to compile.


-- Aaron Hill

test.midi
Description: MIDI audio


Re:

2021-03-27 Thread Aaron Hill

On 2021-03-27 1:04 pm, Philippe ZELLER wrote:

Dear lilypond fellow users,
it sometimes occurs in barock music that only every other barline is
visible, (see e.g. Haendel's Salomo, choir at the end of Act II ) or 
that

every other barline is printed in reduced size.(see e.g. Bach Mass in
H-moll, nr 27 "dona nobis pacem" ).
Is there a way to get this result in lilypond ?

I first tried
\set Score.barLineVisibility = #(every-nth-bar-number-visible 2)
that I made up after an equivalent syntax for barNumber, but to no 
avail.

Maybe I didn't put it in the right context ?

Finally I used a rather complicated procedure based on
global = {
  \repeat unfold 24 { s2. \once \override Staff.BarLine.transparent 
=

##t  s2. \once \override Staff.BarLine.transparent = ##f }
}
which works but is not fully compatible, for example it does not work 
with

multiMeasureRests.

Many thanks in advance for your suggestions !


An engraver should be able to do the work:


\version "2.22.0"

hideEveryOtherBarLine =
#(lambda (ctx)
  (define (bar-num)
   (ly:context-property ctx 'currentBarNumber))
  (make-engraver
   (acknowledgers
((bar-line-interface trans grob source)
 (if (= 0 (modulo (bar-num) 2))
  (ly:grob-set-property! grob 'transparent #t))

\new Staff
\with { \consists \hideEveryOtherBarLine }
\repeat unfold 10 { b'1 }



-- Aaron Hill

Re: Custom Format

2021-03-30 Thread Aaron Hill

On 2021-03-30 5:30 pm, Callum Cassidy-Nolan wrote:

[...]
I would love to use it, but I have a particular way I interact with 
music.


Particularly I don't use letter names, but instead I use numbers, to
understand what I mean, please take a look at my document:
https://gitlab.com/cuppajoeman/music/-/blob/master/diagrams/standard_to_semitones.pdf

I just saw a basic example in the documentation, something like this:

\version "2.22.0"
{
  c' e' g' e'
}

In my system I would write something like this:

\version "2.22.0"
{
  0' 4' 7' 4'
}
[...]


Not sure why I have done this, but here are some rather horrendous* 
things that can be accomplished entirely within LilyPond so as to not 
require pre-processing:


(* This is entering the nearly indecipherable territory of esoteric 
languages.)



\version "2.22.0"

%% -
%% Option 1:
%% Use a procedure to convert a number to pitch:
#(define (: n)
  (apply
   ly:make-pitch
   (cons (1- (floor (/ n 12)))
 (list-ref `((0 0) (0 ,SHARP) (1 0) (1 ,SHARP)
 (2 0) (3 0) (3 ,SHARP) (4 0)
 (4 ,SHARP) (5 0) (5 ,SHARP) (6 0))
   (modulo n 12)

{ $(: 0)' 8. $(: 9) 16 $(: 2)' $(: 6)' $(: 9)' 8 $(: 4)'' 2 }

%% Pros:
%%  - Values outside the interval [0,11] work.
%%  - Octave marks can appear snugly next to the expression.
%% Cons:
%%  - Requires five extra characters to input than the number,
%%assuming the procedure is named with a single character.
%% -
%% Option 2:
%% Define appropriately named variables with pitches:

defineNoteIndices =
#(define-void-function
  (music) (ly:music?)
  (let ((pitches (music-pitches music)))
   (for-each
(lambda (idx pitch)
 (module-define! (current-module)
  (string->symbol (format #f ":~a" idx)) pitch))
(iota (length pitches))
pitches)))

\defineNoteIndices { c cis d dis e f fis g gis a ais b }

{ $:0 ' 8. $:9 16 $:2 ' $:6 ' $:9 ' 8 $:4 '' 2 }

%% Pros:
%%  - Can work with as many or as few notes as needed.
%%(Think of pentatonic music without alterations.)
%%  - Easier to customize as pitches are entered naturally.
%%  - Only two additional characters to input a pitch*.
%% Cons:
%%  - Only supports exactly as many indices as defined.
%%  - Whitespace needed between pitch and octave mark.
%%* So potentially, three additional characters needed.
%% -


NOTE: I only used a colon above as it was not yet a defined symbol.  
However, colons are used in LilyPond syntax as the short-hand for 
tremolo repeats.  So, almost certainly a different character would be 
better.



-- Aaron Hill

Re: Strange behaviour of chord names?

2021-03-13 Thread Aaron Hill

On 2021-03-13 6:11 am, Christian Masser wrote:

[...]
mySoloChordsA = \chords {
  c1 f g c
}
[...]


I think you want \chordmode, not \chords, when defining the variables.

\chords { ... } is shorthand for \new ChordNames \chordmode { ... } if I 
recall.



-- Aaron Hill



Re: Get default Gliss endpoint Y value and add intelligently a value on top of it

2021-03-19 Thread Aaron Hill

On 2021-03-19 12:30 pm, Dimitris Marinakis wrote:

I don't like manually setting Y values of glissando endpoints. I'd
appreciate a more thoughtful approach.
Is it possible to reference the calculation Lilypond already does and 
add a

value to it without trying to guesstimate what the actual value is from
scratch? The default placement is sometimes 95% fine but I'd like to 
nudge

it a bit upwards or downwards without tweaking the padding.

This makes cross-staff glissando editing really annoying. If my 
thinking
makes sense, this would solve the problem partially since Lilypond will 
do
its best each time the staff spacing gets changed but the tweak will 
help

on top of that.


Normally, this would be a job for \offset.  However, \offset does not 
work with all properties, in particular, nested properties like the 
bound-details of the line-spanner-interface.


But you can effect the same change by using extra-dy and Y-offset with a 
little bit of arithmetic:



\version "2.22.0"

offsetGlissando =
#(begin
  (define (number-or-number-list? arg)
   (or (number? arg) (number-list? arg)))
  (define ((indexed lst) grob)
   (list-ref lst (ly:grob-property grob 'glissando-index)))
  (define-event-function
   (left-dy right-dy)
   (number-or-number-list? number-or-number-list?)
   (if (number? left-dy) (set! left-dy (list left-dy)))
   (if (number? right-dy) (set! right-dy (list right-dy)))
   (let ((extra-dy (map (lambda (l r) (- r l)) left-dy right-dy))
 (Y-offset (map (lambda (l r) (/ (+ l r) 2)) left-dy right-dy)))
#{ \tweak extra-dy #(indexed extra-dy)
   \tweak Y-offset #(indexed Y-offset)
   \glissando #})))

\paper { indent = 0 line-width = 10\cm}

{ f'2 \glissando c''2
  f'2 \offsetGlissando #-1 #-1 c''2
  f'2 \offsetGlissando #1 #1 c''2
  f'2 \offsetGlissando #-2 #0 c''2
  f'2 \offsetGlissando #2 #0 c''2 \break
  f'2 \offsetGlissando #0 #-2 c''2
  f'2 \offsetGlissando #0 #2 c''2 \bar "||"

  \override Glissando.before-line-breaking =
   #(lambda (grob)
 (ly:grob-set-property! grob 'color
  (list-ref (list black red blue)
(ly:grob-property grob 'glissando-index
  2 \glissando 2
  2 \offsetGlissando #'(1 1 -2) #'(-1.5 1.5 0)
  2 \bar "|." }


The parameters to \offsetGlissando are delta-Y values for the left and 
right bounds respectively.  If there are multiple glissandi, then the 
arguments should be lists of numbers, each value corresponding to a 
particular glissando.  Shown above is an untangling of the crossing 
glissandi, which the coloring should make clearer.


P.S.  I am ignoring the possibility of broken glissandi, as they are not 
supported by default.



-- Aaron Hill

Re: Extend all hairpins over time signature changes

2021-03-01 Thread Aaron Hill

On 2021-03-01 9:52 am, N Trocado wrote:

I like to have hairpins cut through barlines, extending to the note
that ends them on the first beat of the next bar, whenever there's a
time signature change. Stopping short of the barline in this case, as
is the default, leaves a bit too much space between the end of the
hairpin and the dynamic symbol.
I know that I can \override Hairpin.to-barline = ##f. But would it be
possible to configure the default behavior to work as described,
instead of spraying overrides everywhere?


Are you doing \once \override or just \override?  A singular \override 
will affect all Hairpins from that point in the music forward (or until 
another \override or a \revert).  Assuming you want this behavior for 
all Hairpins across all staves, just do the \override at a suitably 
global level.



% Top-level or within \score
\layout { \context { \Staff \override Hairpin.to-barline = ##f } }


If you need to scope this to a particular Staff, either use the \with 
block or just \override as the first thing in the music:



\new Staff \with { \override Hairpin.to-barline = ##f } { ... }
% or %
{ \override Hairpin.to-barline = ##f ... }


Finally, if you need a mixture of Hairpins that either extend to the 
note or stop at the barline, then you might want to define a helper 
variable:



extend = -\tweak to-barline ##f \etc

\fixed c' { \time 3/4 g2 a8 \extend \< b | \time 2/4 cis'2 \! }



-- Aaron Hill



Re: Stacked tensions for chord names

2021-03-01 Thread Aaron Hill

On 2021-03-01 7:13 am, Robin Bannister wrote:

And if you are fed up with baseline-skip you can set it to 0,
and it then stays 0 whatever the font-size.

[...]
no-bs = #'(baseline-skip . 0)
[...]


Was there intention behind that variable name?  ;-)


-- Aaron Hill



Re: Extend all hairpins over time signature changes

2021-03-01 Thread Aaron Hill

On 2021-03-01 2:39 pm, N Trocado wrote:

Thank you for your answer.
I do use /once when appropriate, and defining a variable indeed helps
with the typing.
But I was hoping for a way of establishing that all hairpins that
cross time signature changes extend beyond the barline, and if
lilypond took care of this automatically it would be one less thing
for me to worry about .


So it just the case that you want hairpins to extend over time 
signatures?  A custom engraver could automate that:



\version "2.22.0"

extendHairpinsAcrossTimeSignature =
#(lambda (context)
  (let ((hairpins '()))
   (define (extend-hairpin grob)
(ly:grob-set-property! grob 'to-barline #f))
   (define (add-hairpin grob)
(set! hairpins (cons grob hairpins)))
   (define (remove-hairpin grob)
(set! hairpins (remove (lambda (x) (eq? x grob)) hairpins)))
   (make-engraver
(listeners
 ((time-signature-event engraver event)
  (for-each extend-hairpin hairpins)
  (set! hairpins '(
(acknowledgers
 ((hairpin-interface engraver grob source)
  (add-hairpin grob)))
(end-acknowledgers
 ((hairpin-interface engraver grob source)
  (remove-hairpin grob))

\new Staff \with {
  \consists \extendHairpinsAcrossTimeSignature
}
\fixed c' {
  | \time 3/4 g2 a8 \< b | cis'2 \! r4
  | d'4 \> cis' b | \time 2/4 ais2 \!
  | g4 fis8 \< g | \time 3/4 a8 \! b a2 \>
  | g4 \! f e | \time 2/4 d2 \bar "|."
}



-- Aaron Hill

Re: Explicit placement of rests in a percussion staff

2021-02-27 Thread Aaron Hill

On 2021-02-27 3:10 am, David Kastrup wrote:

[...] Which begs the
question whether it would not make sense to let Rest_engraver look at
drum-type in the same manner it looks at pitch for the sake of
potentially resolving the drum-type to staff-position mapping.


I'm not a percussionist; but it would seem reasonable for "sn \rest" to 
work the same as "fis \rest".


I take it parser.yy would need updating to something like this:


simple_element:
  DRUM_PITCH optional_notemode_duration optional_rest {
Music *n = 0;
if (scm_is_true ($3))
  n = MY_MAKE_MUSIC ("RestEvent", @$);
else
  n = MY_MAKE_MUSIC ("NoteEvent", @$);
set_property (n, "duration", $2);
set_property (n, "drum-type", $1);

$$ = n->unprotect ();
  }



-- Aaron Hill



Re: Explicit placement of rests in a percussion staff

2021-02-27 Thread Aaron Hill

On 2021-02-27 1:22 am, Thomas Morley wrote:

I'd use an override for 'staff-position:
\once \override Rest.staff-position = -4
looks ok here.


\tweak form is a little shorter, although you could bake this into a 
function if you needed to use this a lot:



\version "2.22.0"

"\\@" =
#(define-music-function
  (staff-position music)
  (integer? ly:music?)
  #{ \tweak staff-position #staff-position #music #})

\new DrumStaff \drummode { bd4 sn \@4 r4 r8 \@-4 r }


Not sure if \@ is a good name for this, but it is conveniently short 
like \=.



-- Aaron Hill

Re: Request for a stencil alignment helper

2021-02-27 Thread Aaron Hill

On 2021-02-27 3:55 pm, Dimitris Marinakis wrote:

Is it possible to make a "stencil-wrapper" that will show the vertical
centre of a stencil and have an extending line of variable length 
(which of

course won't distort the spacing of the actual score)?


Yes, though much of the particular work depends on how you wish to use 
(and reuse) the functionality.  It is pretty easy to hack any stencil, 
especially with the use of grob-transformer.  There are many examples on 
the mailing list [1] as well as the LSR [2].


[1]: https://lists.gnu.org/archive/html/lilypond-user/
[2]: http://lsr.di.unimi.it/LSR/Search

While a little overengineered in places and certainly in need of 
refactoring, here is one way of doing things:



\version "2.22.0"

#(define ruler-thickness 0.075)

horizontal-ruler =
#(define-scheme-function
  (color alignment extension)
  ((color? red) number? number-pair?)
  (lambda (sten)
   (let* ((xext (ly:stencil-extent sten X))
  (yext (ly:stencil-extent sten Y))
  (y (interval-index yext alignment)))
(apply ly:stencil-in-color
 (ly:make-stencil
  (list 'draw-line ruler-thickness
(+ (car xext) (car extension)) y
(+ (cdr xext) (cdr extension)) y)
  empty-interval empty-interval)
 color

vertical-ruler =
#(define-scheme-function
  (color alignment extension)
  ((color? red) number? number-pair?)
  (lambda (sten)
   (let* ((xext (ly:stencil-extent sten X))
  (yext (ly:stencil-extent sten Y))
  (x (interval-index xext alignment)))
(apply ly:stencil-in-color
 (ly:make-stencil
  (list 'draw-line ruler-thickness
x (+ (car yext) (car extension))
x (+ (cdr yext) (cdr extension)))
  empty-interval empty-interval)
 color

combine-guides =
#(define-scheme-function
  (first-proc second-proc)
  (procedure? procedure?)
  (lambda (sten)
   (ly:stencil-add (first-proc sten) (second-proc sten

stencil-guide =
#(define-music-function
  (guide-proc grob-path)
  (procedure? key-list?)
  (define stencil-proc
   (grob-transformer 'stencil
(lambda (grob orig)
 (ly:stencil-outline
  (ly:stencil-add orig (guide-proc orig))
  orig
  #{ \override $grob-path . stencil = #stencil-proc #})

\fixed c' {
  \stencil-guide \combine-guides
\horizontal-ruler #cyan #DOWN #'(-1 . 1)
\vertical-ruler #'(0.9 0.6 0.3) #CENTER #'(-1 . 1)
Staff.TimeSignature
  \stencil-guide \horizontal-ruler #CENTER #'(-1 . 1) NoteHead
  \stencil-guide \vertical-ruler #green #LEFT #'(-1 . 1) Accidental
  bes4 a8 g 2
}



-- Aaron Hill

Re: No stem on chord-tremolo

2021-04-08 Thread Aaron Hill

On 2021-04-08 9:03 pm, Colin Hunt wrote:

I've begun my first piano score in Lilypond after studying
soundsfromsound's great introduction series. This code shows my 
problem:


\version "2.22.0"

\language "english"
\relative
{\time 3/4\clef bass
 \repeat tremolo 12 {b,32 ds} |
 \repeat tremolo 12 { <> <> } |
}


Your chord syntax appears incorrect.  Consider:


\version "2.22.0"
\language "english"
\relative
{ \time 3/4 \clef bass
  \repeat tremolo 12 { b,32 ds } |
  \repeat tremolo 12 { 32  } |
}



-- Aaron Hill



Re: Chord Name Exceptions

2021-04-09 Thread Aaron Hill

On 2021-04-09 12:06 pm, Gabriel Borin wrote:

Hello,

I have been trying to write a bass part for a big band. Although I am
mostly happy with the general output of chord names, I don´t like
half-diminished notation in Lilypond. I prefer the descriptive "m7(b5) 
or

min7(b5)".

I have been trying to use the snippet under this link with no success:
https://lilypond.org/doc/v2.19/Documentation/notation/displaying-chords.en.html


It is hard to say what is going wrong without an example of what you 
specifically tried.  Here is an example that specifically works with 
m7(b5) that you can compare and contrast with:



\version "2.22.0"

customChordNames = {
  
   -\markup \concat { m \super { 7 ( \flat 5 ) } }
}
customChordNameExceptions = #(append
 (sequential-music-to-chord-exceptions
  customChordNames
  #t)
 ignatzekExceptions)

\new ChordNames
\chordmode {
  d:m7.5-
  \set chordNameExceptions =
#customChordNameExceptions
  d:m7.5-
}


While requiring a little bit more logic, it is possible to use 
\chordmode so you do not have to type out :



\version "2.22.0"

customChordNamesUsingChordMode = {
  \chordmode { c:m7.5- }
   -\markup \concat { m \super { 7 ( \flat 5 ) } }
}
customChordNameExceptionsUsingChordMode = #(append
 (sequential-music-to-chord-exceptions
  (make-sequential-music
   (extract-typed-music
customChordNamesUsingChordMode
'event-chord))
  #t)
 ignatzekExceptions)

\new ChordNames
\chordmode {
  d:m7.5-
  \set chordNameExceptions =
#customChordNameExceptionsUsingChordMode
  d:m7.5-
}



-- Aaron Hill



Re: Partial ottava sign

2021-02-19 Thread Aaron Hill

On 2021-02-19 5:48 pm, Andrew Bernard wrote:

Acceptable to Gould or not, there are valid use cases for this (in my
New Complexity stuff for one). There's a way to do it - I need to find
it in my library code later today. I seem to vaguely recall there is
an example in LSR? I may be wrong.


Maybe 875 [1]?

[1]: http://lsr.di.unimi.it/LSR/Item?id=875


-- Aaron Hill



Re: set variable

2021-02-19 Thread Aaron Hill

On 2021-02-19 12:21 pm, Robert Kubosz wrote:

Hello

The default way to override an existing variable in scheme is:
#(define foo 2)
#(set! foo 3)
#(display foo) %--> output is 3

I want to override the foo with use of another variable storing the
foo's varname:

#(define foo 2)
#(define bar 'foo) %variable storing the foo's varname
#(set! `,bar 3)  %I want here to override the foo variable with use of 
bar

#(display foo) %---> the expected by me output is 3

How can I do this?


The set! macro expects the variable to be changed.  On the other hand, 
module-set! expects a symbol naming the variable to be changed.  If you 
know the variable is within the current-module, you can do this:



\version "2.22.0"

#(define xyzzy 123)
#(format #t "\nxyzzy = ~s" xyzzy)
#(set! xyzzy -456)
#(format #t "\nxyzzy = ~s" xyzzy)
#(module-set! (current-module) 'xyzzy 78.9)
#(format #t "\nxyzzy = ~s" xyzzy)


Parsing...
xyzzy = 123
xyzzy = -456
xyzzy = 78.9
Success: compilation successfully completed



-- Aaron Hill



Re: Frescobaldi 3.1.3 and landscape music

2021-02-11 Thread Aaron Hill

On 2021-02-11 12:53 pm, t...@risingdove.com wrote:

I just updated Lilypond to version 2.22.0 and Frescobaldi to version
3.1.3. I brought up a
piece that's engraved in landscape orientation. Frescobaldi and
Lilypond work fine, the piece
is engraved -- but Frescobaldi displays it in portrait orientation, so
it appears on its side!

When I use Fresco's LilyPond|Engrave(publish) command, Adobe Acrobat
shows it the same
way! What have I missed?


Are you using

  #(set-default-paper-size "a6" 'landscape)

or

  #(set-default-paper-size "a6landscape")

?

The former simply rotates the content while keeping the normal paper 
dimensions.  The latter swaps the height and width values without 
rotation.  See [1].


[1]: 
http://lilypond.org/doc/v2.22/Documentation/notation/paper-size-and-automatic-scaling



-- Aaron Hill



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

2021-04-23 Thread Aaron Hill

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

If you have it at hand in Scheme:

\version "2.23.

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

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

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


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



\version "2.22.0"

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

foo = { c  }

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


-- Aaron Hill

Re: Parenthensize a horizontal group?

2021-08-26 Thread Aaron Hill

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

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

the issue in my score]

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


It is possible to add some padding to the BarLine:


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



-- Aaron Hill



Re: Gracenote bug?

2021-08-23 Thread Aaron Hill

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

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


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

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


-- Aaron Hill



Re: Adjusting horizontal space from notehead to bar line

2021-08-23 Thread Aaron Hill

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

Hello Hans, LilyPonders,

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

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

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

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

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

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

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

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

. 1.2) \bar "||"


You might need to be specific about context:

\override Staff.BarLine...
  ^^

-- Aaron Hill



Re: how to insert text inside a hairpin?

2021-09-03 Thread Aaron Hill

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


  See attached image.

  How do I do that in Lilypond?

  I'm using Lilypond 2.22.0


Maybe something like this:


\version "2.22.0"

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

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

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


-- Aaron Hill

Re: Adding a quote to lyrics

2021-09-12 Thread Aaron Hill

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

a church organist/ music director.)!


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



-- Aaron Hill



Re: Old style bass clef

2021-09-15 Thread Aaron Hill

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

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

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

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


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



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



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



-- Aaron Hill



Re: Old style bass clef

2021-09-15 Thread Aaron Hill

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

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


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


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



-- Aaron Hill



Re: Having an actual hyphen in the lyrics?

2021-09-15 Thread Aaron Hill

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

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


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


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


-- Aaron Hill



Re: Misunderstanding \footnote

2021-09-08 Thread Aaron Hill

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


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



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



-- Aaron Hill



Re: Using Scheme inside Lilypond

2021-09-04 Thread Aaron Hill

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

Can someone educate me as to why this works:

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


but this does not:

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

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

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

Richard Shann


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



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


-- Aaron Hill



Re: percent and bar lines

2021-09-16 Thread Aaron Hill

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

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

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

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


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


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



-- Aaron Hill



Re: Removing dynamics from PartCombined staff

2021-09-17 Thread Aaron Hill

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

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


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


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

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

{ \asdf \noDynamics \asdf }



-- Aaron Hill



Re: Old style bass clef

2021-09-16 Thread Aaron Hill

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

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

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


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


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


-- Aaron Hill



Re: Having an actual hyphen in the lyrics?

2021-09-14 Thread Aaron Hill

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

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


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



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

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


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



-- Aaron Hill



Re: Adding a quote to lyrics

2021-09-11 Thread Aaron Hill

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

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

myself!


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


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

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



-- Aaron Hill



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

2021-08-02 Thread Aaron Hill

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

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

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


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


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


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


-- Aaron Hill



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

2021-08-07 Thread Aaron Hill

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

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


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



\version "2.22.0"

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

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

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

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


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


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



-- Aaron Hill

Re: Differentiate between including and direct compiling a file

2021-08-07 Thread Aaron Hill

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

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


Perhaps something like this:


\version "2.22.0"

ifCompiledDirectly =
#(define-scheme-function (scm) (scheme?)
  (let ((file (car (ly:input-file-line-char-column (*location*)
   (if (member file (command-line)) scm)))

\ifCompiledDirectly \markup "Compiled directly..."
\ifCompiledDirectly \score { { b'4 4 2 } }


The logic is simple: check to see if the command-line arguments contain 
the name of the file being processed.



-- Aaron Hill



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

2021-08-07 Thread Aaron Hill

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

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


Text spanners [1] should be what you need.

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



-- Aaron Hill



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

2021-07-31 Thread Aaron Hill

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

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

paper block.


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


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

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



\version "2.22.0"

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

\paper { indent = 0 }

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



-- Aaron Hill

Re: incomplete tuplets

2021-07-31 Thread Aaron Hill

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

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

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

the documentation but haven't found anything.


Not a perfect replica, but hopefully a start:


\version "2.22.0"

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


-- Aaron Hill

Re: Custom note names, or meta-score?

2021-07-31 Thread Aaron Hill

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

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


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

It is funny how similar our approaches were.


-- Aaron Hill



Re: Custom note names, or meta-score?

2021-07-31 Thread Aaron Hill

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

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


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



\version "2.22.0"

#(define generic-notes '())

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

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

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

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

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

\registerGenericLanguage
\language "generic"

{ qw4 er2 ty8->  }


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


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


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


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



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


-- Aaron Hill

Re: How to make a macro of articulation marks?

2021-07-30 Thread Aaron Hill

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

I tried:

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

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


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



-- Aaron Hill



Re: run error Lilypond-book on Windows 10

2021-08-06 Thread Aaron Hill

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

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


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


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



-- Aaron Hill



Re: Ending Tie to No Note

2021-08-06 Thread Aaron Hill

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

Is there a better way to do this?

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

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

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

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


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


-- Aaron Hill



Re: Font

2021-09-23 Thread Aaron Hill

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

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

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


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



\version "2.22.0"

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

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

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


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



-- Aaron Hill

Re: Font

2021-09-23 Thread Aaron Hill

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

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


See [1].

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


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



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




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


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


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


-- Aaron Hill



Re: concatenate BarNumber and string (\")?

2021-09-25 Thread Aaron Hill

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

Hi,

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

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

Do you have any tips on how to do that?

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

to concatenate the printed number to an arbitrary string.

Any suggestions?


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


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



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

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

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



-- Aaron Hill



Re: Change text size within " "?

2021-10-07 Thread Aaron Hill

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

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

the header block within the quotation marks?



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


Know that each header property supports markup directly:


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




-- Aaron Hill



Re: Horizontal line between hymn verses

2021-10-07 Thread Aaron Hill

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

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


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


\version "2.20.0"

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

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

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

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

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



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



-- Aaron Hill



Re: Mandatory dashes in lyrics

2021-10-10 Thread Aaron Hill

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

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

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


You can force a LyricHyphen to appear:


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

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

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


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



-- Aaron Hill



Re: Manipulating lyrics with a music function

2021-10-08 Thread Aaron Hill

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

macOS 10.14.6, Lilypond 2.22.1

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


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



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

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

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




-- Aaron Hill



Re: voiceOne and oneVoice

2021-09-30 Thread Aaron Hill

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

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


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


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

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


-- Aaron Hill



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

2021-10-23 Thread Aaron Hill

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

Hi;

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

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


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



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

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



-- Aaron Hill



Re: Start, end, gradient of Glissando

2021-10-24 Thread Aaron Hill

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

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

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


Would be great !!


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


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



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

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

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

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

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

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

Re: Start, end, gradient of Glissando

2021-10-24 Thread Aaron Hill

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

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


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



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


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





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


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




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


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


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


-- Aaron Hill



Re: Multiple versions of Lilypond?

2021-10-24 Thread Aaron Hill

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

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


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



-- Aaron Hill



Re: Markup with long notes spacing

2021-10-24 Thread Aaron Hill

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

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

Any suggestions?

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


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


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



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



-- Aaron Hill



Re: Markup with long notes spacing

2021-10-24 Thread Aaron Hill

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

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


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



\version "2.18.2"

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

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

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

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

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

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

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

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

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



-- Aaron Hill



Re: Tie between words

2021-12-17 Thread Aaron Hill

On 2021-12-17 12:37 am, Adrian Oehm wrote:

I’ve tried the code you supplied, but unfortunately I keep getting the
following error:

"ly-syntax-constructors.scm:56:23: Wrong number of arguments to
#"

I get this trying to compile both with the code in my document and
also trying to compile yours.  One important thing I didn’t mention is
I’m still using 2.18.2 - I’m not sure if the code is trying to
reference things that are in later versions.


The define-*-function procedures changed between 2.18 and 2.20.  You 
will need to explicitly name the parser and location arguments if you 
are running an older version:



addTieStart =
#(define-music-function (parser location m) (ly:music?)
 ^^^



-- Aaron Hill



Re: String at the bottom of a cover page without using \markup

2021-12-17 Thread Aaron Hill

On 2021-12-17 4:28 pm, Paolo Prete wrote:

The example Aaron showed already added *logic* to the template [...]


To be fair, all I showed was the default setting for oddFooterMarkup 
from titling-init.ly.  Nothing added; that is simply how LilyPond works 
out of the box.


Nearly everything, if not actually everything, LilyPond does by default 
is only a matter of convenience for users, not some sacred declaration 
of "meet, right, and salutary" structure and practice.  There is nothing 
apart from yourself that stops you from defining your own fields and 
adjusting the header/footer markups as is needed for you to complete 
your work.  Any system of organization you insist on is just that--yours 
solely to define, follow, critique, revise, and disregard as 
appropriate.


It might help to reconsider your understanding of header and footer, not 
as elements of structure, but as tools--specifically tools used when you 
need content to appear at the top or bottom of one or more pages 
irrespective of other elements.  Your original query was about placing 
something at the bottom of a page, and the response you have received is 
to leverage oddFooterMarkup as the most direct and minimally disruptive 
method.



-- Aaron Hill



Re: Feedback wanted: syntax highlighting in the LilyPond documentation

2022-01-04 Thread Aaron Hill

On 2022-01-04 11:32 am, Jean Abou Samra wrote:

Forgive my igorance with the inner workings of the
Internet: what does this mean in connection with GDPR
and all that? Am I right that the fact that the
information stored on the user's device serves
a purpose essential to satisfying the very request
of the user means that it would fall under PECR
exceptions to the requirement of a banner asking
for explicit consent of the user?


Always best to consult a lawyer on legal matters.

My layman understanding is that GDPR generally deals with information 
that passes through servers that might be retained without offering some 
form of end-user control.  Use of localStorage, rather than cookies, 
should mean no settings ever need to be sent to the server.  Users are 
entirely in control of this local data, although I suppose some browsers 
make it easier to access than others.


For those with privacy or security concerns, the web site source still 
remains entirely auditable as everything with styling is done local on 
the browser.  And the code in question should be so trivial that there 
is no need to minify/uglify it, so that preserves readability and 
hopefully earns some trust that we are not doing anything shady.




Other than that, well, there is still JavaScript.
That's may not be the thing to be most happy about, but
we could check how LibreJS handles that JavaScript,
possibly adding stylized license comments, so that
it would be no problem to those people refusing non-free
JavaScript using LibreJS/IceCat. All in all this approach
does look promising to me.


I think I am not understanding the concerns around licensing.

At the end of the day, if someone does not want to use JavaScript, then 
the functionality will not work.  We should make sure the default 
behavior of the site is sound for such cases, so no one feels they have 
to enable JS if they do not wish.  That might mean the standard styling 
needs to be black and white if that creates the least friction for 
users.



-- Aaron Hill



Re: Feedback wanted: syntax highlighting in the LilyPond documentation

2022-01-04 Thread Aaron Hill

On 2022-01-04 7:29 am, Erika Pirnes wrote:

Would it be terribly difficult to have a color setting on the
documentation page, so that people can choose between black and color?


It is fairly straightforward with CSS and a little JavaScript:





  
  
  
  Dynamic styles
  
body { font-size: 36pt; }
.button {
  background: #999; border-radius: 9pt;
  cursor: pointer; display: inline-block;
  padding: 9pt; user-select: none;
}
.colors > code > .type { color: purple; }
.colors > code > .identifier { color: blue; }
.colors > code > .keyword { color: brown; }
.colors > code > .number { color: darkgoldenrod; }
.colors > code > .string { color: green; }
.colors > code > .punctuation { color: gray; }
  


  
function toggleColors() {
  if (document.body.classList.contains('colors')) {
document.body.classList.remove('colors');
  } else {
document.body.classList.add('colors');
  }
}
  
  Toggle Colors

  
int
main() 
{
printfclass="punctuation">("Hello, 
World!\n");

return
0;
}
  




-- Aaron Hill



Re: Feedback wanted: syntax highlighting in the LilyPond documentation

2022-01-04 Thread Aaron Hill

On 2022-01-04 10:04 am, Valentin Petzel wrote:

The problem is that we probably want to
remember the set color scheme for longer than just the current page,
so we'd need something like cookies.


Not a problem in the slightest.  But not cookies... localStorage [1].

[1]: 
https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage



-- Aaron Hill



Re: Feedback wanted: syntax highlighting in the LilyPond documentation

2022-01-04 Thread Aaron Hill

On 2022-01-04 1:42 pm, Jean Abou Samra wrote:

https://www.gnu.org/philosophy/javascript-trap.en.html
[ . . . ]
But I'm probably fretting for something that is
very easy in the end.


The code Lilypond's site would use would be entirely homegrown, licensed 
under GPL.  Not sure there is anything here to worry unless we determine 
there is an external dependency that is required.




If we add a toggle for switching highlighting on and
off, then the next question will of course be what
the default should be. Without surprise, I would prefer
if it were on by default, but I wouldn't mind the
other way.


And honestly, I like the default being on, simply because it advertises 
the new feature.  If folks load up the docs and see the familiar black 
and white, they might not know to look for the option to enable 
highlighting.


Perhaps a good strategy would be to initially enable the feature for an 
entire release cycle.  This gets folks using it and providing feedback.  
Most of the discussion so far has been limited in scope so it is hard to 
know if the system works well over the entire manual and for day-to-day 
usage.


I would not be surprised if some creative folks on the list end up 
creating new color schemes to be included as options aside from the 
default.  A dark mode scheme is almost inevitable.




Are you sure about that? This is one page that drew
my attention:

https://law.stackexchange.com/questions/30739/do-the-gdpr-and-cookie-law-regulations-apply-to-localstorage


One of the posts a little further down talks about shopping carts.  The 
way I read this is that when a user is performing an action where 
something being saved is reasonably expected as part of the 
functionality, there is no need to ask permission.  The question we 
would have is whether selecting a color scheme carries an expectation 
that it should persist.



-- Aaron Hill



Re: global alignment tweak for ChordName

2021-12-21 Thread Aaron Hill

On 2021-12-21 10:30 am, Kieren MacMillan wrote:

and am once again in need this ChordName alignment feature. Is anyone
out there able to shepherd me through building a callback to make this
happen?


I've used something like this in the past:


\version "2.22.0"

music = \chordmode {
  \override ChordName.X-offset =
  #(lambda (grob)
(let* ((sten (ly:grob-property grob 'stencil))
   (xex (ly:stencil-extent sten X))
   (width (interval-length xex)))
 (* -0.5 (max 0 (- width 2)

  c1 c:7 c:m7 c':m6/ees
}
<< \new ChordNames \music \new Staff \music >>



-- Aaron Hill



Re: minimum measure size?

2021-12-28 Thread Aaron Hill

On 2021-12-28 3:18 pm, Tom Sgouros wrote:

I was reviewing the settable parameters, but I think maybe I don't
understand enough of lilypond's native jargon yet to know what to look 
for.
I found setting for counting measures and grouping measures, but what 
about

measuring measures? What tree should I be barking up here?


If your intention is to have to more room for penciling in things, you 
could look at the section on Horizontal Spacing [1].  There are a few 
ways in which you can instruct LilyPond to place notes further apart:



notes = \relative b' { \time 3/4 b4 a g | a2 g4 | fis8 g a4 b | c2. \bar 
"|." }


{ \notes }
{ \override Score.SpacingSpanner.spacing-increment = #2 \notes }
{ \override Score.SpacingSpanner.base-shortest-duration = 
#(ly:make-moment 1/32) \notes }



[1]: 
https://lilypond.org/doc/v2.22/Documentation/notation/horizontal-spacing



Another option is to simply set the total number of systems for your 
score.  LilyPond will naturally spread out music if it is constrained to 
meet a minimum system count:



\paper { system-count = 2 }
{ \notes }
%%%%



-- Aaron Hill



Re: How to get huge text (ie: "To Coda") above a volta bracket?

2021-12-20 Thread Aaron Hill

On 2021-12-20 3:48 pm, Kenneth Wolcott wrote:

Hi;

  How to get huge text (ie: "To Coda") above a volta bracket?


Set outside-staff-priority as needed.  The default for 
VoltaBracketSpanner is 600.



\repeat volta 2 { b'4 a' g'2 }
\alternative { { a'4 b' a'2 }
{ fis'1
  -\tweak outside-staff-priority #599
  ^\markup \bold "Below!"
  -\tweak outside-staff-priority #601
  ^\markup \bold "Above!"
} }


-- Aaron Hill



Re: Get value of Scheme function to display as a markup in Lilypond

2021-11-23 Thread Aaron Hill

On 2021-11-23 2:56 pm, Dimitris Marinakis wrote:
Finally got to learn a bit of Scheme. I've made decent progress within 
the
Scheme sandbox. Now I'm trying to integrate a few things within 
Lilypond.


Let's say I have this function:
#(define (dostuff x) (+ x 5))

What would be the equivalent of #(display (dostuff 2)) but inside a
Lilypond markup?
So that if my Lilypond music code looks like that, I'll get the correct
value from that function.
{
c^\markuptitle (placeholder) #2
}

I don't want the x argument to be displayed in the markup but rather 
the

result of the function.

It's OK if this has to be broken into multiple steps.


One option is to format the output you want as a string and then include 
that in \markup:



#(define (dostuff x) (+ x 5))
\markup #(format #f "result = ~a" (dostuff 47))


If you just need the value, you could use number->string.  But for 
anything fancier, the formatted printing functionality is quite powerful 
and worth learning:



\markup #(format #f "~{~a fish~^, ~}." '(one two red blue))



-- Aaron Hill



Re: How to increase the distance between the last note of a measure and the following bar line

2021-11-11 Thread Aaron Hill

On 2021-11-11 5:50 am, Jean Abou Samra wrote:

Le 11/11/2021 à 13:24, Paolo Prete a écrit :


This appears to me as an additional issue instead a *must do*. 
Formatting as pdf (or plain text) an API doc with an OO paradygm and 
plenty of links is IMHO meaningless. I give you a personal advice: 
don't spend your time in the creation of this kind of document; what 
now seems good to you, in the future will show many unwanted side 
effects.



It's not that I personally like or use documentation
in PDF or info format; the choice is not mine. We
already build all manuals in all three formats, and
some users are accustomed to them. If we change the
formatting of the IR, formats other than HTML must
be accounted for, either by choosing a presentation
scheme that is readable in those formats or by
generating conditional Texinfo markup (@ifpdf and
similar) so that they will use their own scheme
entirely.


If it helps to have a data point, I exclusively use the PDF manuals for 
my reference (apart from searching the code base directly).



-- Aaron Hill



Re: Lyrics above staff height inconsistent

2021-11-10 Thread Aaron Hill

On 2021-11-10 7:46 am, Adam Good wrote:

Dear List,

Here's a question I'm sure has been asked and answered often. I much 
prefer

lyrics below the staff but if I had to, in the example below, what is
causing the lyrics on the 2nd and 3rd stafflines to be higher than
staffline 1? Playing with:

\override VerticalAxisGroup.nonstaff-relatedstaff-spacing.padding

...doesn't quite deliver for me.


Padding is only one element of spacing.  You need to consider 
basic-distance and minimum-distance, perhaps also stretchability.


LilyPond will try to accommodate basic-distance though it does not force 
it to be exact, as it may compress or stretch vertical spacing when 
fitting music to the page.  While minimum-distance does define a strict 
lower bound for the spacing, elements still could be stretched apart.  
Both basic- and minimum-distance are measured from baseline-to-baseline, 
whereas padding factors in the skylines of the content to ensure a 
specified distance between "ink".


The default spacing for Lyrics is a basic-distance of 5.5, padding of 
0.5, and stretchability of 1.  minimum-distance is unspecified, which I 
believe defaults to zero.


In your example, LilyPond could not accommodate the 5.5 basic-distance 
for the top line of Lyrics and reduced it to the minimum; however, 
factoring in padding results in it being a little further away.  Since 
there seems to be quite a bit of paper space available, it is odd that 
the basic-distance could not be satisfied.  Perhaps there is a subtle 
bug in the layout logic.


The easy fix is to specify minimum-distance as well.  If you like 5.5 as 
a basic-distance, just match that value.



-- Aaron Hill



Re: \omit Staff.BarLine

2021-11-16 Thread Aaron Hill

On 2021-11-16 11:37 am, Jean Abou Samra wrote:

Or use this:

https://lists.gnu.org/archive/html/lilypond-user/2021-01/msg00058.html


That's clever.  :)


-- Aaron Hill



Re: \omit Staff.BarLine

2021-11-16 Thread Aaron Hill

On 2021-11-16 11:13 am, E Appeldoorn wrote:

Thanks Aaron

My question appears to be incompleet. The piece does need a final 
barline

\bar "|."

\remove the "bar_engraver" through the staff context seems to make
that impossible.


(Be sure to keep lilypond-user@gnu.org on the TO: or CC: for 
visibility.)


Another option is to treat the piece as a cadenza.  Just know that you 
will need to manually insert \bar "" in places to permit line breaks.



-- Aaron Hill



Re: \omit Staff.BarLine

2021-11-16 Thread Aaron Hill

On 2021-11-16 10:46 am, E Appeldoorn wrote:

In a score that has no barlines I have used
\omit Staff.BarLine
Which indeed leaves out the barlines. But the space and padding, which
the barline would normally use, remain.


%%
\version "2.22.1"
\fixed c {
\time 4\4
\omit Staff.BarLine
a4 a a a |
b b b b }
%%

Would give a very visible difference between the a's  and the a to b
(Where the barline would be had it been visible.)
It therefore looks wobbly and horrible.
How would I be able to solve that so the score looks naturally spaced.


Try \removing the Bar_engraver from the Staff context instead of 
\omitting the BarLine grob.



-- Aaron Hill



Re: Help

2021-11-19 Thread Aaron Hill

On 2021-11-19 9:00 pm, Leonid Hrabovsky wrote:

http://lilypond.1069038.n5.nabble.com/Aleatoric-modern-notation-tp18113p18117.html
http://lilypond.1069038.n5.nabble.com/help-with-frameEngraver-bars-and-boxes-function-td199021.html

   - are not working - "This site can't be reached" - what might happen 
to
   them? It is a sorrow for me - these links obviously provided the 
exhaustive

   treatise about modern notation in LilyPond so needed for me...
   - Any suggestions?


Nabble seems to be borked.  I think these are the two relevant threads.

[1]: 
https://lists.gnu.org/archive/html/lilypond-user/2012-03/msg00296.html
[2]: 
https://lists.gnu.org/archive/html/lilypond-user/2017-01/msg00196.html



-- Aaron Hill



Re: Box around MeasureCounter

2021-11-17 Thread Aaron Hill

On 2021-11-17 2:29 pm, Rajesh Baskar wrote:

Does anyone know how to add a box around a measure counter? I have
included two images below, one is the image that is generated using
the below lilypond code and the other on is what I’m trying to
achieve.


Here is one way to add a box to any grob:


\version "2.20.0"

boxify =
#(define-music-function
  (grob-path) (key-list?)
  (define proc (grob-transformer 'stencil
   (lambda (grob orig) (grob-interpret-markup grob #{
\markup \override #'(box-padding . 0.25)
\override #'(thickness . 2)
\box \stencil #orig #}
  #{ \override $grob-path . stencil = #proc #})

\new Staff
\with {
  \consists Measure_counter_engraver
  \boxify MeasureCounter
}
{
  \boxify Staff.Clef
  \startMeasureCount
  fis'4 g'8 a' \once \boxify Accidental bes'2 cis''4 d''2.
  \stopMeasureCount
}



-- Aaron Hill



Re: Fwd: Fwd: Help

2021-11-25 Thread Aaron Hill

On 2021-11-25 6:22 am, Leonid Hrabovsky wrote:

Hello Jean,
after receiving your code, I started tweaking its numbers with the aim 
to
obtain the lines of the proper size - and now I have approximately two 
of
three I need - one built out of arches and one angulary. I am going to 
try
to maybe tweak the height a bit more in order to make the arch similar 
to a
semicircle (arch-length 4, arch-height 2?) as an extra variant. This is 
the

final code of these:


A cubic Bézier curve can reasonably approximate a quarter circle.

Therefore, to get a semicircle, you will need at least two segments:


\markup \path #0.2
#'((moveto 0 0)
   (curveto 0 1.1 0.9 2 2 2)
   (curveto 3.1 2 4 1.1 4 0))


Those control points are selected so that the midpoint (t=0.5) of the 
curve is tangent to the circle.  The exact value of (4/3)*(sqrt(2)-1) 
was approximated as 0.55 in the above example.



-- Aaron Hill



Re: Box around MeasureCounter

2021-11-22 Thread Aaron Hill

On 2021-11-22 11:24 am, Rajesh Baskar wrote:

I had another question. The MeasureCounter boxify function does not
work if we change the staff to Rhythmic staff.


You need to scope the grob to the appropriate context.  \boxifying 
something within Staff only affects Staff.  If you need it to work for 
RhythmicStaff, just be more specific:



\new Voice {
  \boxify RhythmicStaff.MeasureCounter
  ...
}

%% ...or... %%

\new RhythmicStaff
\with { \boxify MeasureCounter }
{ ... }

%% ...or... %%

\layout {
  \context {
\RhythmicStaff
\boxify MeasureCounter
  }
}



-- Aaron Hill



<    5   6   7   8   9   10   11   12   13   >