lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with Barré


From: sir.teddy.the.first
Subject: Problems with Barré
Date: Tue, 27 Oct 2020 09:58:43 +0100

Hi all,

I’m using this barré-function from the LSR and I’m trying to make it work when the first note (or the last one) is a rest.

 

Here’s 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

Attachment: Barre.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]