lyrics on rhythmicstaff?

2023-03-07 Thread Nate
I'm trying to set 'lyrics' (chords which do not match lilypond's
interpretation of the notes) to notes on a RhythmicStaff, but I'm not
seeing the lyrics.
I thought maybe it was the rhythmicstaff that didn't like lyrics, but
perhaps they need to be in a score? This is inside a snippet set inside a
latex fbox.
The notes print as expected, and the example seems to follow the docs
except for the score. Do lyrics need to be inside a score? Did I miss
something else?

   \lilypond[noindent, nofragment]{
  \new RhythmicStaff \with { \remove "Staff_symbol_engraver" \remove
"Clef_engraver" \remove "Time_signature_engraver"} {
\new Voice = "melody" { \relative { c8 c4. c8 c8 } }
  }
  \new Lyrics  { \lyricsto "melody" { 1 3 3 3  }  }
   }

[image: image.png]


Re: lyrics on rhythmicstaff?

2023-03-07 Thread Nate
Thank you. Quoting it plus >>  worked, though I still had to use the {}
around << >> to get it to work with lualatex.

On Tue, Mar 7, 2023, 12:08 PM Jean Abou Samra  wrote:

> Le mardi 07 mars 2023 à 11:55 -0500, Nate a écrit :
>
> I'm trying to set 'lyrics' (chords which do not match lilypond's
> interpretation of the notes) to notes on a RhythmicStaff, but I'm not
> seeing the lyrics. I thought maybe it was the rhythmicstaff that didn't
> like lyrics, but perhaps they need to be in a score? This is inside a
> snippet set inside a latex fbox. The notes print as expected, and the
> example seems to follow the docs except for the score. Do lyrics need to be
> inside a score? Did I miss something else?
>
>\lilypond[noindent, nofragment]{   \new RhythmicStaff \with {
> \remove "Staff_symbol_engraver" \remove "Clef_engraver" \remove
> "Time_signature_engraver"} {
> \new Voice = "melody" { \relative { c8 c4. c8 c8 } }   }
> \new Lyrics  { \lyricsto "melody" { 1 3 3 3  }  }
>}
>
> If I understand correctly, you're seeking to literally print digits like
> “1” and “3” under the rhythmic staff. Is that right?
>
> Naked digits are LilyPond's syntax for durations. LilyPond gives errors
> messages like
>
> /tmp/frescobaldi-p_ajfnr0/tmp277_r7m5/document.ly:7:41: error: not a duration
>   \new Lyrics  { \lyricsto "melody" { 1
> 3 3 3 } }
>
> on your code because it tries to interpret "3" as a duration, while only
> "1", "2", "4", "8" (plus dotted durations etc.) are valid. If you want them
> literally, you need to quote them, as in
>
> \version "2.24.1"
>
> <<
>   \new RhythmicStaff \with { \remove "Staff_symbol_engraver" \remove 
> "Clef_engraver" \remove "Time_signature_engraver"} {
> \new Voice = "melody" { \relative { c8 c4. c8 c8 } }
>   }
>   \new Lyrics  { \lyricsto "melody" { "1" "3" "3" "3" } }
> >>
>
> Also note that you should use << >>, not { }, around the \new
> RhythmicStaff and \new Lyrics commands, since { } is the syntax for
> putting expressions in sequence, and you want the lyrics at the same time
> as the melody, not after the melody has ended.
>


bare time signature rendering difference

2023-03-09 Thread Nate
I seem to have some sort of platform difference between my desktop and
laptop computers. I'm rendering a bare time signature and tempo in a LaTeX
table using lyluatex.

The snippet:
\lilypond[noindent, nofragment]
  { \new RhythmicStaff \with {\remove "Staff_symbol_engraver"}
  { \time 6/8 \numericTimeSignature  \tempo 4=120  }}

renders as expected with lualatex --shell-escape ts.lytex
[image: ts.png]
(LuaTex v 1.10.0 TeX Live 2019/Debian)
LaTeX2e 2020-02-02 patch level 2

However my desktop appears to have
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020/Debian)
LaTeX2e <2020-10-01> patch level 4
installed, and fails to render any output:

Module lyluatex Warning: The score doesn't contain any music:
(lyluatex)   this will probably cause bad output

Is this properly formatted code?


Re: bare time signature rendering difference

2023-03-09 Thread Nate
Thanks - my output included no such warning.
(lyluatex)  Compiling score tmp-ly/51d5af77a942f28ac1f5986a0ab47d35
with LilyPond executable 'lilypond'.

Module lyluatex Warning: The score doesn't contain any music:
(lyluatex)   this will probably cause bad output. on input line
8vim
(./ts.aux))
 431 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 6 attribute, 50
glue_spec
, 6 attribute_list, 2 write, 1 pdf_colorstack nodes
   avail lists: 2:10,3:1,4:1,5:4,7:1,9:1

warning  (pdf backend): no pages of output.

On Fri, Mar 10, 2023 at 1:12 AM Werner LEMBERG  wrote:

>
> > I seem to have some sort of platform difference between my desktop
> > and laptop computers.  I'm rendering a bare time signature and tempo
> > in a LaTeX table using lyluatex.
> >
> > The snippet: [...]
> >
> >   {
> > \new RhythmicStaff \with {\remove "Staff_symbol_engraver"}
> > { \time 6/8 \numericTimeSignature \tempo 4=120 }
> >   }
> >
> > [...] fails to render any output:
> >
> > Module lyluatex Warning: The score doesn't contain any music:
> > (lyluatex)   this will probably cause bad output
> >
> > Is this properly formatted code?
>
> Apparently your two computers use different LilyPond versions: recent
> versions complain with
>
> ```
> Warning: skipping zero-duration score
> Warning: to suppress this, consider adding a spacer rest
> ```
>
> If you do what the warning suggests, the snippet compiles again:
>
> ```
> \new RhythmicStaff \with {\remove "Staff_symbol_engraver"}
> { \time 6/8 \numericTimeSignature \tempo 4=120 s }
> ```
>
>
> Werner
>


Re: Anybody else playing with GPT4 and Lilypond?

2023-03-29 Thread Nate
Hah yes. It once said \begn{music} and i said "are you making this up?"
"I'm sorry, you're correct. The start tag should be \begin{lilypond}.

Its super handy but you have to watch it. It can be a pathological liar. I
asked it how to do something on the Akai Mini Play and it said to use this
button  On the upper left corner. when i asked for clarification instead of
admitting it was mistaken it said it was white and next to another button.
Twice it doubled down before admitting it was wrong.

On Wed, Mar 29, 2023, 6:44 PM Saul Tobin  wrote:

