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: Jean Abou Samra
Subject: Re: Adding text to chord names or note names
Date: Mon, 28 Nov 2022 01:01:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0

Le 28/11/2022 à 00:41, Koen van Walstijn a écrit :
Hi Robin,

Thanks a lot! I read over that bar lines snippet indeed.

Adding the text engraver and tweaking it a bit, I managed to print the markup above the chord symbol, so that definitely helped me along and it will do for the moment.

After reading the documentation and Scheme source a bit more, I think the cleanest solution would be to define a custom context with a custom engraver, where it takes the markup from a text script event and passes it to the suffix of the chord, using the code that is already there to put it after the chord symbol and before the optional bass note.

I discovered that with the latest development version, this should actually not be that hard: the Chord_name_engraver previously written in C++ has been replaced by Chord_name_engraver and Current_chord_text_engraver written in Scheme, with the latter handling the logic of producing the chord symbol. Basically I'd need to cut away all the logic for determining the chord, and tell it to listen to text script events.

I'll let you know how it goes; would be happy to contribute the result if it succeeds.



You can always cut away all the logic with

\version "2.22.2"

myChordNames = {
  \once \override ChordName.text = \markup { C \super "6-9" }
  <c e g a d'>1
}

<<
  \new ChordNames \myChordNames
  \new Staff \myChordNames
>>


If you need this often, you can shorten it:


\version "2.22.2"

t = \once \override ChordName.text = \etc

myChordNames = {
  \t \markup { C \super "6-9" }
  <c e g a d'>1
}

<<
  \new ChordNames \myChordNames
  \new Staff \myChordNames
>>


Does that suffice for your use case?

Best,
Jean

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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