Tim McNamara wrote:
Rather than writing a separate ending, I'd like to just parenthesize
the last three chords over the final two bars so they would render:
F ( Ab7 Dbmaj7 C7 )
ChordName outputs via text-interface, so the easiest way should be
\once \override ChordNames.ChordName #'text = "("
But this has no effect. It probably acts too early,
i.e. before the Chord_name_engraver has written its result to #'text.
Trevor answered a similar question a year ago:
http://lists.gnu.org/archive/html/lilypond-user/2008-03/msg00275.html
His solution modified the stencil, letting it overwrite #'text
just before printing.
As "addBrackets" it wrapped only a single chord, but you could
derive a left_only and a right_only version easily enough.
But if you want the bracket standing alone, how about setting up
a superfluous chord at the right place, and overwritung that?
See the snippet below; overwriteCN could also do things like "N.C."
Cheers,
Robin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.12.1"
overwriteCN = #(define-music-function (parser location text) (string?)
#{\once \set ChordNames.chordChanges = ##f
\once \override ChordNames.ChordName #'stencil = #(lambda (grob)
(ly:grob-set-property! grob 'text (markup $text))
(ly:text-interface::print grob)
)
#})
harmoniesA = \transpose f f {\chordmode {
f2:maj7 d2:m7 |
g2:m7 c2:7.9- |
f2 aes2:7 |
des2:maj7 c2:7 |
}}
harmoniesB = \transpose f f {\chordmode {
f2:maj7 d2:m7 |
g2:m7 c2:7.9- |
f4 \overwriteCN "(" f4 aes2:7 |
des2:maj7 c4:7 \overwriteCN ")" c4:7 |
}}
melody = \transpose f f' { \key f \major \time 4/4
\times 2/3 {a4 g'4 f'4} a4. e'8 |
d'4 bes8[ d8] a4 a8[ f8] ~ |
f1 ~ |
f1 |
}
\score {<<
\new ChordNames { \set chordChanges = ##t \harmoniesA }
\new ChordNames { \set chordChanges = ##t \harmoniesB }
\new Staff { \melody }
}
\layout {
indent = 0
ragged-right = ##f
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user