On 11-10-31 08:33 PM, David Nalesnik wrote:
Hi Colin,

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

    Further Googling gives 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


Brilliant, David, simply brilliant! No wonder I rave about this group every chance I get.

Thanks!

Colin

--
I've learned that you shouldn't go through life with a catcher's mitt on both 
hands.
You need to be able to throw something back.
-Maya Angelou, poet (1928- )

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

Reply via email to