Re: Tuplet bracket and cross staff

2016-06-26 Thread Thomas Morley
2016-06-26 14:24 GMT+02:00 David Nalesnik :
> Hi Harm,
>
> On Sun, Jun 26, 2016 at 3:53 AM, Thomas Morley  
> wrote:
>> 2016-06-26 5:00 GMT+02:00 Andrew Bernard :
>>>  Hi Matteo,
>>>
>>> I have a tuplet angle function that somebody (I cannot recall who)
>>> sent me some time ago. I use it heavily and extensively and I can say
>>> it has been tested by me to the limit - it works well.
>>>
>>> Using this code you just say \tupletAngles 1 0 or similar and that's
>>> all you need. Put it is a file tuplet-angles.ily and include it. Using
>>> \tupletAngles 0 0 is very handy for straigthening up tuplets when you
>>> don't want lilypond to angle them.
>>>
>>> Here it is. [Surprised this is not more well known.]
>>>
>>> Andrew
>>
>> Looking in the archives:
>> http://lilypond.1069038.n5.nabble.com/angle-of-a-tuplet-bracket-td55019.html#a55023
>> :)
>>
>
> A very useful function!

Glad it's still of some use.

> It occurs to me that you could override 'positions directly without
> consulting the stencil, instead of as a side-effect:

Indeed, much more elegant.

