Hi Colin,

On Sun, Oct 30, 2011 at 9:50 PM, Colin Campbell <c...@shaw.ca> wrote:

>
> Further Googling gives 
> http://lsr.dsi.unimi.it/LSR/**Snippet?id=616<http://lsr.dsi.unimi.it/LSR/Snippet?id=616>
>
> which is closer in appearance, but I haven't the Scheme fu to modify the
> stringNumberSpanner function to incorporate the startTextSpan and number of
> notes. Ideally, one would wind up with something like a8\fSpan {"5" 4}
> which would extend a line for 4 of the note value of the starting note.
>

This seems to do the trick:

 \version "2.14.2"

stringNumberSpanner =
#(define-music-function (parser location StringNumber music)
   (string? ly:music?)
  #{
     \override Voice.TextSpanner #'style = #'solid
     \override Voice.TextSpanner #'font-size = #-5
     \override TextSpanner #'(bound-details left stencil-align-dir-y) =
#CENTER
     \override TextSpanner #'(bound-details left text) = \markup { \circle
\number $StringNumber }

     #(begin
        (let* ((elts (ly:music-property $music 'elements)))
          (set! (ly:music-property (car elts) 'elements)
            (cons (make-music 'TextSpanEvent 'span-direction -1)
                  (ly:music-property (car elts) 'elements)))
          (set! (ly:music-property (car (reverse elts)) 'elements)
            (cons (make-music 'TextSpanEvent 'span-direction 1)
                  (ly:music-property (car (reverse elts)) 'elements)))
          (ly:export (make-music 'SequentialMusic 'elements (list
$music)))))
  #})

\relative c {
 \clef "treble_8"
 \textSpannerDown
 \stringNumberSpanner "5" { a8 b c d e f }
 \stringNumberSpanner "4" { g a bes4 a g2 }
}

Happy practicing!

-David
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to