Re: Slur position : catching Llilypond values...

2011-02-14 Thread Dmytro O. Redchuk
On Fri 11 Feb 2011, 16:25 David Nalesnik wrote:
 On 2/11/11, Xavier Scheuer x.sche...@gmail.com wrote:
  On 8 February 2011 22:56, David Nalesnik dnale...@umail.iu.edu wrote:
 
  Hello,
 
  There probably is a better way to do this, but the function below
  seems to do the trick.  It adds an offset to the Y-coordinate of
  either or both of the slur's attachment points.  Setting one value of
  the pair to zero will leave one end-point as it is.  (See attached
  files.)
 
  offsetPositions =
   #(define-music-function (parser location offsets) (pair?)
 #{
\once \override Slur #'positions = #(lambda (grob)
  `(,(+ (car $offsets) (cdar (ly:slur::calc-control-points grob))) .
,(+ (cdr $offsets) (cdr (cadddr (ly:slur::calc-control-points
  grob))
 #})
 
  Nice feature!
 
 Thanks!
Great snippet, really!

  Could you add it to the LSR?  http://lsr.dsi.unimi.it/
 
 Done: http://lsr.dsi.unimi.it/LSR/Snippet?id=748

Would be great it if allows to specify which grob's positions to alter, like
this:

\offsetPositions #Arpeggio #'(-2 . 2)

:O)

-- 
  Dmytro O. Redchuk
  Bug Squad

  Be careful! These are some commonly used abbreviations:
   • LM -- Learning Manual
   • NR -- Notation Reference
   • IR -- Internal Reference

  Look at LilyPond’s documentation to find more.

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


Re: Slur position : catching Llilypond values...

2011-02-14 Thread David Nalesnik
On 2/14/11, Dmytro O. Redchuk brownian@gmail.com wrote:

 Would be great it if allows to specify which grob's positions to alter, like
 this:

 \offsetPositions #Arpeggio #'(-2 . 2)


Hi, Dmytro --

I actually have been working on a snippet which generalizes another
function -- namely, the oft-cited snippet for applying 'extra-offset
to broken slurs.

http://www.lilypond.org/doc/v2.12/Documentation/user/lilypond/Difficult-tweaks#Difficult-tweaks

It should be easy to do a similar thing with the positions snippet.

Here is my function:

offsetBrokenSpanner =
#(define-music-function (parser location name offsets) (string? pair?)
#{
  \overrideProperty $name #'after-line-breaking #(broken-spanner $offsets)
#}
)

#(define ((broken-spanner offsets) grob)
  (let* (
 ; have we been split?
 (orig (ly:grob-original grob))

 ; if yes, get the split pieces (our siblings)
 (siblings (if (ly:grob? orig)
 (ly:spanner-broken-into orig) '() )))

   (if (and (= (length siblings) 2)
 (eq? (car (last-pair siblings)) grob))
 (ly:grob-set-property! grob 'extra-offset offsets


To modify a slur:

\offsetBrokenSpanner #Slur #'(x . y)

To modify a grob in a higher context:

\offsetBrokenSpanner #Staff.OttavaBracket #'(x . y)

My only hesitation is this statement in the NR (section referenced above):

When applying this trick, the new after-line-breaking callback should
also call the old one after-line-breaking, if there is one. For
example, if using this with Hairpin, ly:hairpin::after-line-breaking
should also be called.

I confess I don't fully understand this, and hence I'm unsure if my
function is overly simplifed.  However, calling \offsetBrokenSpanner
#Hairpin #'(x . y) seems to work as expected.

[Note: the issue of contexts is why I used \overrideProperty instead
of \override.  For some reason, \override will not accept
Staff.OttavaBracket as a valid grob name.  I wonder if there is any
drawback to using \overrideProperty, since I've seen it so
infrequently.]

Best,
David

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


Re: Slur position : catching Llilypond values...

2011-02-14 Thread Dmytro O. Redchuk
On Mon 14 Feb 2011, 09:02 David Nalesnik wrote:
 On 2/14/11, Dmytro O. Redchuk brownian@gmail.com wrote:
 
  Would be great it if allows to specify which grob's positions to alter, like
  this:
 
  \offsetPositions #Arpeggio #'(-2 . 2)
Oh, yes, i see --- every grob requires it's own function to calc initial
positions, that's why it would not be so elegant for generalized function.

 Hi, Dmytro --
Hi, David!

[...]

 My only hesitation is this statement in the NR (section referenced above):
 
 When applying this trick, the new after-line-breaking callback should
 also call the old one after-line-breaking, if there is one. For
 example, if using this with Hairpin, ly:hairpin::after-line-breaking
 should also be called.
 
 I confess I don't fully understand this, and hence I'm unsure if my
 function is overly simplifed.  However, calling \offsetBrokenSpanner
 #Hairpin #'(x . y) seems to work as expected.
 
 [Note: the issue of contexts is why I used \overrideProperty instead
 of \override.  For some reason, \override will not accept
 Staff.OttavaBracket as a valid grob name.  I wonder if there is any
 drawback to using \overrideProperty, since I've seen it so
 infrequently.]
Mmm.. I know nothing about that. I don't what will happen if i create several
callbacks, attach them to the same grob and not all of them will call old one
after-line-breaking. Really, don't know :O)

Thank you for reminding this warning, thought.

-- 
  Dmytro O. Redchuk
  Bug Squad

  Be careful! These are some commonly used abbreviations:
   • LM -- Learning Manual
   • NR -- Notation Reference
   • IR -- Internal Reference

  Look at LilyPond’s documentation to find more.

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


Re: Slur position : catching Llilypond values...

2011-02-14 Thread Nick Payne

On 15/02/11 02:02, David Nalesnik wrote:

On 2/14/11, Dmytro O. Redchukbrownian@gmail.com  wrote:


Would be great it if allows to specify which grob's positions to alter, like
this:

\offsetPositions #Arpeggio #'(-2 . 2)


Hi, Dmytro --

I actually have been working on a snippet which generalizes another
function -- namely, the oft-cited snippet for applying 'extra-offset
to broken slurs.

http://www.lilypond.org/doc/v2.12/Documentation/user/lilypond/Difficult-tweaks#Difficult-tweaks

It should be easy to do a similar thing with the positions snippet.

Here is my function:

offsetBrokenSpanner =
#(define-music-function (parser location name offsets) (string? pair?)
 #{
   \overrideProperty $name #'after-line-breaking #(broken-spanner $offsets)
 #}
)

#(define ((broken-spanner offsets) grob)
   (let* (
  ; have we been split?
  (orig (ly:grob-original grob))

  ; if yes, get the split pieces (our siblings)
  (siblings (if (ly:grob? orig)
  (ly:spanner-broken-into orig) '() )))

(if (and (= (length siblings) 2)
  (eq? (car (last-pair siblings)) grob))
  (ly:grob-set-property! grob 'extra-offset offsets


To modify a slur:

\offsetBrokenSpanner #Slur #'(x . y)

To modify a grob in a higher context:

\offsetBrokenSpanner #Staff.OttavaBracket #'(x . y)

My only hesitation is this statement in the NR (section referenced above):

When applying this trick, the new after-line-breaking callback should
also call the old one after-line-breaking, if there is one. For
example, if using this with Hairpin, ly:hairpin::after-line-breaking
should also be called.

I confess I don't fully understand this, and hence I'm unsure if my
function is overly simplifed.  However, calling \offsetBrokenSpanner
#Hairpin #'(x . y) seems to work as expected.

[Note: the issue of contexts is why I used \overrideProperty instead
of \override.  For some reason, \override will not accept
Staff.OttavaBracket as a valid grob name.  I wonder if there is any
drawback to using \overrideProperty, since I've seen it so
infrequently.]


This is something similar:

\version 2.13.48

#(define ((grob2-extra-offset offset) grob)
(let* (
(orig (ly:grob-original grob))
(siblings (if (ly:grob? orig)
(ly:spanner-broken-into orig)
'(
(if (and (= (length siblings) 2)
(eq? (car (last-pair siblings)) grob))
(ly:grob-set-property! grob 'extra-offset offset

albOffset = #(define-music-function (parser location type move) (string? 
pair?) #{
\once \override $type #'after-line-breaking = #(grob2-extra-offset 
$move)

#})

#(set-global-staff-size 24)

\relative c'' {
\time 6/4
 {
a'8 g fis e dis e \acciaccatura e d4. c'8 b4 |
c4 r2 s2. |
dis8 b c b a g b2\rest e gis,4 |
} \\ {
fis,,,8 e' dis e fis b, c4. g8 a4 |
dis2 r4 s2. |
b2 r4 r2. |
} \\ {
fis4 s2 s2. |
s8 e'' fis e g fis ~ fis4. gis8 a4 ~ |
a4 c,2\rest s2. |
} \\ {
s1. |
c8\rest b a g a c dis4. e,8
\albOffset Tie #'(0 . 1)
fis4 ~ |
fis4 s2 fis'8 e dis cis dis b |
} 
}

Nick


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


Re: Slur position : catching Llilypond values...

2011-02-14 Thread David Nalesnik
 Here is my function:

 offsetBrokenSpanner =
 #(define-music-function (parser location name offsets) (string? pair?)
  #{
\overrideProperty $name #'after-line-breaking #(broken-spanner
 $offsets)
  #}
 )

 #(define ((broken-spanner offsets) grob)
(let* (
   ; have we been split?
   (orig (ly:grob-original grob))

   ; if yes, get the split pieces (our siblings)
   (siblings (if (ly:grob? orig)
   (ly:spanner-broken-into orig) '() )))

 (if (and (= (length siblings) 2)
   (eq? (car (last-pair siblings)) grob))
   (ly:grob-set-property! grob 'extra-offset offsets



 This is something similar:

 \version 2.13.48

 #(define ((grob2-extra-offset offset) grob)
  (let* (
  (orig (ly:grob-original grob))
  (siblings (if (ly:grob? orig)
  (ly:spanner-broken-into orig)
  '(
  (if (and (= (length siblings) 2)
  (eq? (car (last-pair siblings)) grob))
  (ly:grob-set-property! grob 'extra-offset offset

 albOffset = #(define-music-function (parser location type move) (string?
 pair?) #{
  \once \override $type #'after-line-breaking = #(grob2-extra-offset
 $move)
 #})


 Nick

Hi, Nick --

The difference that I see between the two versions here is the use of
\once \override vs. \overrideProperty.  I don't know if anything has
changed in the development versions, but in 2.12.3, I get warnings
(not a grob name) and errors (Grob name should be alphanumeric)
when I use \override with strings such as Staff.OttavaBracket and
Staff.PianoPedalBracket.  This doesn't happen with
\overrideProperty, so you have access to grobs in other contexts.

Best,
David
 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 http://lists.gnu.org/mailman/listinfo/lilypond-user


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


Re: Slur position : catching Llilypond values...

2011-02-13 Thread Phil Holmes
- Original Message - 
From: David Nalesnik dnale...@umail.iu.edu

To: Xavier Scheuer x.sche...@gmail.com
Cc: Llilypond EN lilypond-user@gnu.org
Sent: Friday, February 11, 2011 10:25 PM
Subject: Re: Slur position : catching Llilypond values...



On 2/11/11, Xavier Scheuer x.sche...@gmail.com wrote:


Could you add it to the LSR?  http://lsr.dsi.unimi.it/


Done: http://lsr.dsi.unimi.it/LSR/Snippet?id=748



Approved with a few minor changes to the text.  Thanks.

--
Phil Holmes


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


Re: Slur position : catching Llilypond values...

2011-02-11 Thread Xavier Scheuer
On 8 February 2011 22:56, David Nalesnik dnale...@umail.iu.edu wrote:

 Hello,

 There probably is a better way to do this, but the function below
 seems to do the trick.  It adds an offset to the Y-coordinate of
 either or both of the slur's attachment points.  Setting one value of
 the pair to zero will leave one end-point as it is.  (See attached
 files.)

 offsetPositions =
  #(define-music-function (parser location offsets) (pair?)
#{
   \once \override Slur #'positions = #(lambda (grob)
 `(,(+ (car $offsets) (cdar (ly:slur::calc-control-points grob))) .
   ,(+ (cdr $offsets) (cdr (cadddr (ly:slur::calc-control-points 
 grob))
#})

Nice feature!

Could you add it to the LSR?  http://lsr.dsi.unimi.it/

Cheers,
Xavier

-- 
Xavier Scheuer x.sche...@gmail.com

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


Re: Slur position : catching Llilypond values...

2011-02-11 Thread David Nalesnik
On 2/11/11, Xavier Scheuer x.sche...@gmail.com wrote:
 On 8 February 2011 22:56, David Nalesnik dnale...@umail.iu.edu wrote:

 Hello,

 There probably is a better way to do this, but the function below
 seems to do the trick.  It adds an offset to the Y-coordinate of
 either or both of the slur's attachment points.  Setting one value of
 the pair to zero will leave one end-point as it is.  (See attached
 files.)

 offsetPositions =
  #(define-music-function (parser location offsets) (pair?)
#{
   \once \override Slur #'positions = #(lambda (grob)
 `(,(+ (car $offsets) (cdar (ly:slur::calc-control-points grob))) .
   ,(+ (cdr $offsets) (cdr (cadddr (ly:slur::calc-control-points
 grob))
#})

 Nice feature!

Thanks!

 Could you add it to the LSR?  http://lsr.dsi.unimi.it/

Done: http://lsr.dsi.unimi.it/LSR/Snippet?id=748

I tried to make the code a little clearer by using first and last,
but apparently those procedures aren't defined within the #{  . . . #}
construct.

 Cheers,
 Xavier

Best,
David

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


Re: Slur position : catching Llilypond values...

2011-02-07 Thread Éditions IN NOMINE



Dmytro O. Redchuk a écrit :


http://lsr.dsi.unimi.it/LSR/Item?id=639 ?


Sorry, i was too quick sending this.

I mean that for 'positions you might want to create something similar --
function which takes a pair and adjusts 'positions for Slur.

  

Well, your LSR snippet is a good start.

Trying to adapt second part of \shapoeSlur to my function.
I'll tell if I need help !

JMarc

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


Slur position : catching Llilypond values...

2011-02-07 Thread Éditions IN NOMINE
Well, let me explain  :-) 


I often use \once \override Voice.Slur #'positions = #'(a . b) to adjust Slur 
position, and most of the time, I only need to modify only one of a or b.

I'd like to be able to catch the default a or b value and tell Lily not to touch it, so that I could tell Lily something like : 


\once \override Voice.Slur #'positions = #'(* . b)

with * = default value, which would mean whatever you want

Does anybody know a clever trick for that ?

Best regards !
JMarc


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


Re: Slur position : catching Llilypond values...

2011-02-07 Thread Dmytro O. Redchuk
On Mon 07 Feb 2011, 16:32 Éditions IN NOMINE wrote:
 Well, let me explain  :-)
 
 I often use \once \override Voice.Slur #'positions = #'(a . b) to adjust Slur 
 position, and most of the time, I only need to modify only one of a or b.
 
 I'd like to be able to catch the default a or b value and tell
 Lily not to touch it, so that I could tell Lily something like :
 
 \once \override Voice.Slur #'positions = #'(* . b)
 
 with * = default value, which would mean whatever you want
 
 Does anybody know a clever trick for that ?
http://lsr.dsi.unimi.it/LSR/Item?id=639 ?

 
 Best regards !
 JMarc

-- 
  Dmytro O. Redchuk
  Bug Squad

  Be careful! These are some commonly used abbreviations:
   • LM -- Learning Manual
   • NR -- Notation Reference
   • IR -- Internal Reference

  Look at LilyPond’s documentation to find more.

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


Re: Slur position : catching Llilypond values...

2011-02-07 Thread Dmytro O. Redchuk
On Mon 07 Feb 2011, 17:51 I wrote:
 On Mon 07 Feb 2011, 16:32 Éditions IN NOMINE wrote:
  Well, let me explain  :-)
  
  I often use \once \override Voice.Slur #'positions = #'(a . b) to adjust 
  Slur position, and most of the time, I only need to modify only one of a or 
  b.
  
  I'd like to be able to catch the default a or b value and tell
  Lily not to touch it, so that I could tell Lily something like :
  
  \once \override Voice.Slur #'positions = #'(* . b)
  
  with * = default value, which would mean whatever you want
  
  Does anybody know a clever trick for that ?
 http://lsr.dsi.unimi.it/LSR/Item?id=639 ?
Sorry, i was too quick sending this.

I mean that for 'positions you might want to create something similar --
function which takes a pair and adjusts 'positions for Slur.

  
  Best regards !
  JMarc

-- 
  Dmytro O. Redchuk
  Bug Squad

  Be careful! These are some commonly used abbreviations:
   • LM -- Learning Manual
   • NR -- Notation Reference
   • IR -- Internal Reference

  Look at LilyPond’s documentation to find more.

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