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 <li...@openlilylib.org> 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 <paolopr...@gmail.com> 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) >> >