Re: A Javascript test code for modifying ties and slurs with mouse

2019-12-13 Thread Paolo Pr
Hello Carl,

my script is not intended for replacing the automatic handling of slurs. I
agree that the automatic handling should be the preferred way and the
development of the script is somewhat "off-topic" here (but I did not know
the right ml where to post it and I needed some other help for coding in
Scheme).
However, I think that the manual placement is necessary in two cases, even
with a "perfect" Lilypond:

1) for very complex scores (for example: contemporary classical music)
2) when the automatic placement is correct (no collisions), but not good to
see.

I think then that the two features can coexist. Consider that the few lines
of codes I wrote show another feature of Lilypond: it can generate svg for
easy-scripting too...

Best,
P

On Sat, Dec 14, 2019 at 3:49 AM Carl Sorensen  wrote:

> Paolo,
>
>
>
> I really appreciate your doing this.
>
>
>
> However, I would like to see us improve the **automatic** handling of
> slurs in LilyPond, so that \shape is almost never needed (much like
> extra-offset for standard music).  I’m not asking for you to do any work on
> improving the automatic slur handling, but I would love to have us have a
> collection of slurs automatically created by LilyPond along with the
> revised slurs created by \shape.  That would give us a test library to be
> able to test improvements in the LilyPond slur code.
>
>
>
> I’ve created issue #5638
>
> https://sourceforge.net/p/testlilyissues/issues/5638/
>
> as a place for users to place snippets that give bad automatic slurs and
> that show improved slurs by using \shape.   I’d invite everybody who finds
> ugly slurs to post both the ugly slur code and the improved slur code.
>
>
>
> Thanks,
>
>
>
> Carl
>
>
>
>
>
> *From: *Urs Liska 
> *Date: *Friday, December 13, 2019 at 4:40 PM
> *To: *
> *Subject: *Re: A Javascript test code for modifying ties and slurs with
> mouse
>
>
>
> I have to second Elaine's comment.
> Due to a very heavy workload right now I didn't have the opportunity to
> have a look at your example earlier,  but now I *really* like what I see.
>
> I think that you a) probably should go forward implementing a standalone
> solution of your approach, but that b) this should also be integrated into
> Frescobaldi, because this would probably kick it off and make it even more
> widely known. Plus, Frescobaldi should make it easier to write the code
> back into the LilyPond file. There are 2-3 people who would be more than
> willing to help you with the integration of the functionality in
> Frescobaldi.
>
> Best
> Urs
>
> Am 13.12.19 um 23:49 schrieb Flaming Hakama by Elaine:
>
>
>
> -- Forwarded message --
> From: Paolo Pr 
> To: lilypond-user 
> Cc:
> Bcc:
> Date: Thu, 12 Dec 2019 17:52:58 +0100
> Subject: A Javascript test code for modifying ties and slurs with mouse
>
> 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 ".
>
> 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 c

Re: A Javascript test code for modifying ties and slurs with mouse

2019-12-13 Thread Paolo Pr
Thanks Urs and Elaine for your appreciation.

Note that the same algo I wrote  with (relatively) short code can be
applied for many other properties as well (for example: extra-offset) which
are painful to control through the trial and error method...
I'll be on #irc (channel #lilypond) in the next days, so I can talk easily
there with any (welcome) collaborator. My nickname is 'paolopr'.
Before integrating the script into Frescobaldi, I would like to conclude
the standalone part.

First of all, I need to add with Lilypond a   tag to the svg file
just before the ending </svg> tag  in the following way:

1)

 <script xlink:href="lilyEasySlurs.js">


OR in the following way:

2)


<![CDATA[
...javascript code...
]]>



With method 2) I have a 100% Lilypond solution, and the produced svg is
ready do be used for modifying slurs, without having to integrate the
script manually
I searched in the API, but could not find any function for doing that.

To Eliane: note that you don't have to make a HTML document for that, nor
to rename to ".html" the ".svg" file. Just add the  tag as I
explained (note the xlink:href property) before the end </svg> tag., and
open the file with a normal browser.
As soon as we fix points 1) and 2) I can write a how-to, which will be very
short.

