lilypond-user
[Top][All Lists]
Advanced

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

Lead sheet capo chords in brackets


From: Colin Baguley
Subject: Lead sheet capo chords in brackets
Date: Mon, 23 Sep 2024 17:02:40 +0100

Hi,
When writing a simple song lead sheet i have the chord(name) above the normal melody line.
Some guitarists like to use a capo and so I place a transposed chord(name) below the main one.
To do this I used a function called "parenthesizeAllchords" which I freely admit I plagarized from somewhere and don't exactly understand how it works - but it did work at one time.
Each Capo chord had a bracket around it eg  (C)  (D7)  (Em) etc
However, I've not used it for a few years and tried recently and it no longer works ( or I've corrupted the code somewhere along the line)
Please could somebody cast an eye over this and see where I am going wrong?
Thank you in anticipation.
Colin Baguley
%=========================================================
\version "2.24.3"  %
% ----------------------------------------------------------
melody_notes =
\relative c'' { \key f \major    \time 4/4
g4. fis8 g a bes g a2 c4 r | d4. d8 c a bes a g1 }
%============================================================
basicchords = \chordmode
{ c1 f bes2 f4 g:min c1:7 }
%============================================================
%--parenthesize chords function ---- for Capochords ---------
parenthesizeAllchords =
#(define-music-function (myMusic) (ly:music?)
(music-map
   (lambda (ev)
     (if (or (memq 'note-event (ly:music-property ev 'types))
             (memq 'rest-event (ly:music-property ev 'types)))
        (set! (ly:music-property ev 'parenthesize) #t))    ev)
   myMusic) myMusic)
%============================================================
guitarchords = \chordmode {
  \override ChordName.font-size = #3
  \override Parentheses.font-size = #2
\override ChordName.style = #'american
\basicchords  }
capochords = \chordmode {
  \override ChordName.font-size = #-3
\override Parentheses.font-size = #2
\override ChordName.style = #'american
\parenthesizeAllchords
\basicchords
}
%============================================================
%      SCORE STRUCTURE
\score {   <<
%---------CHORD LINE-----------------------------------------
 \new ChordNames
 \guitarchords  
%-------CAPO LINE--- I want these in brackets ------------
\new ChordNames    
 \transpose f e { \capochords }
%---------MELODY LINE --------------------------------------
\new Staff  
\melody_notes  
>> }

reply via email to

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