Le 07/01/2023 à 18:41, Nate Whetsell a écrit :
Hi,

I have a question about using a custom engraver to modify how grace notes appear when LilyPond’s new string bending is applied to them. This is the first custom engraver I’ve attempted to write, so I think I’ve overlooked something rather basic. The repository for the engraver is at https://github.com/nwhetsell/lilypond-bending-additions, and the current engraver is at

https://github.com/nwhetsell/lilypond-bending-additions/blob/0bbfdaa9a76bef10c4b23cc97b1edede8fde2f2a/bending-additions.ily

Conceptually, I’m trying to do three things:

1. If a string bend starts on a grace note, don’t reduce the size of the fret number in a TabStaff.

2. If, in addition, the bent grace note is a pre-bend, put the notehead in parentheses, and don’t draw ledger lines, flags, or stems.

3. If a string bend ends on a grace note, don’t draw the notehead, ledger lines, accidentals, flags, or stems (don’t draw anything, basically).


I'm ignorant about guitar techniques, but is this note really a grace note? Wouldn't you be better off getting rid of graces, and creating a grob like TrillPitchHead from your engraver?

Assuming that grace notes are what you want in the first place ...

Bearing in mind that there’s a lot about writing engravers that I don’t know,


Maybe it will help to read https://extending-lilypond.readthedocs.io/en/latest/translation.html#writing-an-engraver


where I think I’m having difficulty is determining whether a note is a grace note. In short, I’m getting a notehead grob using an acknowledger and then checking the value of its ly:moment-grace <https://lilypond.org/doc/v2.24/Documentation/internals/scheme-functions#index-ly_003amoment_002dgrace> in the engraver’s stop-translation-timestep method. However, this doesn’t work directly. In stop-translation-timestep, the moment of a notehead created in that timestep appears to always be null.


Yes, it's not set up yet. Basically, grob::when is meant to be used in the backend (grob callbacks). During translation (in engravers), there is no need. By definition, all note heads that arrive in the same time step are grace notes iff that time step is a grace time step, and you can get the moment of the current time step in the engravers using

(ly:context-current-moment context)

HTH

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to