Best,
P


On Sat, Dec 14, 2019 at 12:40 AM Urs Liska <li...@openlilylib.org> wrote:

> I have to second Elaine's comment.
> Due to a very heavy workload right now I didn't have the opportunity to
> have a look at your example earlier,  but now I *really* like what I see.
>
> I think that you a) probably should go forward implementing a standalone
> solution of your approach, but that b) this should also be integrated into
> Frescobaldi, because this would probably kick it off and make it even more
> widely known. Plus, Frescobaldi should make it easier to write the code
> back into the LilyPond file. There are 2-3 people who would be more than
> willing to help you with the integration of the functionality in
> Frescobaldi.
>
> Best
> Urs
> Am 13.12.19 um 23:49 schrieb Flaming Hakama by Elaine:
>
>
> -- Forwarded message --
>> From: Paolo Pr <paolopr...@gmail.com>
>> To: lilypond-user <lilypond-user@gnu.org>
>> Cc:
>> Bcc:
>> Date: Thu, 12 Dec 2019 17:52:58 +0100
>> Subject: A Javascript test code for modifying ties and slurs with mouse
>> 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:
>>
>> <a  rel="nofollow" href="http://lilybin.com/29lnbd/4">http://lilybin.com/29lnbd/4</a>
>>
>> 2) Generate with Lilypond the .svg file and add to it the Javascript
>> script implemented by me. To test everything, let's use JsFiddle:
>>
>> <a  rel="nofollow" href="https://jsfiddle.net/61pb9Le4/">https://jsfiddle.net/61pb9Le4/</a>
>>
>> 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 portab

A Javascript test code for modifying ties and slurs with mouse

2019-12-12 Thread Paolo Pr
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 ".

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


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

2019-12-11 Thread Paolo Pr
On Wed, Dec 11, 2019 at 9:13 PM Urs Liska  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,


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

2019-12-11 Thread 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.

On Wed, Dec 11, 2019 at 6:42 PM Urs Liska  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  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)
>>
>


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

2019-12-11 Thread Paolo Pr
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 
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  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)
>>
>


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

2019-12-10 Thread Paolo Pr
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)


Re: Outside-staff-priority and vertical order of grobs

2019-12-09 Thread Paolo Pr
On Mon, Dec 9, 2019 at 5:38 PM Thomas Morley 
wrote:

> Am Mo., 9. Dez. 2019 um 17:05 Uhr schrieb Paolo Pr :
> >
>


> > Is there a way to set the staff-padding property of a grob and preserve
> at the same time the vertical order set with outside-staff-priority?
>
> Provoke collision by setting staff-padding of TupletBracket to the
> same value and let LilyPond sort it.
>
>
Hello Thomas,

This method, unfortunately, seems redundant, because I have to specify the
value for all the objects that are near the OttavaBracket. Instead, I
wonder if is there an automatic way to vertically order them, given that
the order is already set in the list of outside-staff-priority valuse.
For example, if I have in the following vertical order (grob1 on the top,
grob4 on the bottom):

grob1
grob2
grob3
grob4

---
---
---
---
---

I wonder if is there a way to shift grob4 vertically and automatically
shift grob1,2,3 as a consequence...

Thanks.


Outside-staff-priority and vertical order of grobs

2019-12-09 Thread Paolo Pr
Hello,

in the following snippet, I assigned to the TupletBracket grob an
outside-staff-priority higher than the OttavaBracket. Then, the
OttavaBracket is placed below it, as expected.


{
\override TupletBracket.outside-staff-priority = #340
\override Staff.OttavaBracket.outside-staff-priority = #300
\ottava #1 \tuplet 3/2 { c' d' f' }
}


However, if I override the staff-padding property of the OttavaBracket, the
ottava grob il placed in a new position regardless of the previous
outside-staff-priority order. Then, the TupletBracket us now placed below
the moved OttavaBracket:


{
\override TupletBracket.outside-staff-priority = #340
\override Staff.OttavaBracket.outside-staff-priority = #300
\override Staff.OttavaBracket #'staff-padding = #'5
\ottava #1 \tuplet 3/2 { c' d' f' }
}


