lilypond-user
[Top][All Lists]
Advanced

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

AW: Problems with Barré


From: sir.teddy.the.first
Subject: AW: Problems with Barré
Date: Tue, 27 Oct 2020 10:16:18 +0100

Thank you very much.

-----Ursprüngliche Nachricht-----
Von: Thomas Morley <thomasmorley65@gmail.com> 
Gesendet: Dienstag, 27. Oktober 2020 10:10
An: sir.teddy.the.first@gmail.com
Cc: lilypond-user <lilypond-user@gnu.org>
Betreff: Re: Problems with Barré

Am Di., 27. Okt. 2020 um 09:58 Uhr schrieb <sir.teddy.the.first@gmail.com>:
>
> 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

Change:
   (let ((elts (extract-named-music music '(NoteEvent EventChord)))) to
  (let ((elts (extract-named-music music '(RestEvent NoteEvent EventChord))))

Cheers,
  Harm




reply via email to

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