I just created a javascript script to change the slurs of the .svg file
produced by Lilypond using the mouse, as I had announced. The coordinates
of the control points of the associated Bezier curve can be reported in the
corresponding .ly file and this completely avoids the time consuming trial
and error process we were talking about. The script is 100% Javascript
native, without any additional library and I tried it on the Firefox and
Chromium browsers. Let's see how it works.

1) Create a score using the template that shows the control points,
implemented by Aaron (please, re-indent it); I added a small change to set
some attributes on the generated svg tags:

http://lilybin.com/29lnbd/4

2) Generate with Lilypond the .svg file and add to it the Javascript script
implemented by me. To test everything, let's use JsFiddle:

https://jsfiddle.net/61pb9Le4/

My script is in the lower left pane; in the upper left pane I pasted the
.svg file generated by Lilypond. Note that, to make the script work, if you
create a new JsFiddle, you need to select  "LOAD TYPE" option =  "No wrap -
bottom of <body>".

3) Modify the slurs by moving the control points with the mouse

4) The coordinates of the modified slur can be displayed by right-clicking
on one of the slur's control points. A string will appear in the form:

 "shape # '((x1. y1) (x2. y2) (x1. y1) (x3. y3) (x4. y4)) PhrasingSlur"

or

 "shape # '((x1. y1) (x2. y2) (x1. y1) (x3. y3) (x4. y4)) Slur"

or

"shape # '((x1. y1) (x2. y2) (x1. y1) (x3. y3) (x4. y4)) Tie"

This string must be copied to the .ly file, near the slur to be modified.

.....................

I wrote all this really in a hurry, and the code needs to be improved at
various points. But the first tests seem to work. Now I'm trying to figure
out what is the best (and portable) way to automatically include the
Javascript script in the .svg file generated by Lilypond ...

HTH
P

Reply via email to