lilypond-user
[Top][All Lists]
Advanced

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

Re: (Pheraps) a not difficult way for modifying slurs with any SVG edito


From: Urs Liska
Subject: Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications
Date: Wed, 11 Dec 2019 21:13:34 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1

Hi Paolo,

Am 11.12.19 um 20:36 schrieb Paolo Pr:
Hi Urs,

I had another idea meanwhile, which is much easier and it's 100% _javascript_ (generated by Lilypond) inside the SVG file (then, only a common browser is required, no Inkscape, Frescobaldi etc.). I'm implementing it and I'll share the code with the community in the next days.


Please go ahead with whatever brings the ecosystem forward!

However, let me state that using Frescobaldi as a framework for that functionality was not a "generous offer" but rather a question. We would *very* much appreciate adding such graphic curve shaping in Frescobaldi. There you'd basically work in a browser too, with the added benefit of having Frescobaldi's knowledge of the LilyPond language to write the tweak back to the original file.

Just two comments on your original post:

1)
Do you really need the IDs of the curve's control points? wouldn't they somehow be available from the SVG curve object somehow?

2)
For the modification please use the \shape function that is built into LilyPond itself, not an LSR snippet. From the calculation perspective it's probably identical to what you suggested but the input syntax is different. Please have a look at http://lilypond.org/doc/v2.19/Documentation/notation/modifying-shapes.en.html#modifying-ties-and-slurs

Best
Urs



On Wed, Dec 11, 2019 at 6:42 PM Urs Liska <address@hidden> wrote:

Hi Gerard,

Am 11.12.19 um 14:46 schrieb Gerard McConnell:
I get the impression that most of the serious Lilypond users want to use only Lilypond for editing their scores. 


This is partly true.


I used Lilypond with Inkscape for years, for my purposes it was an ideal combination since I could create absolutely any graphic effect or edit on the scores; no extra programming required, just editing with Inkscape.  I think the reason that more people don't work that way is because they can publish more easily using Lilypond alone, extract parts, or make changes in the music any time. 


This is true but does not apply to Paolo's suggestion. The problem many LilyPond users see is that when you need to make tweaks afterwards you are essentially blocked from updating the content without having to redo all the post-processing.

Paolo's idea would integrate the results of the post-processing into the LilyPond input files and would therefore not suffer from this problem.

I'll have to find the time to continue with my initial comment about integrating this into Frescobaldi.

Urs



On Wed, Dec 11, 2019 at 4:19 AM Paolo Pr <address@hidden> wrote:
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]