lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parenthesizing chord names


From: Robin Bannister
Subject: Re: Parenthesizing chord names
Date: Mon, 2 Mar 2009 16:33:25 +0100

Robin Bannister wrote:
As "addBrackets" it wrapped only a single chord, but you could derive a left_only and a right_only version easily enough.

I wanted to see if I could make such a pair deliver something close to what the OP illustrated, and managed this using \put-adjacent. This itself requires a direction parameter (#LEFT / #RIGHT), so I ended up with a onesided version. See below.
Features:
- adjustable bracket separation - preserves chordname alignment - compatible with non-default chordNameFunction

Cheers,
Robin


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\version "2.12.1"

besideCN = #(define-music-function (parser location which-side added-text) (integer? string?) #{\once \override ChordNames.ChordName #'stencil = #(lambda (grob) (ly:grob-set-property! grob 'text (markup #:put-adjacent 0 $which-side ; #LEFT or #RIGHT (ly:grob-property grob 'text) $added-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- |
 f2 \besideCN #LEFT "(    " aes2:7 |
 des2:maj7 \besideCN #RIGHT "   )" c2: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] ~ |
 f2 ~ f2 ~ |
 f2 ~ f2 |
}

\score {<< \new ChordNames { \set chordChanges = ##t \harmoniesA }
 \new ChordNames { \set chordChanges = ##t \harmoniesB }
 \new Staff { \melody }
}

\layout { indent = 0 ragged-right = ##f
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%






reply via email to

[Prev in Thread] Current Thread [Next in Thread]