(Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

(Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

Paolo Prete-3
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 | Threaded
Open this post in threaded view
|

Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

Gerard McConnell-2
I get the impression that most of the serious Lilypond users want to use only Lilypond for editing their scores.   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.  

On Wed, Dec 11, 2019 at 4:19 AM Paolo Pr <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

Paolo Prete-3
Of course, but the trial-and-error method for placing the slurs is really time consuming. Maybe the only one that needs a help with a GUI editor. The method I described is not difficult, really. I think it requires few additional lines of code to an already implemented function ( \showControlPoints ). Parsing a SVG file by ID is easy as well. Then I'm curious to see the result...

On Wed, Dec 11, 2019 at 2:46 PM Gerard McConnell <[hidden email]> wrote:
I get the impression that most of the serious Lilypond users want to use only Lilypond for editing their scores.   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.  

On Wed, Dec 11, 2019 at 4:19 AM Paolo Pr <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

Urs Liska-3
I'm at work right now, but that looks like something we could work on within Frescobaldi. In fact we had already made some attempts in that durection.

Urs


Am 11. Dezember 2019 15:11:18 MEZ schrieb Paolo Pr <[hidden email]>:
Of course, but the trial-and-error method for placing the slurs is really time consuming. Maybe the only one that needs a help with a GUI editor. The method I described is not difficult, really. I think it requires few additional lines of code to an already implemented function ( \showControlPoints ). Parsing a SVG file by ID is easy as well. Then I'm curious to see the result...

On Wed, Dec 11, 2019 at 2:46 PM Gerard McConnell <[hidden email]> wrote:
I get the impression that most of the serious Lilypond users want to use only Lilypond for editing their scores.   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.  

On Wed, Dec 11, 2019 at 4:19 AM Paolo Pr <[hidden email]> 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)

--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
Reply | Threaded
Open this post in threaded view
|

Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

Urs Liska-3
In reply to this post by Gerard McConnell-2

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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

Paolo Prete-3
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.

On Wed, Dec 11, 2019 at 6:42 PM Urs Liska <[hidden email]> 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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

Urs Liska-3

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 <[hidden email]> 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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

Paolo Prete-3


On Wed, Dec 11, 2019 at 9:13 PM Urs Liska <[hidden email]> wrote:

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.


This is true, but given that the code is 100% Javascript I don't want to couple it to Frescobaldi  *for now*. When the code wil be completed (and working), we'll see how to integrate it in that editor.
 

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?


No. In fact I realized that it's not necessary anymore. I'm currently using the "class" attribute, set by Lilypond on the svg element, and I set it to the same value for all the slurs I want to modify.

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


Thanks. This makes the template shorter to write/test

Best,

Reply | Threaded
Open this post in threaded view
|

Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

Urs Liska-3


Am 11.12.19 um 21:31 schrieb Paolo Pr:


On Wed, Dec 11, 2019 at 9:13 PM Urs Liska <[hidden email]> wrote:

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.


This is true, but given that the code is 100% Javascript I don't want to couple it to Frescobaldi  *for now*. When the code wil be completed (and working), we'll see how to integrate it in that editor.


Fair point. Of course I didn't intend to discourage you in any way.


 

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?


No. In fact I realized that it's not necessary anymore. I'm currently using the "class" attribute, set by Lilypond on the svg element, and I set it to the same value for all the slurs I want to modify.

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


Thanks. This makes the template shorter to write/test


and especially it makes the resulting code work with regular LilyPond. Requiring external code like an LSR snippet would not be a good idea.

Best
Urs



Best,

Reply | Threaded
Open this post in threaded view
|

Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications

Stefano Troncaro
In reply to this post by Paolo Prete-3
Hi everyone

No. In fact I realized that it's not necessary anymore. I'm currently using the "class" attribute, set by Lilypond on the svg element, and I set it to the same value for all the slurs I want to modify.

Paolo, I see you wrote this while I was drafting a snippet. Here it is in case you find it useful somehow:

\version "2.19.83"
\language "english"
\score {
  <<
    \new Staff \relative { c''4( d) e( f) }
    \new PianoStaff <<
      \new Staff \relative { <g' e>2( <c g>) }
      \new Staff \relative { \clef F c'2( c,) }
    >>
  >>
  \layout {
    \context {
      \Score
      \override Slur.after-line-breaking =
      #(lambda (grob)
         (let* ((cps (ly:grob-property grob 'control-points))
                (id "slur_1")) ;need to find how to enumerate slurs
           (ly:grob-set-nested-property! grob '(output-attributes id) id)
           (for-each
            (lambda (cp num)
              (let* ((prefix (string-append "data-cp_" (number->string num)))
                     (pfx (string->symbol (string-append prefix "_x")))
                     (pfy (string->symbol (string-append prefix "_y"))))
                (ly:grob-set-nested-property! grob `(output-attributes ,pfx) (car cp))
                (ly:grob-set-nested-property! grob `(output-attributes ,pfy) (cdr cp))
              ))
            cps
            '(1 2 3 4))))
    }
  }
}

It's not the most elegant but it saves the metadata in the svg file. I couldn't figure out quickly how to enumerate the slurs but I know it can be done, I just have to research a bit.

Let me know if I can be of use, shaping slurs is currently the most tedious aspect of Lilypond for me, and the feature you are working on would be a great help, so I would love to help in any way I can! Integrating it in Frescobaldi would be even better.

El mié., 11 dic. 2019 a las 17:33, Paolo Pr (<[hidden email]>) escribió:


On Wed, Dec 11, 2019 at 9:13 PM Urs Liska <[hidden email]> wrote:

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.


This is true, but given that the code is 100% Javascript I don't want to couple it to Frescobaldi  *for now*. When the code wil be completed (and working), we'll see how to integrate it in that editor.
 

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?


No. In fact I realized that it's not necessary anymore. I'm currently using the "class" attribute, set by Lilypond on the svg element, and I set it to the same value for all the slurs I want to modify.

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


Thanks. This makes the template shorter to write/test

Best,