>
> %% ===
> tupletAngles =
> #(define-music-function (y-off angl)(number? number?)
>"
>  y-off a (possible) offset in Y-direction
>  angl is supposed to be the angle of the TupletBracket in degrees,
>  "
>#{
>  \once\override TupletBracket #'positions =
>  #(lambda (grob)
> (let* ((pos (ly:tuplet-bracket::calc-positions grob))
>(y-length (interval-length pos))
>(x-length (interval-length
> (ly:tuplet-bracket::calc-x-positions grob)))
>(alpha (degrees->radians angl))
>(dir (ly:grob-property grob 'direction))
>(new-start (+ (if (= dir 1)
>  (max (car pos)(cdr pos))
>  (min (car pos)(cdr pos)))
> y-off))
>(new-y (* x-length (tan alpha
>   (cons new-start (+ new-start new-y
>#})
>
> horizontalTuplets =
> \override TupletBracket  #'positions =
> #(lambda (grob)
>(let* ((pos (ly:tuplet-bracket::calc-positions grob))
>   (dir (ly:grob-property grob 'direction))
>   (new-pos (if (= dir 1)
>(max (car pos)(cdr pos))
>(min (car pos)(cdr pos)
>  (cons new-pos new-pos)))
>
> %% ===
>
> (For newer versions, maybe it would be helpful to work in the
> grob-transformer function?)
>
> --DN

I've to admit I forgot about grob-transformer, before you mentioned it.

David K put up some examples replying to user requests, but I think it
should be documented more widely, maybe a snippet in
/Documentation/snippets will do it already or additionally(?) an entry
in the extending-manual.

Thanks for the reminder,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-26 Thread David Nalesnik
Hi Harm,

On Sun, Jun 26, 2016 at 3:53 AM, Thomas Morley  wrote:
> 2016-06-26 5:00 GMT+02:00 Andrew Bernard :
>>  Hi Matteo,
>>
>> I have a tuplet angle function that somebody (I cannot recall who)
>> sent me some time ago. I use it heavily and extensively and I can say
>> it has been tested by me to the limit - it works well.
>>
>> Using this code you just say \tupletAngles 1 0 or similar and that's
>> all you need. Put it is a file tuplet-angles.ily and include it. Using
>> \tupletAngles 0 0 is very handy for straigthening up tuplets when you
>> don't want lilypond to angle them.
>>
>> Here it is. [Surprised this is not more well known.]
>>
>> Andrew
>
> Looking in the archives:
> http://lilypond.1069038.n5.nabble.com/angle-of-a-tuplet-bracket-td55019.html#a55023
> :)
>

A very useful function!

It occurs to me that you could override 'positions directly without
consulting the stencil, instead of as a side-effect:


%% ===
tupletAngles =
#(define-music-function (y-off angl)(number? number?)
   "
 y-off a (possible) offset in Y-direction
 angl is supposed to be the angle of the TupletBracket in degrees,
 "
   #{
 \once\override TupletBracket #'positions =
 #(lambda (grob)
(let* ((pos (ly:tuplet-bracket::calc-positions grob))
   (y-length (interval-length pos))
   (x-length (interval-length
(ly:tuplet-bracket::calc-x-positions grob)))
   (alpha (degrees->radians angl))
   (dir (ly:grob-property grob 'direction))
   (new-start (+ (if (= dir 1)
 (max (car pos)(cdr pos))
 (min (car pos)(cdr pos)))
y-off))
   (new-y (* x-length (tan alpha
  (cons new-start (+ new-start new-y
   #})

horizontalTuplets =
\override TupletBracket  #'positions =
#(lambda (grob)
   (let* ((pos (ly:tuplet-bracket::calc-positions grob))
  (dir (ly:grob-property grob 'direction))
  (new-pos (if (= dir 1)
   (max (car pos)(cdr pos))
   (min (car pos)(cdr pos)
 (cons new-pos new-pos)))

%% ===

(For newer versions, maybe it would be helpful to work in the
grob-transformer function?)

--DN

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-26 Thread matpen3@gmail
Hi Andrew and Thomas,

@Andrew many thanks to report that
@Thomas really brilliant, as always

cheers

matteo 


> Il giorno 26 giu 2016, alle ore 10:53, Thomas Morley 
>  ha scritto:
> 
> 2016-06-26 5:00 GMT+02:00 Andrew Bernard :
>> Hi Matteo,
>> 
>> I have a tuplet angle function that somebody (I cannot recall who)
>> sent me some time ago. I use it heavily and extensively and I can say
>> it has been tested by me to the limit - it works well.
>> 
>> Using this code you just say \tupletAngles 1 0 or similar and that's
>> all you need. Put it is a file tuplet-angles.ily and include it. Using
>> \tupletAngles 0 0 is very handy for straigthening up tuplets when you
>> don't want lilypond to angle them.
>> 
>> Here it is. [Surprised this is not more well known.]
>> 
>> Andrew
> 
> Looking in the archives:
> http://lilypond.1069038.n5.nabble.com/angle-of-a-tuplet-bracket-td55019.html#a55023
> :)
> 
> Reading it up gives some additional informations...
> 
> Cheers,
>  Harm


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-26 Thread Thomas Morley
2016-06-26 5:00 GMT+02:00 Andrew Bernard :
>  Hi Matteo,
>
> I have a tuplet angle function that somebody (I cannot recall who)
> sent me some time ago. I use it heavily and extensively and I can say
> it has been tested by me to the limit - it works well.
>
> Using this code you just say \tupletAngles 1 0 or similar and that's
> all you need. Put it is a file tuplet-angles.ily and include it. Using
> \tupletAngles 0 0 is very handy for straigthening up tuplets when you
> don't want lilypond to angle them.
>
> Here it is. [Surprised this is not more well known.]
>
> Andrew

Looking in the archives:
http://lilypond.1069038.n5.nabble.com/angle-of-a-tuplet-bracket-td55019.html#a55023
:)

Reading it up gives some additional informations...

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-25 Thread Andrew Bernard
 Hi Matteo,

I have a tuplet angle function that somebody (I cannot recall who)
sent me some time ago. I use it heavily and extensively and I can say
it has been tested by me to the limit - it works well.

Using this code you just say \tupletAngles 1 0 or similar and that's
all you need. Put it is a file tuplet-angles.ily and include it. Using
\tupletAngles 0 0 is very handy for straigthening up tuplets when you
don't want lilypond to angle them.

Here it is. [Surprised this is not more well known.]

Andrew

== snip

\version "2.19.42"

%% ===
tupletAngles =
#(define-music-function (y-off angl)(number? number?)
   "
 y-off a (possible) offset in Y-direction
 angl is supposed to be the angle of the TupletBracket in degrees,
 "
   #{
 \once\override TupletBracket #'stencil =
 #(lambda (grob)
(let* ((pos (ly:grob-property grob 'positions))
   (y-length (interval-length pos))
   (st (ly:tuplet-bracket::print grob))
   (st-x-ext (ly:stencil-extent st X))
   (st-x-length (interval-length st-x-ext))
   (alpha (degrees->radians angl))
   (dir (ly:grob-property grob 'direction))
   (new-start (+ (if (= dir 1)
 (max (car pos)(cdr pos))
 (min (car pos)(cdr pos)))
y-off))
   (new-y (* st-x-length (tan alpha
  (ly:grob-set-property! grob 'positions (cons new-start (+
new-start new-y)))
  (ly:tuplet-bracket::print grob)))
   #})

horizontalTuplets =
\override TupletBracket  #'stencil =
#(lambda (grob)
   (let* ((pos (ly:grob-property grob 'positions))
  (dir (ly:grob-property grob 'direction))
  (new-pos (if (= dir 1)
   (max (car pos)(cdr pos))
   (min (car pos)(cdr pos)
 (ly:grob-set-property! grob 'positions (cons new-pos new-pos))
 (ly:tuplet-bracket::print grob)))

%% ===




\language "italiano"


staffDown = \change Staff = "LH"

staffUp = \change Staff = "RH"



RH_VIII = \relative do'' {

  r2

  \tupletUp

  \once \override TupletBracket.staff-padding = #9

  \tupletAngles -6 30
  \tuplet 5/4 {

\staffDown r16  sol'-. \staffUp re'\( mib re

  } sib'8\)-. r

  |

}



LH_VIII = \relative do' {

  \clef "treble" r2 s4 la''8-. r8

  |

}



<<

  \set PianoStaff.connectArpeggios = ##t

  \new Staff = "RH" \with {

\accidentalStyle neo-modern

\numericTimeSignature

\override Flag.stencil = #modern-straight-flag

\override VerticalAxisGroup.remove-empty = ##f

  }  \RH_VIII

  \new Staff = "LH" \with {

\accidentalStyle neo-modern

\numericTimeSignature

\clef "bass"

\override Flag.stencil = #modern-straight-flag

\override VerticalAxisGroup.remove-empty = ##f

  } \LH_VIII

>>


== snip

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-25 Thread David Nalesnik
On Sat, Jun 25, 2016 at 5:15 PM, Simon Albrecht  wrote:
> On 25.06.2016 20:22, David Nalesnik wrote:
>>
>> On Sat, Jun 25, 2016 at 1:19 PM, David Nalesnik
>>  wrote:
>>>
>>> Hi,
>>>
>>> On Sat, Jun 25, 2016 at 11:50 AM, matpen3@gmail 
>>> wrote:

 Hi Stephen,

 I’m using now

 \once \override TupletBracket.rotation = #'(0.1 -120 0.1)
>>
>> But it is strange that the TupletNumber doesn't follow along in this case
>> too...
>
>
> Well, it’s quite obvious that the current implementation of rotating objects
> is quite unsatisfactory. After all, the rotation isn’t even taken into
> account for spacing. (We have a ticket for that, IIRC.)

Yes, https://sourceforge.net/p/testlilyissues/issues/2325/

David

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-25 Thread David Nalesnik
On Sat, Jun 25, 2016 at 1:19 PM, David Nalesnik
 wrote:
> Hi,
>
> On Sat, Jun 25, 2016 at 11:50 AM, matpen3@gmail  wrote:
>> Hi Stephen,
>>
>> I’m using now
>>
>> \once \override TupletBracket.rotation = #'(0.1 -120 0.1)

But it is strange that the TupletNumber doesn't follow along in this case too...

DN

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-25 Thread David Nalesnik
Hi,

On Sat, Jun 25, 2016 at 11:50 AM, matpen3@gmail  wrote:
> Hi Stephen,
>
> I’m using now
>
> \once \override TupletBracket.rotation = #'(0.1 -120 0.1)
> \offset Y-offset 1.5 TupletNumber
>

If you adjust the positions property of the TupletBracket, the number
will follow along.  So you could do:

\once \override TupletBracket.positions = #'(15 . 20)

or use \offset:

\once \offset positions #'(1 . 1.5) TupletBracket

HTH,
David

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-25 Thread matpen3@gmail
Hi Stephen,

I’m using now

\once \override TupletBracket.rotation = #'(0.1 -120 0.1)
\offset Y-offset 1.5 TupletNumber

Thanks, also to David



> Il giorno 25 giu 2016, alle ore 18:20, Stephen MacNeil 
>  ha scritto:
> 
> can you share?
> 
> Stephen


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-25 Thread Stephen MacNeil
can you share?

Stephen
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-25 Thread Stephen MacNeil
good to know

Thanks
Stephen
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-25 Thread David Nalesnik
Hi,

On Sat, Jun 25, 2016 at 10:49 AM, Stephen MacNeil
 wrote:

>
> \override TupletNumber.Y-offset = #(lambda (grob) (+ 1.5
> (ly:tuplet-number::calc-y-offset grob)))
>

\offset Y-offset 1.5 TupletNumber

is equivalent

-David

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Tuplet bracket and cross staff

2016-06-25 Thread matpen3@gmail
Hi Stephen, 

thanks. 

Actually I’m finding a simpler way to move the whole tuplet, included the 
number, without to have to use two \override.
TupletBracket.staff-padding seemed so right ;)

cheers


matteo

> Il giorno 25 giu 2016, alle ore 17:49, Stephen MacNeil 
>  ha scritto:
> 
> Not the best way I am sure .. but it works. I am sure someone has a less 
> aggressive way. rotation seems to work when offset or extent does not.
> 
> RH_VIII = \relative do'' {
> r2
> \tupletUp
> %\once \override Score.TupletBracket.staff-padding = #19
> 
> \once \override TupletBracket.rotation = #'(0.1 -120 0.1)
> 
> %%% both work
> % use
> %\once \override TupletNumber.Y-offset = #16.85
> % or
> \override TupletNumber.Y-offset = #(lambda (grob) (+ 1.5 
> (ly:tuplet-number::calc-y-offset grob)))
> 
> 
> \tuplet 5/4 {
> \staffDown r16 sol'-. \staffUp re'\( mib re
> } sib'8\)-. r
> |
> }
> 
> 
> HTH
> Stephen
> 


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Tuplet bracket and cross staff

2016-06-25 Thread matpen3@gmail
Hi all,

I don’ understand why TupletBracket.staff-padding doesn’t work inside a context 
with a cross staff and I’m not able to find an alternative way to move the 
group.

How could I avoid the collision of the tuplet with the slur?

Thanks for any help.

Cheers 


Matteo


BracketCrossSTaff.ly
Description: Binary data
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user