lilypond-user
[Top][All Lists]
Advanced

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

Re: Adding text to chord names or note names


From: kbvw
Subject: Re: Adding text to chord names or note names
Date: Mon, 28 Nov 2022 01:20:54 +0000

Hi Jean, 

I just finished my reply when I saw your next message. :)

Sorry, I was starting to forget about the "transposing" bit.

Well, how about

\version "2.22.2"

t =
#(define-music-function (text) (markup?)
   #{
     \once \set chordNameFunction =
       #(lambda (sorted-pitches bass inversion context)
          (let* ((root (first sorted-pitches))
                 (root-namer
                  (ly:context-property context 'chordRootNamer))
                 (root-markup (root-namer root #f))
                 (bass-markup
                  (if (ly:pitch? bass)
                      #{ \markup { / #(root-namer bass #f) } #}
                      "")))
            #{ \markup { #root-markup \super #text #bass-markup } #}))
   #})

bass = \withMusicProperty bass ##t \etc

myChordNames =
\relative {
  \t "6-9" c1
  \t "6-9" << c \bass g >>
}

<<
  \new ChordNames \myChordNames
  \new ChordNames \transpose c d \myChordNames
>>

Yeah, judging from some quick tests, that seems to do what I want. Thanks a lot! This is very useful.

I still think it could be nice to try to write a longer-term solution. I saw it was you who wrote that newer Current_chord_text_engraver, with the goal of making a chord name grid. Do you think there would be any interest in specifying the chord suffixes like that, directly from markup? I'd be happy to contribute to some other kind of chord engraver or chord name function that behaves like that, if anyone else thinks it's useful. (I imagine jazz musicians might?)

To clarify again: the immediate reason was that if I transpose all of the pitches in a chord and then naturalize double accidentals, it messes up the intervals and the symbol changes.

The longer-term reason is that to me, at least in the specific use case of printing a harmonic background, the layer of calculating chords from internal pitches is redundant anyway. There are many ways to think about a chord, and I change the way I think about them all the time: I just want to write it down and I don't need LilyPond to reason about it. :) (Although a root and a bass note are still useful.)

Cheers,
Koen

reply via email to

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