%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %%%%%%% Cut here ----- Start 'bbarred.ly' %% C with slash ------------------------------- cWithSlash = \markup { \combine \roman C \translate #'(0.65 . -0.25) \draw-line #'(0 . 1.8) } %% Span ----------------------------------- %% Syntax: \bbarre #"text" { notes } - text = any fret number bbarre= #(define-music-function (barre location str music) (string? ly:music?) (let ((elts (extract-named-music music '(NoteEvent EventChord RestEvent MultiMeasureRestMusic SkipEvent)))) (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-size = #-2 \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 \concat { \cWithSlash \hspace #.2 $str \hspace #.3 } #}) (Y . 0) (padding . 0.25) (attach-dir . -2)) (right (text . ,#{ \markup { \draw-line #'(0 . -.5) } #}) (Y . 0) (padding . 0.25) (attach-dir . 2))) \once \override TextSpanner.bound-details.left-broken.attach-dir = #-1 %%%%%% comment or delete those two lines for showing left-broken barred fret number : \once \override TextSpanner.bound-details.left-broken.text = ##f \once \override TextSpanner.bound-details.right-broken.text = ##f %% uncomment this line for make full barred %\once \override TextSpanner.bound-details.left.text = \markup \concat { \roman B \hspace#.2 $str \hspace #.3 } $music #}) %% %%%%%%% Cut here ----- End 'bbarred.ly' %% Copy and change the last line for full barred. Rename in 'fbarred.ly' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% this comment will be deleted : \markup\italic "Here's a half barré example that could replace the one in the doc :" { \clef "G_8" \key d\minor << { \stemUp \bbarre #"III" { a'16[ bes d' bes f'8] } } \\ { \stemDown d2 } >> } %% Not part of the snippet %% those are just here to illustrate \markup\italic "Here are some other examples (won't be in the snippet) :" { \clef "G_8" \stemUp \bbarre #"III" { \compressFullBarRests R1*5 R } } { \clef "G_8" \stemUp \bbarre #"III" { R1*5 R } } { \clef "G_8" \stemUp \bbarre #"III" { r1*5 r } } { \clef "G_8" \stemUp \bbarre #"III" { s1*5 \break s } }