[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Extending Slur engraver
From: |
Jean Abou Samra |
Subject: |
Re: Extending Slur engraver |
Date: |
Wed, 8 Jun 2022 22:06:16 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
Le 08/06/2022 à 21:55, Kyle Baldwin a écrit :
Hello –
I’m looking at creating a new slur to be used as a “bowing-slur.”
Essentially it would be a styled slur that can co-exist with the slur
and phrasing slur grobs.
Looking in the source code for the phrasing slur engraver, it looks
like it just passes the information to the slur engraver
https://gitlab.com/lilypond/lilypond/-/blob/master/lily/slur-engraver.cc
I’m looking through the external documentation and found the “creating
an engraver” in scheme, but have had no luck doing the same kind of
extending that happens in the phrasing slur (as I’m not sure of the
c++ <-> scheme equivalence).
https://extending-lilypond.readthedocs.io/en/latest/translation.html#writing-an-engraver
Heh, nice for me to see that this is being useful.
How could I recreate my new “Bowing_slur_engraver” to just pass to the
slur engraver? (I assume I can…)
No, you can't. The advantage with C++ code is that it
is fast. The disadvantage is that it is compiled statically
to machine code, so you can't extend it dynamically (in
your .ly file, without recompiling LilyPond yourself) in
Scheme unless it provides specific facilities to do so.
The code in question uses class inheritance, which does
not work the same way in Scheme, and it has no Scheme
interfaces to the individual class methods anyway.
Luckily, slurs already support this kind of thing. You can
use the \= command to give the slur an ID that can then
be reused to close it. This is a very simple solution
to your problem without even touching Scheme. See below
for an example. Documentation is here:
https://lilypond.org/doc/v2.22/Documentation/notation/expressive-marks-as-curves#slurs
How do I style the slur before passing it to the slur engraver? I
would assume the (tweaks (..)) function in scheme, but just want to
make sure.
Use \tweak. In Scheme that would be (tweak ...).
All in all:
\version "2.22.2"
startBow = \tweak color red \=bow (
endBow = \=bow )
{ c'4\startBow 4\( 4( 4) 4( 4\endBow 4) 4\) }
Best,
Jean