Easying slur fine-tuning engraving in Lilypond files through Inkscape
(PRELIMINARY NOTE: This is a feature request. I'm writing to this mailing list because it seems the tracker mailing list has been inactive since 2007. If I'm doing the wrong thing, please tell me how to proceed. Please forgive me if I'm causing any inconveniences and consider providing some guidance on to which wishlist should I address this request. Thank you very much.)
* * *
Hi everybody.
First of all, excuse my English. It is not my mother tongue. Please also bear in mind that I'm not an expert Inkscape user and the terms I'll be using to describe my request can be ambiguous or even wrong (I hope not, though. ;))
I've been using Lilypond music engraving software (lilypond.org) for a while and I've been experiencing the pain of having to manually adjust slurs (actually drawn as bezier curves) when I want to get publishing-quality scores. The most straightforward way to achieve this is using \shapeII function in one of the following forms:
\shapeII #'(()(polar 50 0.35)(polar 30 0.25)())
or
\shapeII #'(()(absolute-polar 50 0.35)(absolute-polar 30 0.25)())
(Cf. the document by the creator of the function: http://lilypond-stuff.1065243.n5.nabble.com/file/n5705621/shapeII-examples.p... , paragraph 4, "polar coordinates" info. Cf. also https://lists.gnu.org/archive/html/lilypond-user/2013-11/msg00823.html for more information.)
The point of my request is making Inkscape assist slur editing/fine-tuning in a double way: first, taking advantage of the direct graphical editing capabilities it offers, and secondly, providing the relevant information generated in such a form the Lilypond function can understand ---the more direct, the better. The intended workflow would be:
1) Lilypond compiles the text file and outputs a pdf file. 2) Inkscape imports the generated pdf. 3) Slurs are manually edited. 4) For each slur, mathematical/Lilypond-understandable info is shown/generated (possibly by tweaking some Inkscape extension in python?) so that 5a) it can be at least manually typed into the Lilypond file, thus saving endless, painful recompiling trial-and-error attempts to get the satisfactory slur.
Or, ideally,
5b) the gathered/computed info is formatted (by the extension?) and shown (directly on the svg file, on an auxiliary window?) so that it can be copied-pasted onto the lilypond file,
or, even better,
5c) piped to a script that modifies the original Lilypond text file by inserting the data properly. In this case, I don't know whether the fact that the requested feature can be written in python and that the Lilypond file can be manipulated using the Frescobaldi editor (frescobaldi.org), which is written in python and allows easy extension of its features through python snippets, could automate the process even more. :)
Back to the \shapeII function, the relevant stuff for the present discussion are (absolute-polar 50 0.35) and (absolute-polar 30 0.25) parentheses. Graphically speaking, this pair of parentheses contain the mathematical description of the handles used to control bezier curves drawing in Inkscape. The absolute-polar notation that shapeII understands fits *almost* directly to the data about the angles of the handle that Inkscape shows at the bottom of the main window when you're moving it (That means Inkscape somehow already provides this data, the problem is how to made it available for the requested feature). The only thing that should be tweaked when doing the math is modifying the value Inkscape gives for the *right* handle. For this value to be valid in the lilypond shapeII function it has to be subtracted to 180:
valid right handle angle value = 180 - Inkscape value
Secondly, the info at the bottom of the main window also tells us about the length of the moving handle. The second numerical value inside the parentheses is the ratio between the length of the handle and the distance between the distal nodes:
\shapeII #'(()(absolute-polar 50 A)(absolute-polar 30 B)())
where
A = left handle length / distal length B = right handle length / distal length
That means getting the info about the length of the handles (the same as with angles) *and* calculating the distance between two points, i.e., the first and last nodes of the bezier curve. I'm aware this can be manually done with the measuring tool Inkscape provides, but here an automatic calculation of the distance is needed.
As I said at the beginning, I'm not an expert at all, but I think that this request can be easily implemented by a python programmer (perhaps based on Inkscape-0.91/share/extensions/measure.py file?) and it would mean a *huge* improvement for the Lilypond user's community.
Thanks for your attention,
Joan.
participants (1)
-
Joan Sanz