> I've seen some examples of other people succeeding in getting ChatGPT with
> GPT4 to compose simple music in other text based music formats. I've had
> limited success getting it to output Lilypond code. It is able to correctly
> structure the code with a score block, nested contexts, and appropriately
> named variables, and bar checks at the end of each measure. It seems to
> struggle to create rhythms that fit within the time signature beyond
> extremely simple cases. It also seems to struggle a lot to understand what
> octave pitches will be in when using relative mode.
>
> It also seems to have a lot of trouble keeping track of the relationship
> between notes entered in different simultaneous expressions. Just asking it
> to repeat back which notes appear in each voice on each beat, GPT4
> frequently gives stubbornly incorrect answers about the music it generated.
> This makes it very difficult to improve its output by giving feedback.
>
> I'm curious whether anybody else has tried playing with this. I have to
> imagine that GPT4 has the potential to produce higher quality Lilypond
> output, given some of the other impressive things it can do. Perhaps it
> needs to be provided with a large volume of musical repertoire in Lilypond
> format.
>


Re: Anybody else playing with GPT4 and Lilypond?

2023-03-29 Thread Nate
For some real fun i asked it to generate code that a potential solution
would be recursive (without suggesting a recursive solution). The first
time I stumped it and it went off for two hours. I asked it again later and
it camenback with an interative solution without getting stuck . But i
found that amusing

On Wed, Mar 29, 2023, 7:07 PM Kenneth Wolcott 
wrote:

> HI Saul;
>
>   I asked ChatGPT to write some ABC notation.  The result was...'okay'.
>
>   I then asked for a very simple arrangement of some children's tune
> and it got very confused about relative pitches.  Since the rhythm for
> the piece of music I requested was so simple it didn't have a problem
> generating the score.  I argued with ChatGPT about relative pitches in
> Lilypond, I told it to go back and read the manuals :-)  I gave up
> asking ChatGPT about generating Lilypond scores after that.
>
> Ken Wolcott
>
> On Wed, Mar 29, 2023 at 3:44 PM Saul Tobin 
> wrote:
> >
> > I've seen some examples of other people succeeding in getting ChatGPT
> with GPT4 to compose simple music in other text based music formats. I've
> had limited success getting it to output Lilypond code. It is able to
> correctly structure the code with a score block, nested contexts, and
> appropriately named variables, and bar checks at the end of each measure.
> It seems to struggle to create rhythms that fit within the time signature
> beyond extremely simple cases. It also seems to struggle a lot to
> understand what octave pitches will be in when using relative mode.
> >
> > It also seems to have a lot of trouble keeping track of the relationship
> between notes entered in different simultaneous expressions. Just asking it
> to repeat back which notes appear in each voice on each beat, GPT4
> frequently gives stubbornly incorrect answers about the music it generated.
> This makes it very difficult to improve its output by giving feedback.
> >
> > I'm curious whether anybody else has tried playing with this. I have to
> imagine that GPT4 has the potential to produce higher quality Lilypond
> output, given some of the other impressive things it can do. Perhaps it
> needs to be provided with a large volume of musical repertoire in Lilypond
> format.
>
>


svg output in windows

2009-09-10 Thread Nate Lally
Can anyone verify that svg output is supported on the windows binary?
It doesn't show up in the help cruft and using the command line switch
-bsvg or -fsvg doesn't do anything at all.
I tried on both stable and devel branches.

-- 
Nate


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Adding to header using module-define! and alist with markups

2021-12-02 Thread Nate Whetsell
I’m trying to programmatically add items to score headers from an alist. This 
works when an item consists of just a string. I can’t seem to get this to work 
when an item is a markup, no matter how the markup is entered. Is there some 
way to store markups in an alist, and then use those markups in a header?

Below is an example illustrating the issue I’m having. Any help would be 
greatly appreciated!

Thanks,
Nate

```
\version "2.22.0"

\paper {
  scoreTitleMarkup = \markup {
\column {
  \fromproperty #'header:piece
  \justify-field #'header:instruction
}
  }
}

#(define instructions '(
  ; Using a LilyPond code block does not work.
  (1 . #{
\markup {
  "Does not work"
  \score {
\new Staff { c'1 }
\layout { ragged-right = ##t indent = 0 }
  }
}
  #})
  ; Using the Scheme form of a markup expression does not work.
  (2 . (markup #:line (#:simple "Does not work")))
  ; Using a string works.
  (3 . "Works")))

\book {
  #(do ((study-number 1 (1+ study-number)))
  ((> study-number 3))
(let ((header (make-module)))
  (module-define! header 'piece (number->string study-number))
  (let* (
  (instruction (assoc study-number instructions))
  (score (scorify-music #{ { c'1 } #})))
(begin
  (if instruction (module-define! header 'instruction (cdr 
instruction)))
  (ly:score-set-header! score header)
  (add-score score)
}
```





Re: Adding to header using module-define! and alist with markups

2021-12-02 Thread Nate Whetsell
Thanks, but unfortunately using a backtick and commas seems to produce the same 
output. If it’s helpful, here’s the same example with a backtick and commas:

