4 lsrtags = "chords, fretted-strings"
7 Here is how to print bar chords, or half-bar chords (just uncomment the
8 appropriate line for to select either one).
10 The syntax is @code{\\bbarre #'fret_number' @{ notes @} }
16 doctitle = "Bar chords notation for Guitar ( with Text Spanner)"
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20 %% %%%%%%% Cut here ----- Start 'bbarred.ly'
22 %% C with slash -------------------------------
23 cWithSlash = \markup {
24 \combine \roman C \translate #'(0.6 . -0.4) \draw-line #'(0 . 2.0)
26 %% Span -----------------------------------
27 %% Syntax: \bbarre #"text" { notes } - text = any number of box
28 bbarre= #(define-music-function (barre location str music) (string? ly:music?)
30 (let ((first-element #f)
33 (music-map (lambda (m)
34 (if (eqv? (ly:music-property m 'name) 'EventChord)
36 (if (not first-found?)
38 (set! first-found? #t)
39 (set! first-element m)))
40 (set! last-element m)))
45 (set! (ly:music-property first-element 'elements)
46 (cons (make-music 'TextSpanEvent 'span-direction -1)
47 (ly:music-property first-element 'elements)))
48 (set! (ly:music-property last-element 'elements)
49 (cons (make-music 'TextSpanEvent 'span-direction 1)
50 (ly:music-property last-element 'elements)))))
52 (make-music 'SequentialMusic
55 \once \override TextSpanner #'font-size = #-2
56 \once \override TextSpanner #'font-shape = #'upright
57 \once \override TextSpanner #'staff-padding = #3
58 \once \override TextSpanner #'style = #'line
59 \once \override TextSpanner #'to-barline = ##f
60 \once \override TextSpanner #'bound-details = #'((left (Y . 0) (padding . 0.25) (attach-dir . -2)) (right (Y . 0) (padding . 0.25) (attach-dir . 2)))
61 \once \override TextSpanner #'bound-details #'right #'text = \markup { \draw-line #'( 0 . -.5) }
62 \once \override TextSpanner #'bound-details #'left #'text = \markup { \cWithSlash #str }
63 %% uncomment this line for make full barred
64 % \once \override TextSpanner #'bound-details #'left #'text = \markup { "B" #str }
68 %% %%%%%%% Cut here ----- End 'bbarred.ly'
69 %% Copy and change the last line for full barred. Rename in 'fbarred.ly'
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 %% Syntaxe: \bbarre #"text" { notes } - text = any number of box
73 \relative c'{ \clef "G_8" \stemUp \bbarre #"III" { <f a'>16[ c' d c d8] } }