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: Koen van Walstijn
Subject: Re: Adding text to chord names or note names
Date: Sun, 27 Nov 2022 23:41:47 -0000

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.

Cheers,
Koen


On Nov 26, 2022, at 10:38 PM, Robin Bannister <rcb@dabble.ch> wrote:


On 26.11.2022 00:06, Koen van Walstijn wrote:
Ideally, I would love to be able to do something like this:
>
> \new ChordNames {    \relative { c1^\markup { \super "6-9" } }}
>
> The text added to the note would get printed above the staff in a
> Staff context but gets ignored by the ChordNames context.



ChordNames ignores BarLines too.
But you probably didn't realize the implications of the snippet
'Adding bar lines to ChordNames context' at
https://lilypond.org/doc/v2.22/Documentation/notation/displaying-chords#customizing-chord-names
It uses \consists to add the appropriate engraver.


You can do that for your case too, like this:

\new ChordNames \with { \consists Text_engraver }
\relative { c1^\markup { \super "6-9" } }
}

And then read
https://lilypond.org/doc/v2.22/Documentation/notation/modifying-context-plug_002dins
and maybe
https://lsr.di.unimi.it/LSR/Item?id=280


Cheers,
Robin


reply via email to

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