```
\version "2.22.0"

\paper {
 scoreTitleMarkup = \markup {
   \column {
 \fromproperty #'header:piece
 \justify-field #'header:instruction
   }
 }
}

#(define instructions `(
 ; Using a LilyPond code block does not work.
 (1 . ,#{
   \markup {
 "Does not work"
 \score {
   \new Staff { c'1 }
   \layout { ragged-right = ##t indent = 0 }
 }
   }
 #})
 ; Using the Scheme form of a markup expression does not work.
 (2 . ,(markup #:line (#:simple "Does not work")))
 ; Using a string works.
 (3 . "Works")))

\book {
 #(do ((study-number 1 (1+ study-number)))
 ((> study-number 3))
   (let ((header (make-module)))
 (module-define! header 'piece (number->string study-number))
 (let* (
 (instruction (assoc study-number instructions))
 (score (scorify-music #{ { c'1 } #})))
   (begin
 (if instruction (module-define! header 'instruction (cdr instruction)))
 (ly:score-set-header! score header)
 (add-score score)
}
```

> On Dec 2, 2021, at 11:02 AM, David Kastrup  wrote:
> 
> Nate Whetsell mailto:nathan.whets...@gmail.com>> 
> writes:
> 
>> I’m trying to programmatically add items to score headers from an alist. 
>> This works when an item consists of just a string. I can’t seem to get this 
>> to work when an item is a markup, no matter how the markup is entered. Is 
>> there some way to store markups in an alist, and then use those markups in a 
>> header?
>> 
>> Below is an example illustrating the issue I’m having. Any help would be 
>> greatly appreciated!
>> 
>> Thanks,
>> Nate
>> 
>> ```
>> \version "2.22.0"
>> 
>> \paper {
>>  scoreTitleMarkup = \markup {
>>\column {
>>  \fromproperty #'header:piece
>>  \justify-field #'header:instruction
>>}
>>  }
>> }
>> 
>> #(define instructions '(
>>  ; Using a LilyPond code block does not work.
>>  (1 . #{
>>\markup {
>>  "Does not work"
> 
> ' introduces a non-evaluated constant expression but you need to
> evaluate #{ ... #} to get a markup.  So try
> 
> #(define instructions `( ;; note backtick instead of forward tick
>  (1 . ,#{   ;; note comma to evaluate one part of the
> ;; quasi-quoted list
> 
> -- 
> David Kastrup



Re: Adding to header using module-define! and alist with markups

2021-12-03 Thread Nate Whetsell
Thanks for your help!

Using \justify as

```
\paper {
 scoreTitleMarkup = \markup {
   \column {
 \fromproperty #'header:piece
 \justify { #'header:instruction }
   }
 }
}
```

may be on the right track, but this results in (for all cases):

```
test.ly:7:17: error: not a markup
 \justify { 
#'header:instruction }
```

Hopefully I’m missing something simple.

> On Dec 2, 2021, at 11:35 AM, David Kastrup  wrote:
> 
> Nate Whetsell mailto:nathan.whets...@gmail.com>> 
> writes:
> 
>> Thanks, but unfortunately using a backtick and commas seems to produce the 
>> same output. If it’s helpful, here’s the same example with a backtick and 
>> commas:
>> 
>> ```
>> \version "2.22.0"
>> 
>> \paper {
>> scoreTitleMarkup = \markup {
>>   \column {
>> \fromproperty #'header:piece
>> \justify-field #'header:instruction
>>   }
>> }
>> }
> 
> Well, \justify-field just takes a string, like \justify-string does.
> Maybe it should check for markup lists and pass them through \justify .
> 
> -- 
> David Kastrup



Re: Adding to header using module-define! and alist with markups

2021-12-03 Thread Nate Whetsell
🤦🏻‍♂️

That did it, thank you!

> On Dec 3, 2021, at 12:07 PM, Jean Abou Samra  wrote:
> 
> Le 03/12/2021 à 18:04, Nate Whetsell a écrit :
>> Thanks for your help!
>> 
>> Using \justify as
>> 
>> ```
>> \paper {
>>  scoreTitleMarkup = \markup {
>>\column {
>>  \fromproperty #'header:piece
>>  \justify { #'header:instruction }
>>}
>>  }
>> }
>> ```
>> 
>> may be on the right track, but this results in (for all cases):
>> 
>> ```
>> test.ly <http://test.ly>:7:17: error: not a markup
>>  \justify {
>> #'header:instruction }
>> ```
>> 
>> Hopefully I’m missing something simple.
> 
> \justify { \fromproperty #'header:instruction } ?
> 
> Best,
> Jean
> 




PDF bookmark questions

2022-02-01 Thread Nate Whetsell
I’m trying to add PDF bookmarks (to display in PDF readers) to a collection of 
studies. I’m having three issues:

1. If several studies appear on the same page, the bookmarks appear in reverse 
order.

2. The bookmarks seem to navigate to the *page* on which a study appears, not 
the study itself.

3. It doesn’t seem to be possible to add PDF bookmarks without also using 
`\markuplist \table-of-contents` to add a table of content.

Below is an example illustrating the issues I’m having. Is there a way to 
create PDF bookmarks without using `\markuplist \table-of-contents`, have them 
appear in the expected order, and have them navigate to the expected position?

Thanks,
Nate

```
\version "2.22.0"

\book {
  \markuplist \table-of-contents

  #(do ((study-number 1 (1+ study-number)))
  ((> study-number 15))
(let ((header (make-module)))
  (module-define! header 'piece (number->string study-number))
  (let* (
  (score (scorify-music #{
\new Staff <<
  \tocItem \markup { #(number->string study-number) }
  \new Voice { c' }
>>
  #})))
(begin
  (ly:score-set-header! score header)
  (add-score score)
}
```


Re: PDF bookmark questions

2022-02-02 Thread Nate Whetsell
Yes. The actual code on which the example is based is at

https://github.com/nwhetsell/horn-sheet-music/blob/e9f4f5a0569962719dcf6602718400c256e8c7d3/kopprasch-opus-6-60-studies-for-low-horn/main.ly

Hopefully this clarifies why I’m handling score headers in Scheme 
(specifically, some header variables are set conditionally).

> On Feb 2, 2022, at 2:14 AM, Lukas-Fabian Moser  wrote:
> 
> Hi Nate,
> 
> Am 01.02.22 um 22:11 schrieb Nate Whetsell:
>> I’m trying to add PDF bookmarks (to display in PDF readers) to a collection 
>> of studies. I’m having three issues:
>> 
>> 1. If several studies appear on the same page, the bookmarks appear in 
>> reverse order.
>> 
>> 2. The bookmarks seem to navigate to the *page* on which a study appears, 
>> not the study itself.
>> 
>> 3. It doesn’t seem to be possible to add PDF bookmarks without also using 
>> `\markuplist \table-of-contents` to add a table of content.
>> 
>> Below is an example illustrating the issues I’m having. Is there a way to 
>> create PDF bookmarks without using `\markuplist \table-of-contents`, have 
>> them appear in the expected order, and have them navigate to the expected 
>> position?
> Forgive me for barging in without having something to contribute to your 
> actual question:
>> ```
>> \version "2.22.0"
>> 
>> \book {
>>   \markuplist \table-of-contents
>> 
>>   #(do ((study-number 1 (1+ study-number)))
>>   ((> study-number 15))
>> (let ((header (make-module)))
>>   (module-define! header 'piece (number->string study-number))
>>   (let* (
>>   (score (scorify-music #{
>> \new Staff <<
>>   \tocItem \markup { #(number->string study-number) }
>>   \new Voice { c' }
>> >>
>>   #})))
>> (begin
>>   (ly:score-set-header! score header)
>>   (add-score score)
>> }
>> ```
> 
> Are you aware that you can do almost all of this using LilyPond syntax?
> 
> \version "2.22.0"
> 
> \book {
>   \markuplist \table-of-contents
> 
>   #(do ((study-number 1 (1+ study-number)))
>   ((> study-number 15))
>   (add-score
>#{
>  \score {
>\header {
>  piece = #(number->string study-number)
>}
>   \new Staff <<
> \tocItem \markup { #(number->string study-number) }
> \new Voice { c' }
>   >>
>  }
>#}))
> }
> 
> Lukas
> 




Reducing length of stems of beamed notes after \stopStaff

2022-04-16 Thread Nate Whetsell
I’m trying to put some beamed notes (no staff lines, time signature, or 
anything else) in a \markup block. To do this, I’m using a Staff with several 
engravers \remove’d, using \stopStaff to eliminate staff lines, and then 
setting Stem.details.beamed-lengths to reduce the length of stems. However, 
setting Stem.details.beamed-lengths seems to have no effect after \stopStaff, 
so the stems are too tall. Is there some other way to get short beamed notes in 
a \markup block?

Here is an example showing what I’ve tried:

\markup { \justify {
  Lorem ipsum pqpqpq dolor sit amet, consectetur adipiscing elit, sed do eiusmod
  tempor incididunt ut labore et dolore.
  \score {
% Normal Staff with \stopStaff (stems too tall)
\new Staff \with {
  \remove "Bar_engraver"
  \remove "Clef_engraver"
  \remove "Time_signature_engraver"
  \magnifyStaff #(magstep -3)
} {
  \stopStaff
  \override Stem.details.beamed-lengths = #'(3)
  \relative { \time 6/8 \stemUp b'8 8 8 }
}
\layout { ragged-right=##t indent=0 }
  }
  \score {
% RhythmicStaff with \stopStaff (stems too tall)
\new RhythmicStaff \with {
  \remove "Bar_engraver"
  \remove "Clef_engraver"
  \remove "Time_signature_engraver"
  \magnifyStaff #(magstep -3)
} {
  \stopStaff
  \override Stem.details.beamed-lengths = #'(3)
  \relative { \time 6/8 \stemUp b'8 8 8 }
}
\layout { ragged-right=##t indent=0 }
  }
  \score {
% Normal Staff *without* \stopStaff (stems shorter, but staff lines shown)
\new Staff \with {
  \remove "Bar_engraver"
  \remove "Clef_engraver"
  \remove "Time_signature_engraver"
  \magnifyStaff #(magstep -3)
} {
  \override Stem.details.beamed-lengths = #'(3)
  \relative { \time 6/8 \stemUp b'8 8 8 }
}
\layout { ragged-right=##t indent=0 }
  }
} }


Re: Reducing length of stems of beamed notes after \stopStaff

2022-04-18 Thread Nate Whetsell
That worked, thank you!

> On Apr 18, 2022, at 5:34 AM, Thomas Morley  wrote:
> 
> Am Sa., 16. Apr. 2022 um 13:49 Uhr schrieb Nate Whetsell
> :
>> 
>> I’m trying to put some beamed notes (no staff lines, time signature, or 
>> anything else) in a \markup block. To do this, I’m using a Staff with 
>> several engravers \remove’d, using \stopStaff to eliminate staff lines, and 
>> then setting Stem.details.beamed-lengths to reduce the length of stems. 
>> However, setting Stem.details.beamed-lengths seems to have no effect after 
>> \stopStaff, so the stems are too tall. Is there some other way to get short 
>> beamed notes in a \markup block?
>> 
>> Here is an example showing what I’ve tried:
>> 
>> \markup { \justify {
>>  Lorem ipsum pqpqpq dolor sit amet, consectetur adipiscing elit, sed do 
>> eiusmod
>>  tempor incididunt ut labore et dolore.
>>  \score {
>>% Normal Staff with \stopStaff (stems too tall)
>>\new Staff \with {
>>  \remove "Bar_engraver"
>>  \remove "Clef_engraver"
>>  \remove "Time_signature_engraver"
>>  \magnifyStaff #(magstep -3)
>>} {
>>  \stopStaff
>>  \override Stem.details.beamed-lengths = #'(3)
>>  \relative { \time 6/8 \stemUp b'8 8 8 }
>>}
>>\layout { ragged-right=##t indent=0 }
>>  }
>>  \score {
>>% RhythmicStaff with \stopStaff (stems too tall)
>>\new RhythmicStaff \with {
>>  \remove "Bar_engraver"
>>  \remove "Clef_engraver"
>>  \remove "Time_signature_engraver"
>>  \magnifyStaff #(magstep -3)
>>} {
>>  \stopStaff
>>  \override Stem.details.beamed-lengths = #'(3)
>>  \relative { \time 6/8 \stemUp b'8 8 8 }
>>}
>>\layout { ragged-right=##t indent=0 }
>>  }
>>  \score {
>>% Normal Staff *without* \stopStaff (stems shorter, but staff lines shown)
>>\new Staff \with {
>>  \remove "Bar_engraver"
>>  \remove "Clef_engraver"
>>  \remove "Time_signature_engraver"
>>  \magnifyStaff #(magstep -3)
>>} {
>>  \override Stem.details.beamed-lengths = #'(3)
>>  \relative { \time 6/8 \stemUp b'8 8 8 }
>>}
>>\layout { ragged-right=##t indent=0 }
>>  }
>> } }
> 
> \stopStaff is not the right tool for your purpose.
> Why not adding
> \override StaffSymbol.line-count = 0
> to the Staff's \with
> ?
> 
> Cheers,
>  Harm




Time signatures above score, aligning short instrument names

2022-11-08 Thread Nate Whetsell
Hi,

I have a few questions related to score preparation.

I’m putting time signatures above a score using—

https://music.stackexchange.com/questions/90732/display-time-signature-as-single-number-above-the-staff#answer-90737
 


—which is based on https://lsr.di.unimi.it/LSR/Item?id=272 
. I’ve noticed two issues with this. 
First, the above-score time signatures are usually centered over bar lines, but 
not when a measure is preceded by a clef change. In this case, time signatures 
seem to be placed before the new clef rather than centered over the following 
bar line. Second, when a new time signature occurs at the end of a page, it 
seems to be centered on the right margin. In the case of compound meters, this 
can cause the time signature to extend off the page. I’ve tried setting 
break-align-orders 
(https://lilypond.org/doc/v2.23/Documentation/internals/break_002dalignment_002dinterface
 
)
 and space-alist to fix this 
(https://lilypond.org/doc/v2.23/Documentation/internals/timesignature 
), but 
nothing seems to have an effect.

I’m also trying to set up a score more-or-less as shown on p. 509 of Elaine 
Gould’s Behind Bars, using—

https://lilypond.org/doc/v2.23/Documentation/snippets/text#text-aligning-and-centering-instrument-names
 


—as a starting point. If I set both short-indent and left-margin to 0.5 in., I 
can align short instrument names to the left margin using a \fill-line with a 
width of 6.75. My question is: is there a better way to do this? Hard-coding an 
arbitrary width of 6.75 (staff spaces?) seems less than ideal.

Here is a much-reduced example showing what I’m doing:

\version "2.23.80"

time-signatures = {
  \time 2/4
  s2 | \noBreak
  \time 3/4 % This time signature is not centered over the bar line.
  s2. | \noBreak
  \time 4/4
  s1 | \pageBreak
  \compoundMeter #'((1 1 3 4)) % This time signature extends too far into the 
right margin.
  s1*5/4 |
}

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

\paper {
  short-indent = 0.5\in
  left-margin = 0.5\in
}

\score {
  <<
\new Dynamics \with {
  \consists Time_signature_engraver
  \override TimeSignature.after-line-breaking = #shift-right-at-line-begin
  \override TimeSignature.break-align-symbol = ##f
  \override TimeSignature.font-size = #5
  \override TimeSignature.self-alignment-X = #CENTER
  \override TimeSignature.X-offset = 
#ly:self-alignment-interface::x-aligned-on-self
} {
  \time-signatures
}

\new Staff \with {
  instrumentName = "Instruments"
  shortInstrumentName = \markup {
\override #'(baseline-skip . 2.5)
\override #'(line-width . 6.75) % Is there a better way to determine 
the line width?
\fill-line {
  \lower #1.25 "Ins."
  \right-column { "1" "2" }
}
  }
} \relative {
  \clef "bass"
  c16 d e f g a b c |
  \clef "treble"
  c16 d e f g a b c d e f g |
  c,,16 d e f g a b c d e f g a b c d |
  c,,16 d e f g a b c d e f g a b c d e f g a |
}
  >>
}


Re: Time signatures above score, aligning short instrument names

2022-11-08 Thread Nate Whetsell
Thank you for this! I’m not sure how it works—it looks like a Scheme engraver 
that changes the x parent of some time signatures—but it sure does!

> On Nov 8, 2022, at 2:59 PM, Jean Abou Samra  wrote:
> 
> Le 08/11/2022 à 14:13, Nate Whetsell a écrit :
>> I’ve noticed two issues with this. First, the above-score time signatures 
>> are usually centered over bar lines, but not when a measure is preceded by a 
>> clef change. In this case, time signatures seem to be placed before the new 
>> clef rather than centered over the following bar line. Second, when a new 
>> time signature occurs at the end of a page, it seems to be centered on the 
>> right margin. In the case of compound meters, this can cause the time 
>> signature to extend off the page. I’ve tried setting break-align-orders 
>> (https://lilypond.org/doc/v2.23/Documentation/internals/break_002dalignment_002dinterface
>>  
>> <https://lilypond.org/doc/v2.23/Documentation/internals/break_002dalignment_002dinterface>)
>>  and space-alist to fix this 
>> (https://lilypond.org/doc/v2.23/Documentation/internals/timesignature 
>> <https://lilypond.org/doc/v2.23/Documentation/internals/timesignature>), but 
>> nothing seems to have an effect.
> 
> 
> 
> For this one, try:
> 
> 
> 
> \version "2.23.80"
> 
> time-signatures = {
>   \time 2/4
>   s2 | \noBreak
>   \time 3/4
>   s2. | \noBreak
>   \time 4/4
>   s1 |
>   \break
>   \pageBreak
>   \compoundMeter #'((1 1 3 4))
>   s1*5/4 |
> }
> 
> \layout {
>   \numericTimeSignature
>   \context {
> \Staff
> \override InstrumentName.self-alignment-X = #RIGHT
>   }
>   \context {
> \Score
> \consists
>   #(lambda (context)
>  (let ((time-sigs '())
>(break-alignment #f))
>(make-engraver
>  (acknowledgers
>   ((time-signature-interface engraver grob source-engraver)
>(when (not (ly:grob-property grob 'break-align-symbol #f))
>  (set! time-sigs (cons grob time-sigs
>   ((break-alignment-interface engraver grob source-engraver)
>(set! break-alignment grob)))
>  ((stop-translation-timestep engraver)
>   (when break-alignment
> (for-each
>  (lambda (sig)
>(ly:grob-set-parent! sig X break-alignment))
>  time-sigs))
>   (set! time-sigs '())
>   (set! break-alignment #f)
> \override TimeSignature.break-align-anchor =
>   #ly:break-aligned-interface::calc-extent-aligned-anchor
> \override TimeSignature.break-align-anchor-alignment = #CENTER
>   }
> }
> 
> \paper {
>   short-indent = 0.5\in
>   left-margin = 0.5\in
> }
> 
> \score {
>   <<
> \new Dynamics \with {
>   \consists Time_signature_engraver
>   \override TimeSignature.break-align-symbol = ##f
>   \override TimeSignature.font-size = #5
>   \override TimeSignature.self-alignment-X = #CENTER
>   \override TimeSignature.X-offset =
> #self-alignment-interface::self-aligned-on-breakable
>   \override TimeSignature.break-align-symbols =
> #'(staff-bar time-signature)
> } {
>   \time-signatures
> }
> 
> \new Staff \with {
>   instrumentName = "Instruments"
>   shortInstrumentName = \markup {
> \override #'(baseline-skip . 2.5)
> \fill-line
> {
>   \lower #1.25 "Ins."
>   \right-column { "1" "2" }
> }
>   }
> } \relative {
>   \clef "bass"
>   c16 d e f g a b c |
>   \clef "treble"
>   c16 d e f g a b c d e f g |
>   c,,16 d e f g a b c d e f g a b c d |
>   c,,16 d e f g a b c d e f g a b c d e f g a |
> }
>   >>
> }
> 
> 
> 
> Best,
> Jean



Custom engraver to modify bent grace notes

2023-01-07 Thread Nate Whetsell
Hi,

I have a question about using a custom engraver to modify how grace notes 
appear when LilyPond’s new string bending is applied to them. This is the first 
custom engraver I’ve attempted to write, so I think I’ve overlooked something 
rather basic. The repository for the engraver is at 
https://github.com/nwhetsell/lilypond-bending-additions, and the current 
engraver is at

https://github.com/nwhetsell/lilypond-bending-additions/blob/0bbfdaa9a76bef10c4b23cc97b1edede8fde2f2a/bending-additions.ily

Conceptually, I’m trying to do three things:

1. If a string bend starts on a grace note, don’t reduce the size of the fret 
number in a TabStaff.

2. If, in addition, the bent grace note is a pre-bend, put the notehead in 
parentheses, and don’t draw ledger lines, flags, or stems.

3. If a string bend ends on a grace note, don’t draw the notehead, ledger 
lines, accidentals, flags, or stems (don’t draw anything, basically).

Bearing in mind that there’s a lot about writing engravers that I don’t know, 
where I think I’m having difficulty is determining whether a note is a grace 
note. In short, I’m getting a notehead grob using an acknowledger and then 
checking the value of its ly:moment-grace 
<https://lilypond.org/doc/v2.24/Documentation/internals/scheme-functions#index-ly_003amoment_002dgrace>
 in the engraver’s stop-translation-timestep method. However, this doesn’t work 
directly. In stop-translation-timestep, the moment of a notehead created in 
that timestep appears to always be null. As workaround, I’m saving the notehead 
and then getting its moment in the next call to stop-translation-timestep, at 
which point the notehead’s moment is no longer null.

The issue here is that there are some properties that appear to only have an 
effect when they’re applied to a notehead in the same timestep in which it’s 
created. For example, setting no-ledgers to #t has no affect when applied to 
noteheads from a previous timestep.

There’s some simplified code that attempts to illustrate this below. Is there 
another way for a custom engraver to determine whether a note is a grace note?

Thanks in advance!
Nate

\version "2.24.0"

#(define (Grace_reporting_engraver context)
  (let (
  (current-note-head '())
  (previous-note-head '()))

(make-engraver
  (acknowledgers
((note-head-interface engraver grob source-engraver)
  (set! current-note-head grob)))

  ((stop-translation-timestep engraver)
(if (not (null? current-note-head))
  (let (
  (moment (grob::when current-note-head)))
(if (not (null? moment))
  (if (not (eq? (ly:moment-grace moment) 0))
(begin (newline)(display "==> current-note-head is for a grace 
note")))
  (begin (newline)(display "==> current-note-head has null 
moment")

(if (not (null? previous-note-head))
  (let (
  (moment (grob::when previous-note-head)))
(if (not (null? moment))
  (if (not (eq? (ly:moment-grace moment) 0))
(begin (newline)(display "==> previous-note-head is for a grace 
note")))
  (begin (newline)(display "==> previous-note-head has null 
moment")

(set! previous-note-head current-note-head)
(set! current-note-head '())

{
  \new Voice \with {
\consists #Grace_reporting_engraver
  } {
\grace c' \grace d' \grace e'
  }
}

#(define (Current_note_ledger_hider context)
  (let (
  (current-note-head '()))

(make-engraver
  (acknowledgers
((note-head-interface engraver grob source-engraver)
  (set! current-note-head grob)))

  ((stop-translation-timestep engraver)
(if (not (null? current-note-head))
  (ly:grob-set-property! current-note-head 'no-ledgers #t))

{
  \new Voice \with {
\consists #Current_note_ledger_hider
  } {
\grace c''' \grace c'''
  }
}

#(define (Previous_note_ledger_hider context)
  (let (
  (current-note-head '())
  (previous-note-head '()))

(make-engraver
  (acknowledgers
((note-head-interface engraver grob source-engraver)
  (set! current-note-head grob)))

  ((stop-translation-timestep engraver)
(if (not (null? previous-note-head))
  (ly:grob-set-property! previous-note-head 'no-ledgers #t))

(set! previous-note-head current-note-head)
(set! current-note-head '())

{
  \new Voice \with {
\consists #Previous_note_ledger_hider
  } {
\grace c''' \grace c'''
  }
}


Re: Custom engraver to modify bent grace notes

2023-01-08 Thread Nate Whetsell
Thank you!

> Wouldn't you be better off getting rid of graces, and creating a grob like 
> TrillPitchHead from your engraver?

Probably, but I’m also trying to make this engraver something a person can just 
add to a LilyPond file without having to change anything else. I think most of 
the time people will input these kinds of bends as grace notes, so no matter 
what I’ll have to detect those.

> you can get the moment of the current time step in the engravers using
> 
> (ly:context-current-moment context)


Thanks, this is a huge help.

Thank you also for putting together the Extending LilyPond 
<https://extending-lilypond.readthedocs.io/> website; that website is the only 
reason I got as far as I did writing an engraver.

> On Jan 7, 2023, at 1:04 PM, Jean Abou Samra  wrote:
> 
> Le 07/01/2023 à 18:41, Nate Whetsell a écrit :
>> Hi,
>> 
>> I have a question about using a custom engraver to modify how grace notes 
>> appear when LilyPond’s new string bending is applied to them. This is the 
>> first custom engraver I’ve attempted to write, so I think I’ve overlooked 
>> something rather basic. The repository for the engraver is at 
>> https://github.com/nwhetsell/lilypond-bending-additions, and the current 
>> engraver is at
>> 
>> https://github.com/nwhetsell/lilypond-bending-additions/blob/0bbfdaa9a76bef10c4b23cc97b1edede8fde2f2a/bending-additions.ily
>> 
>> Conceptually, I’m trying to do three things:
>> 
>> 1. If a string bend starts on a grace note, don’t reduce the size of the 
>> fret number in a TabStaff.
>> 
>> 2. If, in addition, the bent grace note is a pre-bend, put the notehead in 
>> parentheses, and don’t draw ledger lines, flags, or stems.
>> 
>> 3. If a string bend ends on a grace note, don’t draw the notehead, ledger 
>> lines, accidentals, flags, or stems (don’t draw anything, basically).
> 
> 
> I'm ignorant about guitar techniques, but is this note really a grace note? 
> Wouldn't you be better off getting rid of graces, and creating a grob like 
> TrillPitchHead from your engraver?
> 
> Assuming that grace notes are what you want in the first place ...
> 
>> Bearing in mind that there’s a lot about writing engravers that I don’t know,
> 
> 
> Maybe it will help to read 
> https://extending-lilypond.readthedocs.io/en/latest/translation.html#writing-an-engraver
>  
> <https://extending-lilypond.readthedocs.io/en/latest/translation.html#writing-an-engraver>
> 
> 
>> where I think I’m having difficulty is determining whether a note is a grace 
>> note. In short, I’m getting a notehead grob using an acknowledger and then 
>> checking the value of its ly:moment-grace 
>> <https://lilypond.org/doc/v2.24/Documentation/internals/scheme-functions#index-ly_003amoment_002dgrace
>>  
>> <https://lilypond.org/doc/v2.24/Documentation/internals/scheme-functions#index-ly_003amoment_002dgrace>>
>>  in the engraver’s stop-translation-timestep method. However, this doesn’t 
>> work directly. In stop-translation-timestep, the moment of a notehead 
>> created in that timestep appears to always be null.
> 
> 
> Yes, it's not set up yet. Basically, grob::when is meant to be used in the 
> backend (grob callbacks). During translation (in engravers), there is no 
> need. By definition, all note heads that arrive in the same time step are 
> grace notes iff that time step is a grace time step, and you can get the 
> moment of the current time step in the engravers using
> 
> (ly:context-current-moment context)
> 
> HTH



Custom engraver to draw frame around notes

2023-04-03 Thread Nate Whetsell
Hi,

I’m trying to use an engraver that was shared on the lilypond-user list in 2012:

https://mail.gnu.org/archive/html/lilypond-user/2012-03/msg00363.html 
<https://mail.gnu.org/archive/html/lilypond-user/2012-03/msg00363.html>

This engraver draws a frame around notes, followed by an arrow.

I’ve been able to update this engraver so that it can be used in more recent 
versions of LilyPond; this is available at

https://github.com/nwhetsell/lilypond-frame-engraver/blob/main/frame-engraver.ily
 
<https://github.com/nwhetsell/lilypond-frame-engraver/blob/main/frame-engraver.ily>

This engraver works when a score has a single staff, but compilation fails when 
a score has multiple staffs:

/usr/local/Cellar/lilypond-unstable/2.25.3/share/lilypond/2.25.3/ly/init.ly:64:2:
 error: Guile signaled an error for the expression beginning here
#
 (let ((book-handler (if (defined? 'default-toplevel-book-handler)
In procedure ly:grob-property: Wrong type argument in position 1 (expecting 
Grob): ()

I can compile successfully if I comment out what happens in lines 183–6—

https://github.com/nwhetsell/lilypond-frame-engraver/blob/310c2f0776c217fcc486e933badde6a56940f9c1/frame-engraver.ily#L183-L186
 
<https://github.com/nwhetsell/lilypond-frame-engraver/blob/310c2f0776c217fcc486e933badde6a56940f9c1/frame-engraver.ily#L183-L186>

—like this—

   ;(if (ly:stream-event? (cdr event-drul))
   ;(begin (set! stub (ly:engraver-make-grob trans 'FrameStub (cdr 
event-drul)))
   ;   (ly:grob-set-property! stub 'direction RIGHT)
   ;   (ly:grob-set-object! stub 'frame span)))
   ))

—but I can only get frames in one staff (and it must be the first staff).

Because this engraver doesn’t mention staffs at all, I’m not sure how this is 
happening or how to fix it, and I’m hoping I’m missing something simple. Any 
help would be greatly appreciated! A small test program follows.

Many thanks,
Nate

\version "2.22.0"

\include "frame-engraver.ily"

music = \relative c'' {
  \override Stem.transparent = ##t
  \override Beam.transparent = ##t
  \once \override Frame.extender-length = #8
  \frameStart dis'8[ e f \frameEnd ges] s2
}

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

\layout {
  \context {
\Global
\grobdescriptions #all-grob-descriptions
  }
  \context {
\Voice
\consists \frameEngraver
  }
}



Re: Custom engraver to draw frame around notes

2023-04-04 Thread Nate Whetsell
Thank you so much!

> On Apr 3, 2023, at 8:52 PM, Jean Abou Samra  wrote:
> 
> Le lundi 03 avril 2023 à 20:12 -0400, Nate Whetsell a écrit :
> 
>> Because this engraver doesn’t mention staffs at all, I’m not sure how this 
>> is happening or how to fix it, and I’m hoping I’m missing something simple. 
>> Any help would be greatly appreciated! A small test program follows.
>> 
> I see
> 
> #(lambda (context)
>(let ((span '())
>  (stub '())
>  (event-drul '(() . (
>  ^^^
> then
> 
>  `((listeners
>  (frame-event .
>,(lambda (engraver event)
>  (if (= START (ly:event-property event 'span-direction))
>  (set-car! event-drul event)
>  ^^
>  (set-cdr! event-drul event)
>  ^^
> This is Bad (™). Quoting is a more subtle concept than many people think. For 
> example, many beginner/intermediate and even advanced Scheme programmers do 
> not realize that
> 
> $ LC_ALL=C.UTF-8 ~/lilies/2.25.3/bin/lilypond scheme-sandbox
> GNU LilyPond 2.25.3 (running Guile 2.2)
> Processing 
> `/home/jean/lilies/2.25.3/share/lilypond/2.25.3/ly/scheme-sandbox.ly'
> Parsing...
> GNU Guile 2.2.7
> Copyright (C) 1995-2019 Free Software Foundation, Inc.
> 
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
> 
> Enter `,help' for help.
> scheme@(#{ g123}#)> (define (f) (list 'a 'b 'c))
> scheme@(#{ g123}#)> (eq? (f) (f))
> $1 = #f
> scheme@(#{ g123}#)> (define (f2) '(a b c))
> scheme@(#{ g123}#)> (eq? (f2) (f2))
> $2 = #t
> When you quote something, you always get the same thing, as per eq?, i.e., 
> identity. Therefore, the two engraver instances are sharing the same pair of 
> events, which is obviously troublesome.
> 
> By the way, you can debug Scheme code by adding #(ly:set-option 
> 'compile-scheme-code) (see this 
> <https://lilypond.org/doc/v2.25/Documentation/extending/debugging-scheme-code>;
>  caveat: does not work on Windows right now). If you do this, you will get a 
> Guile error about attempting to mutate a literal pair.
> 
> If you read section 3.4 of the R5RS 
> <https://conservatory.scheme.org/schemers/Documents/Standards/R5RS/r5rs.pdf>, 
> you can find
> 
> “In many systems it is desirable for constants (i.e. the val- ues of literal 
> expressions) to reside in read-only-memory. To express this, it is convenient 
> to imagine that every object that denotes locations is associated with a flag 
> telling whether that object is mutable or immutable. In such systems literal 
> constants and the strings returned by symbol->string are immutable objects, 
> while all objects created by the other procedures listed in this report are 
> mutable. It is an error to attempt to store a new value into a location that 
> is denoted by an immutable object.”
> 
> Note that “it is an error” means the program is invalid, not that the 
> implementation is required to detect the error. Guile does it for 
> byte-compiled code (when you use compile-scheme-code). It unfortunately 
> doesn't for interpreted code, as in the default mode in LilyPond.
> 
> The fix here is to change '(() . ()) to (cons '() '()) to create a fresh pair 
> for each engraver.
> 
> Jean
> 



Bow positions (sul pont, sul tasto) with transition arrows

2023-06-20 Thread Nate Whetsell
Hi,

I’m trying to figure out the “right” (most flexible, best looking) way to put 
bow positions like sul pont and sul tasto (really their abbreviations s.p. and 
s.t.) above a staff with transition arrows, like in Gould’s Behind Bars p. 407. 
Here are some things I’ve tried:

• Use a TextSpanner 
(https://lilypond.org/doc/Documentation/notation/line-spanners), as suggested 
at https://lists.gnu.org/archive/html/lilypond-user/2017-12/msg00347.html. This 
has the advantage of being relatively simple to use. Some disadvantages are 
that the text at the ends of the arrow tends to be misaligned (although this 
can be fixed with some hacks), and the line-breaking behavior can produce 
unreadable results.

• Define a new context, based on the Dynamics context, that uses 
DynamicTextSpanner and modified decrescendos. This tends to look better than 
the TextSpanner approach (in my opinion). One drawback is that it’s cumbersome 
to use; you have to create create a new context with an alignAboveContext 
setting and a bunch of spacer rests whenever you want bow positions. The amount 
of vertical space between bow positions and the staff is also difficult to 
control. When a staff contains low notes and high notes with bow positions, bow 
positions are placed above the highest notes, which generally leaves too much 
space beneath the bow positions of the low notes.

• I didn’t get very far on this, but I suspect that the “right” way to do this 
is with a Scheme engraver that behaves like a combination of Dynamic_engraver 
and Dynamic_align_engraver (which are both implemented in C++). One of the 
difficulties I’m having with attempting to do this is that there doesn’t seem 
to be an existing Scheme engraver that works this way. To illustrate, I believe 
I’d have to use ly:engraver-make-spanner in such an engraver, but according to 
a GitHub search, all examples of this function are from LilyPond’s tests:

https://github.com/search?q=%22ly%3Aengraver-make-spanner%22+language%3ALilyPond&type=code&l=LilyPond

A short test program illustrating the first two things follows. Any advice on 
creating bow positions would be greatly appreciated!

Thanks,
Nate

\version "2.25.5"

\score {
  \new Staff \relative {
<<
  {
\override TextSpanner.style = #'line
\override TextSpanner.bound-details.left.text = \markup {
  \italic "sul tasto"
  % \hspace #0.25
}
\override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER
\override TextSpanner.bound-details.right.arrow = ##t
\override TextSpanner.bound-details.right.stencil-align-dir-y = #CENTER
\override TextSpanner.bound-details.right.text = \markup {
  % \hspace #0.25
  \overlay {
\italic "norm."
% \transparent "l"
  }
}
s1\startTextSpan s s\stopTextSpan
  }

  { c'1~1~ \break 1 }
>>
  }
}

ordinario = #(make-dynamic-script (markup #:normal-text #:whiteout "ord."))
sulPont = #(make-dynamic-script (markup #:normal-text #:whiteout "s.p."))

bowing = {
  s1 \sulPont \tweak minimum-length #10 \>
  s \ordinario \tweak minimum-length #10 \>
  s \sulPont
}

\score {
  \new Staff="strings" \relative {
<<
  \new Bowing \with { alignAboveContext = "strings" } { \bowing }
  { c'1~1~1 }
>>
<<
  \new Bowing \with { alignAboveContext = "strings" } { \bowing }
  { e''1~1~1 }
>>
  }

  \layout {
\context {
  \Dynamics
  \name Bowing
  \alias Dynamics
  crescendoSpanner = #'text
  decrescendoText = \markup { }
  decrescendoSpanner = #'text
  \override DynamicTextSpanner.bound-details.right.arrow = ##t
  \override DynamicTextSpanner.style = #'line
  \override DynamicTextSpanner.whiteout = ##t
}
\inherit-acceptability Bowing Dynamics
  }
}


Re: Bow positions (sul pont, sul tasto) with transition arrows

2023-06-20 Thread Nate Whetsell
Thank you for this!

I forgot to mention one other limitation of using TextSpanner. As far as I 
know, adjacent TextSpanner objects can’t be aligned horizontally, so attempting 
something like this—

→ s.p. → ord.

—results in the “→ ord.” above the “→ s.p.”. I’ve included a test program 
showing this. Do you know of a workaround for this?

Thanks again!
Nate

\version "2.25.5"

\include "transitionSpanner.ily"

{
  \once \transitionSpanner "" "s.p."
  1\startTextSpan
  \once \transitionSpanner "" "ord."
  1\stopTextSpan \startTextSpan
  1\stopTextSpan
}

ordinario = #(make-dynamic-script (markup #:normal-text #:whiteout "ord."))
sulPont = #(make-dynamic-script (markup #:normal-text #:whiteout "s.p."))

\score {
  \new Staff="strings" {
<<
  \new Bowing \with { alignAboveContext = "strings" } {
s1 \tweak minimum-length #10 \>
s \sulPont \tweak minimum-length #10 \>
s \ordinario
  }
  { 1 1 1 }
>>
  }

  \layout {
\context {
  \Dynamics
  \name Bowing
  \alias Dynamics
  crescendoSpanner = #'text
  decrescendoText = \markup { }
  decrescendoSpanner = #'text
  \override DynamicTextSpanner.bound-details.right.arrow = ##t
  \override DynamicTextSpanner.style = #'line
  \override DynamicTextSpanner.whiteout = ##t
}
\inherit-acceptability Bowing Dynamics
  }
}


> On Jun 20, 2023, at 6:49 AM, Mark Knoop  wrote:
> 
> Hi Nate,
> 
> At 06:31 on 20 Jun 2023, Nate Whetsell wrote:
>> Hi,
> 
>> I’m trying to figure out the “right” (most flexible, best looking) way
>> to put bow positions like sul pont and sul tasto (really their
>> abbreviations s.p. and s.t.) above a staff with transition arrows,
>> like in Gould’s Behind Bars p. 407. Here are some things I’ve tried:
> 
>> • Use a TextSpanner
>> (https://lilypond.org/doc/Documentation/notation/line-spanners), as
>> suggested at
>> https://lists.gnu.org/archive/html/lilypond-user/2017-12/msg00347.html.
>> This has the advantage of being relatively simple to use. Some
>> disadvantages are that the text at the ends of the arrow tends to be
>> misaligned (although this can be fixed with some hacks), and the
>> line-breaking behavior can produce unreadable results.
> 
> I've generally come to the conclusion that TextSpanner is the most
> flexible solution for this. My custom function include file is attached
> - it contains some examples at the bottom (commented out by default). I
> think the text alignments are fixed. I'm not sure what problems you're
> having with line-breaking - perhaps the list can help with those?
> 
> Regards,
> 
> Mark
> 
> --
> Mark Knoop



Re: Bow positions (sul pont, sul tasto) with transition arrows

2023-06-20 Thread Nate Whetsell
> Can I ask why you don’t use the broken parameter(s) for that?


Didn’t know about those, thanks!

> On Jun 20, 2023, at 6:52 AM, Kieren MacMillan  
> wrote:
> 
> Hi Nate,
> 
>> I’m trying to figure out the “right” (most flexible, best looking) way to 
>> put bow positions like sul pont and sul tasto (really their abbreviations 
>> s.p. and s.t.) above a staff with transition arrows, like in Gould’s Behind 
>> Bars p. 407. Here are some things I’ve tried:
>> 
>> • Use a TextSpanner 
>> (https://lilypond.org/doc/Documentation/notation/line-spanners), as 
>> suggested at 
>> https://lists.gnu.org/archive/html/lilypond-user/2017-12/msg00347.html. This 
>> has the advantage of being relatively simple to use. Some disadvantages are 
>> that the text at the ends of the arrow tends to be misaligned (although this 
>> can be fixed with some hacks), and the line-breaking behavior can produce 
>> unreadable results.
> 
> Can I ask why you don’t use the broken parameter(s) for that? e.g.
> 
> \score {
>  \new Staff \relative {
><<
>  {
>\override TextSpanner.style = #'line
>\override TextSpanner.bound-details.left-broken.text = ##f
>\override TextSpanner.bound-details.left.text = \markup {
>  \italic "sul tasto"
>  % \hspace #0.25
>}
>\override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER
>\override TextSpanner.bound-details.right.arrow = ##t
>\override TextSpanner.bound-details.right-broken.arrow = ##f
>\override TextSpanner.bound-details.right.stencil-align-dir-y = #CENTER
>\override TextSpanner.bound-details.right-broken.text = ##f
>\override TextSpanner.bound-details.right.text = \markup \italic 
> "norm."
>s1\startTextSpan s s\stopTextSpan
>  }
> 
>  { c'1~1~ \break 1 }
>>> 
>  }
> }
> 
> Cheers,
> Kieren.
> __
> 
> My work day may look different than your work day. Please do not feel 
> obligated to read or respond to this email outside of your normal working 
> hours.
> 




Setting paper indents using Scheme code

2024-01-04 Thread Nate Whetsell
Hi,

I have a custom engraver 
(https://github.com/nwhetsell/lilypond-instrument-name-measuring-engraver) that 
helps align instrument names like what’s shown on p. 509 of Elaine Gould’s 
Behind Bars. In a nutshell, this engraver works by measuring the x extent of 
system start text stencils, remembering the largest widths, and then reporting 
those widths (using ly:message) so they can be used as indents in a paper block.

It would be better, though, if the engraver set paper indents directly using (I 
believe) ly:output-def-set-variable! 
<https://lilypond.org/doc/v2.25/Documentation/internals/scheme-functions#index-ly_003aoutput_002ddef_002dset_002dvariable_0021>.
 Unfortunately, this doesn’t seem to work. Running

(ly:output-def-set-variable! paper 'indent indent)

does not change the indent (paper is `(ly:parser-lookup '$defaultpaper)`).

Is it possible to set paper indents in an engraver using Scheme? Any help would 
be greatly appreciated! A small test program follows.

Many thanks,
Nate

\version "2.25.11"

\include 
"lilypond-instrument-name-measuring-engraver/instrument-name-measuring-engraver.ily"

\score {
  <<
\new Staff \with {
  instrumentName = "Name"
  shortInstrumentName = "Nm."
} {
  s1 \pageBreak s1
}

\new Staff \with {
  instrumentName = "Very very very long name"
  shortInstrumentName = "V.v.v.lng.nm."
} {
  s1*2
}
  >>

  \layout {
\context {
  \Score
  \consists #Instrument_name_measuring_engraver
}
  }
}

\paper {
  left-margin = 0.75\in
  top-margin = 0.5\in
  right-margin = 0.75\in
  bottom-margin = 0.5\in

  % Uncomment these lines to show the effect of the indents.
  % indent = 138.24456692913384\pt
  % short-indent = 73.03085039370077\pt
}