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

Reply via email to