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: Stefano Troncaro
Subject: Re: (Pheraps) a not difficult way for modifying slurs with any SVG editor and feed Lilypond with modifications
Date: Wed, 11 Dec 2019 18:21:37 -0300

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 (<address@hidden>) escribió:


On Wed, Dec 11, 2019 at 9:13 PM Urs Liska <address@hidden> 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 via email to

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