5

This question deals with barre chord notation for guitar using the TextSpanner command in Lilypond. This approach is also described in the Lilypond documentation. However, this approach only works if the barre is held for more than one note value:

enter image description here

(picture from the Lilypond documentation)

It does not work if you only need to barre for a single note value, such as indicated (via a different convention) here:

enter image description here

Using the TextSpanner method for a single note value results in "warning: unterminated text spanner", and the barre command is ignored, so no barre indication is displayed.

I would like to indicate a barre over a single note value just like in the first example above, with a short horizontal line. Is there a way to modify the method used in the above quoted answer in such a way that this is possible? If not, how could one generate a barre indication for a single note value such as given in the second example above (or in any other reasonably looking way)?

2 Answers 2

6

Two possibilities: You may either use << >> or \after to shift the end of the spanner a bit further, or you could use a different kind of grob for this. You are using a spanner, which is supposed to span between notes. Logically a spanner cannot span a space between a note and itself. The other option would be a bracket, that is supposed to encompass notes. A classic example would be an ottava bracket. Here’s for example something I’ve used before:

\version "2.22"

smaI = \markup {\hspace #-0.7 \raise #0.8 \fontsize #-2.3 a }
smaII = \markup { \with-dimensions #'(0 . 0) #'(0 . 0) \larger \raise #0.8 \fontsize #-2.3 a }

casym = \markup \upright { \concat {  C. \smaI }}

ca =
#(define-music-function (n mus) (number? ly:music?)
   #{
     \set Staff.ottavation = \markup \normal-text \upright \column { \line { \casym \concat { #(number->string n) #(if (< n 8) smaII (markup)) } } \line { \vspace #0.6 } }
     \once\override Staff.OttavaBracket.dash-fraction = #0.43
     \once\override Staff.OttavaBracket.dash-period = #0.75
     \once\override Staff.OttavaBracket.thickness = #1.6
     #mus
     \unset Staff.ottavation
   #})

\relative c' {
  \clef "treble_8"
  \key g \major
  \time 4/4
  \ca 3 { g4 g g g } \ca 4 { g g g g }  \ca 1 g g g g
}

Note that this type of OttavaBracket and TextSpanner appear to be similar, but have very different capabilities. At some point this is supposed to be streamlined, but well, time and motivation ...

The third option would be to define your own barré grob, as well as an engraver to create these.

0
5

I ended up using the method suggested in Lazy's answer, namely using an ottava bracket, and I combined it with a few elements from this code snippet in the Lilypond documentation. In this way I can use roman numerals (or any other text) for the barre position. Furthermore, there are two commands now, one for a full barre (fbarre), and another one for a half barre (hbarre). It looks like this:

\version "2.22"

\include "barre.ly"

\relative c' {
  \clef "treble_8"
  \key c \major
  \time 4/4
  \hbarre #"V" { <c e c'>4 <c e b'>4 <c e a>2 } \fbarre #"I" <f,, c'' f>1
}

enter image description here

And this is the included file barre.ly:

cWithSlash = \markup {
  \combine \roman C \translate #'(0.65 . -0.2) \draw-line #'(0 . 1.7)
}

%% Syntax: \hbarre #"text" { notes }
hbarre =
#(define-music-function (barre location str mus) (string? ly:music?)
   #{
     \set Staff.ottavation = \markup \normal-text \upright \column { \fontsize #-2 \line { \concat { \cWithSlash #str  } } \line { \vspace #0.6 } }
     \once\override Staff.OttavaBracket.dash-fraction = #1.0
     \once\override Staff.OttavaBracket.thickness = #1.6
     #mus
     \unset Staff.ottavation
   #})

%% Syntax: \fbarre #"text" { notes }
fbarre =
#(define-music-function (barre location str mus) (string? ly:music?)
   #{
     \set Staff.ottavation = \markup \normal-text \upright \column { \fontsize #-2 \line { \concat { C #str  } } \line { \vspace #0.6 } }
     \once\override Staff.OttavaBracket.dash-fraction = #1.0
     \once\override Staff.OttavaBracket.thickness = #1.6
     \once\override Staff.OttavaBracket.minimum-length = #1.0
     #mus
     \unset Staff.ottavation
   #})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.