Why? Is there a way to set the staff-padding property of a grob and
preserve at the same time the vertical order set
with outside-staff-priority?

Thanks,
Paolo


Re: Collision between ottava bracket and stems in cross-staff systems

2019-12-08 Thread Paolo Pr
Hello Kieren,

unfortunately this method is trial and error as well. In fact, I can't use
the same shorten-pair value if the stem is up or down, and (maybe) if the
notehead has different sizes...

I think that the problem with the bracket I just described is a bug or a
feature that should be enhanced...

On Mon, Dec 9, 2019 at 1:17 AM kieren_macmillan kieren_macmillan <
kieren_macmil...@sympatico.ca> wrote:

> Hi Paolo,
>
> I think you’d want a callback that tweaks shorten-pair?
>
> Look at <http://lilybin.com/vf4vaj/2> for an idea of what the final
> result might
> be.
>
> Hope that helps!
> Kieren.
>
>
> > ------ Original Message --
> > From: Paolo Pr 
> > Date: December 8, 2019 at 6:40 PM
> >
> >
> > Hello,
> >
> > in cross-staff systems, I see that the ottava bracket can produce an
> unwanted
> > collision between the "8va" string and the stems. Please, look at:
> >
> > http://lilybin.com/vf4vaj/1
> >
> > Is there a way to automatically avoid that, without using the
> trial-and-error
> > method for adjusting the offset of the object?
> >
> > Thanks
>


Collision between ottava bracket and stems in cross-staff systems

2019-12-08 Thread Paolo Pr
Hello,

in cross-staff systems, I see that the ottava bracket can produce an
unwanted collision between the "8va" string and the stems. Please, look at:

http://lilybin.com/vf4vaj/1

Is there a way to automatically avoid that, without using the
trial-and-error method for adjusting the offset of the object?

Thanks


Re: Place a markup string at the right of a notehead

2019-12-08 Thread Paolo Pr
On Sun, Dec 8, 2019 at 1:37 PM Thomas Morley 
wrote:

> Am So., 8. Dez. 2019 um 11:51 Uhr schrieb Paolo Pr :
>
> > 2) Is there a way to place the markup exactly on the top or on the
> bottom of the notehead as well?
>
> Not sure what you mean, could you provide an image?
>
>
I would like the same behaviour of expressive marks like dots or staccato
above (or below) noteheads:

http://lilybin.com/ndhwj3/1

They are placed near the notehead regardless of the collision with the
staff's lines
If we have this too, we have therefore a complete test case:

1) Markup at the right of a notehead  (the tweak you wrote before)
2) markup exactly above or below the notehead (?)
3) markup above or below notehead + staff + stem  ( c'^\markup {"foo"}  ,
c'_\markup {"foo"} )

thanks


Re: Place a markup string at the right of a notehead

2019-12-08 Thread Paolo Pr
Hi Thomas,

I think that your solution should be posted in the snippet repository as
well. It's very useful for very complex scores, when you have to manage lot
of markups, because the trial-and-error method is time consuming.
In addition:

1) How can I set the font's attributes of this tweak to the markup's
default ones? As you can see, there are some additional attributes that
differ (size and italic)

{
   bes-\tweak text \markup {"foo" } -\rightHandFinger #0
   d'^\markup { "foo" }
}

2) Is there a way to place the markup exactly on the top or on the bottom
of the notehead as well?

3) What can be used to add an extra offset (vertical or horizontal,
depending on the position of the markup)?

1 + 2 + 3 could give a really complete solution for having TOTAL control of
the markup's position. I understand that this is not the proper way to
manage these objects with Lilypond (you can add a warning in the snippet,
like "use this method only if you really need it") but in many cases it's
really useful.

Thanks
P





On Fri, Dec 6, 2019 at 12:08 PM Thomas Morley 
wrote:

