Thank you very much. -----Ursprüngliche Nachricht----- Von: Thomas Morley <[email protected]> Gesendet: Dienstag, 27. Oktober 2020 10:10 An: [email protected] Cc: lilypond-user <[email protected]> Betreff: Re: Problems with Barré
Am Di., 27. Okt. 2020 um 09:58 Uhr schrieb <[email protected]>: > > 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
