lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(Pheraps) a not difficult way for modifying slurs with any SVG editor an


From: Paolo Pr
Subject: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications
Date: Wed, 11 Dec 2019 05:19:05 +0100

Perhaps I found an easy way to modify slurs with any svg editor, and automatically (or semi-automatically) correct the .ly file with the changes made.
The procedure is the following, and I need a little help for the programming parts in the Scheme language (I know it too badly to write the functions myself, but I can take care of the rest of the code, see the steps below)

1) For each slur, I visually generate the control points, using the excellent function written by Aaron:

https://lists.gnu.org/archive/html/lilypond-user/2019-11/msg00266.html

2) [Need help!] For each group of four control_points, I need to associate four IDs obtained with a global variable that is incremented with each new slur. For example, if I have two slurs in my score, the control points IDs will be:

slur_1_cp_1, slur_1_cp_2, slur_1_cp_3, slur_1_cp_4,

slur_2_cp_1, slur_2_cp_2, slur_2_cp_3, slur_2_cp_4

This ID must be set in the SVG object corresponding to each control point. Can anyone modify the previous lilybin snippet to get this result?
I know it is possible to do this, from what I read on this page:

http://lilypond.org/doc/v2.19/Documentation/notation/alternative-output-formats

3) I open with an editor (for example: Inkscape) the generated SVG file; next to each slur to be corrected, I draw the correct slur (bezier curve), and I associate to this slur (always with the editor) an ID equal to the ID of the respective control points, without the final substrting. For example, if the control points have id equal to "slur_1_cp_1 (/ 2/3/4)", I will assign to the slur drawn with the editor ID = "slur_1"

4) At this point (I can write a script in Python or some other programming language), I can parser the new svg file (with some xml library) and calculate for each slur created with Inkscape, identified with IDSLUR, the difference of coordinates (x, y) between its control points and control points with ID = IDSLUR_cp_1, IDSLUR_cp_2, IDSLUR_cp_3, IDSLUR_cp_4

5) Once these differences are obtained, I can apply this function (taken from http://lsr.di.unimi.it/LSR/Item?id=777  ) for each slur to modify:

\shapeSlur # '(x1 y1 x2 y2 x3 y3 x4 y4)

Where x1 y1 x2 y2 x3 y3 x4 y4 are precisely the differences between the control points coordinates, just calculated.

What do you think? Is it worth it? If someone can write the function of point 2) (it shouldn't be difficult, nor time-consuming), I can take care of point 4)

reply via email to

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