> Am Fr., 6. Dez. 2019 um 01:55 Uhr schrieb Paolo Pr :
> >
> > Hello.
> >
> > I can't find an easy way to place a markup string exactly at the right
> of a notehead so they appear horizontally aligned. The only apparent way to
> obtain that is the trial-and-error procedure.
> > This can be very frustrating because I have to compile the input several
> times.
> > A work-around would be to replace the notehead's stencil with the
> notehead+text, but it doesn't convince me and it causes spacing issues with
> groups of notes.
> >
> > Is there a simpler way to solve this?
> >
> > Thanks
>
> Hijack StrokeFinger?
>
> {
>   <
>bes-\tweak text "foo" -\rightHandFinger #0
>d'-\tweak text "bar" -\rightHandFinger #0
>f'-\tweak text "buzz" -\rightHandFinger #0
>bes'-\tweak text "boink" -\rightHandFinger #0
>   >
> }
>
> Cheers,
>   Harm
>


Re: Place a markup string at the right of a notehead

2019-12-06 Thread Paolo Pr
Thanks Thomas.

A really smart solution.

On Fri, Dec 6, 2019 at 12:08 PM Thomas Morley 
wrote:

> Am Fr., 6. Dez. 2019 um 01:55 Uhr schrieb Paolo Pr :
> >
> > Hello.
> >
> > I can't find an easy way to place a markup string exactly at the right
> of a notehead so they appear horizontally aligned. The only apparent way to
> obtain that is the trial-and-error procedure.
> > This can be very frustrating because I have to compile the input several
> times.
> > A work-around would be to replace the notehead's stencil with the
> notehead+text, but it doesn't convince me and it causes spacing issues with
> groups of notes.
> >
> > Is there a simpler way to solve this?
> >
> > Thanks
>
> Hijack StrokeFinger?
>
> {
>   <
>bes-\tweak text "foo" -\rightHandFinger #0
>d'-\tweak text "bar" -\rightHandFinger #0
>f'-\tweak text "buzz" -\rightHandFinger #0
>bes'-\tweak text "boink" -\rightHandFinger #0
>   >
> }
>
> Cheers,
>   Harm
>


Re: Size of the arpeggio's arrow

2019-12-06 Thread Paolo Pr
Thank you Thomas, now all is perfect and very useful

On Fri, Dec 6, 2019 at 12:05 PM Thomas Morley 
wrote:

