> Le 28 nov. 2022 à 02:21, kbvw <k...@pm.me> a écrit :
> 
> 
> 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. 



For this use case, there are solutions that let you keep the usual \chordmode 
input, see 
https://myrealbook.vintherine.org/le-principe-de-la-moindre-alteration.html (if 
you don’t read French, just copy the code and try it).

Essentially, this is a chord naming function that naturalizes the root. Unlike 
the naturalization functions found in snippets, it doesn’t naturalize all the 
pitches, it lets the chord naming infrastructure do its job normally but only 
acts on how the root is formatted.



> 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.)


I’ll reply to this separately.

Beat,
Jean

Reply via email to