Hi all,
Im using <http://lsr.di.unimi.it/LSR/Item?id=632> this barré-function from
the LSR and Im trying to make it work when the first note (or the last one)
is a rest.
Heres the code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.20.0"
guitbarre =
#(define-music-function (barre location str music) (string? ly:music?)
(let ((elts (extract-named-music music '(NoteEvent EventChord))))
(if (pair? elts)
(let ((first-element (first elts))
(last-element (last elts)))
(set! (ly:music-property first-element 'articulations)
(cons (make-music 'TextSpanEvent 'span-direction -1)
(ly:music-property first-element 'articulations)))
(set! (ly:music-property last-element 'articulations)
(cons (make-music 'TextSpanEvent 'span-direction 1)
(ly:music-property last-element
'articulations))))))
#{
\once \override TextSpanner.font-shape = #'upright
\once \override TextSpanner.staff-padding = #3
\once \override TextSpanner.style = #'line
\once \override TextSpanner.to-barline = ##f
\once \override TextSpanner.bound-details =
#`((left
(text . ,#{ \markup { \raise #-.5 \concat { \bold { #str
" " }}} #})
(Y . 0)
(padding . .25)
(attach-dir . -2))
(right
(text . ,#{ \markup { \draw-line #'( 0 . -1) } #})
(Y . 0)
(padding . 0.25)
(attach-dir . 2)))
$music
#})
\relative c' {
%1 <-- This one works
\guitbarre #"VI" { g4 g4 g4 g4 }
%2 <-- This one does not
<<
\new Voice \guitbarre #"I" {\voiceOne r4 <f' a c>4 4 4}
\new Voice {\voiceTwo f,1}
>>
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
What do I have to change or is there some other trick to make it work?
Thanks In Advance