> Am Fr., 6. Dez. 2019 um 01:39 Uhr schrieb Paolo Pr :
> >
> > Thomas,
> >
> > thank you for your help. Unfortunately the snippet produces two errors
> that are visible with a size bigger than 1.2.
> >
> > Have a look at:   http://lilybin.com/y1t45z/1
> >
> > 1)   A collision between the arrow and the notehead that cannot be
> removed properly by overriding  Arpeggio.padding
> > 2) A graphical mismatch between the arrow and the stem
> >
> > About 1), I can't find another property that can fix the issue.
>
> Well, this is indeed a bug. We forgot to adjust X-extent for the
> enlarged stencil.
> Fixed in the code at the bottom of this mail.
> Probably we need to adjust the stencil itself as well. Not sure,
> though. In the code it's commented.
>
> > About 2), Instead of the default symbol, I would use a simple triangle,
> so to avoid any mismatch. Which is the way to add it?
>
> So far it's more due to the changed calculation:
>
> I wrote:
>
> >>  (/
> >>   (- (interval-length stil-x-ext)
> >>  (interval-length red-arrow-x-ext))
> >>   2)
>
> The lilybin-file reads:
>
>  (/
>   (- (interval-length stil-x-ext)
>  (interval-length red-arrow-x-ext))
>   10)
>
> Which causes the problem. Go back to `2´ and all is fine.
>
> If you want another stencil for the arrow-head then the method is
> already demonstrated.
> Get the stencil from the font (there are other arrows available) or
> construct it. Using markup would be the most simple. Add it to the
> default line. Move the arrow accordingly.
> Take care of properties positions and X-extent.
>
> Here the changed code, additionally I did some clean up, avoiding
> multiple calculations of the same things adding comments etc.
>
> biggerArrow =
> #(define-music-function (scale)(number?)
> "Returns an override for @code{Arpeggio.stencil}, with arrow-heads scaled
> by
> @var{scale}"
> #{
>   \override Arpeggio.stencil =
>   #(lambda (grob)
> (let* ((arp-dir (ly:grob-property grob 'arpeggio-direction)))
>   ;; If 'arpeggio-direction is unset use default-stencil
>   (if (null? arp-dir)
>   (ly:arpeggio::print grob)
>   (let* ((arrow-glyph
>(format #f
>  "scripts.arpeggio.arrow.~a1"
>  (if (negative? arp-dir) "M" "")))
>  (font (ly:grob-default-font grob))
>  (arrow-head-stil (ly:font-get-glyph font arrow-glyph))
>  (arrow (ly:stencil-scale arrow-head-stil scale scale))
>  (arrow-y-ext (ly:stencil-extent arrow Y))
>  (arrow-x-ext (ly:stencil-extent arrow X))
>  (arrow-width (interval-length arrow-x-ext))
>  (pos (ly:grob-property grob 'positions)))
>
> ;; 'positions modified to reflect the height of the arrow-head
> (ly:grob-set-property! grob 'positions
>   (if (positive? arp-dir)
>   (cons (car pos) (- (cdr pos) arrow-width))
>   (cons (+ (car pos) arrow-width) (cdr pos
>
> ;; unset 'arpeggio-direction to get the default trill-line
> stencil
> (ly:grob-set-property! grob 'arpeggio-direction '())
>
> (let* ((stil (ly:arpeggio::print grob))
>(stil-y-ext (ly:stencil-extent stil Y))
>(stil-x-ext (ly:stencil-extent stil X))
>(stil-width (interval-length stil-x-ext))
>;; A scaled arrow-head will be slightly off, find the
> value
>;; to compensate for x-axis, before adding it to the
>;; arpeggio-line
>(scale-compensate-x (/ (- stil-width arrow-width) 2))
>(new-stil
>  (ly:stencil-add
>(ly:stencil-translate
>  arrow
>  (cons
>scale-compensate-x
>(if (negative? arp-dir)
>;; For a down pointing arrow, it's top will
> be at
>;; arpeggio-line-bottom, move by it's
> height to
>;; let the arrow-basis match with the
> line-bottom
>(- (car stil-y-ext)
>   (inte

Place a markup string at the right of a notehead

2019-12-05 Thread Paolo Pr
Hello.

I can't find an easy way to place a markup string exactly at the right of a
notehead so they appear horizontally aligned. The only apparent way to
obtain that is the trial-and-error procedure.
This can be very frustrating because I have to compile the input several
times.
A work-around would be to replace the notehead's stencil with the
notehead+text, but it doesn't convince me and it causes spacing issues with
groups of notes.

Is there a simpler way to solve this?

Thanks


Re: Size of the arpeggio's arrow

2019-12-05 Thread Paolo Pr
Thomas,

thank you for your help. Unfortunately the snippet produces two errors that
are visible with a size bigger than 1.2.

Have a look at:   http://lilybin.com/y1t45z/1

1)   A collision between the arrow and the notehead that cannot be removed
properly by overriding  Arpeggio.padding
2) A graphical mismatch between the arrow and the stem

About 1), I can't find another property that can fix the issue.

About 2), Instead of the default symbol, I would use a simple triangle, so
to avoid any mismatch. Which is the way to add it?

I think this feature is very important, because the default arrow is really
too small...

Best,
P

On Thu, Dec 5, 2019 at 9:52 PM Thomas Morley 
wrote:

> Am Do., 5. Dez. 2019 um 20:56 Uhr schrieb Thomas Morley
> :
> >
> > Am Do., 5. Dez. 2019 um 20:46 Uhr schrieb Thomas Morley
> > :
> > >
> > > Am Do., 5. Dez. 2019 um 20:01 Uhr schrieb Thomas Morley
> > > :
> > > >
> > > > Am Do., 5. Dez. 2019 um 19:02 Uhr schrieb Thomas Morley
> > > > :
> > > > >
> > > > > Am Do., 5. Dez. 2019 um 18:17 Uhr schrieb Thomas Morley
> > > > > :
> > > > > >
> > > > > > Am Do., 5. Dez. 2019 um 17:57 Uhr schrieb Paolo Prete <
> p4olo_pr...@yahoo.it>:
> > > > > > >
> > > > > > >
> > > > > > > Hi Thomas.
> > > > > > > Yes, I'm interested. I could not find any snippet for that,
> nor a corresponding property for "Arpeggio" in the "Lilypond Internals
> Reference"
> > > > > > > Thanks.
> > > > > > >
> > > > > > > Il giovedì 5 dicembre 2019, 16:22:12 GMT, Thomas Morley <
> thomasmorle...@gmail.com> ha scritto:
> > > > > > >
> > > > > > >
> > > > > > > Am Do., 5. Dez. 2019 um 15:07 Uhr schrieb Paolo Pr <
> paolopr...@gmail.com>:
> > > > > > >
> > > > > > > >
> > > > > > > > (I re-post this because it seems that mails from Yahoo
> services, like some of my previous posts, are filtered as spam)
> > > > > > > >
> > > > > > > > Hello,
> > > > > > > >
> > > > > > > > how can I modify the size of the arrow of an
> \arpeggioArrowUp/Down object?
> > > > > > > >
> > > > > > > > Thanks
> > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > There is no builtin method to do so.
> > > > > > > You could create your own stencil, though.
> > > > > > >
> > > > > > > Interested in learning howto?
> > > > > > >
> > > > > > >
> > > > > > > Cheers,
> > > > > > >   Harm
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > Ok :)
> > > > > > So what do we want?
> > > > > > While applying \arpeggioArrowUp we want the usual arpeggio, but
> the
> > > > > > added arrow-head should be sized as we want.
> > > > > >
> > > > > > Alas, as soon as we set \arpeggioArrowUp the default is there.
> > > > > > Mmhh, what exactly does \arpeggioArrowUp?
> > > > > > Looking into property-init.ly (found by some search-functions
> of your
> > > > > > editor or some grepping):
> > > > > >
> > > > > > arpeggioArrowUp = {
> > > > > >   \revert Arpeggio.stencil
> > > > > >   \revert Arpeggio.X-extent
> > > > > >   \override Arpeggio.arpeggio-direction = #UP
> > > > > > }
> > > > > >
> > > > > > Interesting is arpeggio-direction, looks like it triggers the
> arrowed arpeggio.
> > > > > > Let's proof:
> > > > > >
> > > > > > {
> > > > > >   \arpeggioArrowUp
> > > > > >   R1
> > > > > >   \override Arpeggio.arpeggio-direction = #'()
> > > > > >   \arpeggio
> > > > > > }
> > > > > >
> > > > > > And indeed the arrow-head is gone.
> > > > > >
> > > > > > Now we can recreate the _default_-stencil explicitely, using the
> > > > > > default-stencil, foun

Re: Size of the arpeggio's arrow

2019-12-05 Thread Paolo Pr
Hi Thomas.
Yes, I'm interested. I could not find any snippet for that, nor a
corresponding property for "Arpeggio" in the "Lilypond Internals Reference"
Thanks.

On Thu, Dec 5, 2019 at 5:17 PM Thomas Morley 
wrote:

> Am Do., 5. Dez. 2019 um 15:07 Uhr schrieb Paolo Pr :
> >
> > (I re-post this because it seems that mails from Yahoo services, like
> some of my previous posts, are filtered as spam)
> >
> > Hello,
> >
> > how can I modify the size of the arrow of an \arpeggioArrowUp/Down
> object?
> >
> > Thanks
> >
>
> There is no builtin method to do so.
> You could create your own stencil, though.
>
> Interested in learning howto?
>
>
> Cheers,
>   Harm
>


Size of the arpeggio's arrow

2019-12-05 Thread Paolo Pr
(I re-post this because it seems that mails from Yahoo services, like some
of my previous posts, are filtered as spam)

Hello,

how can I modify the size of the arrow of an \arpeggioArrowUp/Down object?

Thanks


Rest between the staves of a piano-staff

2019-12-05 Thread Paolo Pr
Hello,

Is there a way to center a rest between the staves of a piano-staff?
I could specify the vertical position with  "somenote \rest"  but I wonder
is is there a better (and automatic) method, given that the position
depends on multiple factors.