guirtare bien barre

Bonjour

J'ai re-copier une vieille partition quasi illisible de guitare,
et j'ai eu un mal fou pour avoir des barrés corrects.
alors pour qui qui en auraient besoin voici 2 trucs qui marchent avec les version 2.11.xx

%%-----------------------------------------------------------
\version "2.11.48"

%%1er version avec startTextSpan et stopTextSpan

barreA = #(define-music-function ( parser location bartext ) (string?)
#{
\once \override Staff.TextSpanner #'font-size = #-3
\once \override Staff.TextSpanner #'staff-padding = #4
\once \override Staff.TextSpanner #'style = #'line
\once \override Staff.TextSpanner #'bound-details = #'((left (Y . 0)
(padding . 0.25) (attach-dir . -2)) (right (Y . 0) (padding . 0.25)
(attach-dir . 2)))
\once \override Staff.TextSpanner #'bound-details #'right #'text =
\markup { \draw-line #'( 0 . -.5) }
\once \override Staff.TextSpanner #'bound-details #'left #'text =
\markup { $bartext }
#})

\relative {
  \voiceOne \barreA "½BV" c' \startTextSpan e a\stopTextSpan c
}

%%2e Version d'après la 2.8 de la liste gmane.comp.gnu.lilypond.general

barreB = #(define-music-function (barre location str music) (string?
ly:music?)
            (let ((spanned-music
                    (let ((first-element #f)
                          (last-element #f)
                          (first-found? #f))
                      (music-map (lambda (m)
                                   (if (eqv? (ly:music-property m 'name)
'EventChord)
                                       (begin
                                         (if (not first-found?)
                                             (begin
                                               (set! first-found? #t)
                                               (set! first-element m)))
                                         (set! last-element m)))
                                   m)
                                 music)
                      (if first-found?
                          (begin
                            (set! (ly:music-property first-element
'elements)
                                  (cons (make-music 'TextSpanEvent
'span-direction -1)
                                        (ly:music-property first-element
'elements)))
                            (set! (ly:music-property last-element 'elements)
                                  (cons (make-music 'TextSpanEvent
'span-direction 1)
                                        (ly:music-property last-element
'elements)))))
                      music)))
         (make-music 'SequentialMusic
                'origin location
                'elements (list #{
  \once \override TextSpanner #'font-size = #-3
  \once \override TextSpanner #'staff-padding = #3
  \once \override TextSpanner #'style = #'line
  \once \override TextSpanner #'to-barline = ##f
  \once \override TextSpanner #'bound-details =
  #'((left (Y . 0) (padding . 0.25) (attach-dir . -2))
  (right (Y . 0) (padding . 0.25) (attach-dir . 2)))
  \once \override TextSpanner #'bound-details #'left #'text =
  \markup { $str }
\once \override TextSpanner #'bound-details #'right #'text =
  \markup { \draw-line #'( 0 . -.5) }
                           #}
                            spanned-music))))

\relative c' {
  \barreB #"½BV" { \voiceOne c' e' a } c'
}
%%-----------------------------------------------------------------

Lilypondmicalement

SpanText.ly (2.96 KB)

···

--
Martial