Hello Harm and list,
thank you very much for this function! I really like it :-)
Now I just wanted to share my way to shorten the input:
\shape #'(((0 . 0)(0 . 0.3)(0 . 0.3)(0 . 0)))
is a long thing to type. Most times I only want to adjust the y-part of
the two inner control-points - sligtly. So I use the following:
--snip--
\version "2.15.38"
% predicate for a number or a list of numbers
#(define (number-or-list? v)
(or (number? v)
(and
(list? v)
(eval `(and ,@(map (lambda (x)`(number? ,x)) v))(interaction-environment))
)))
% shape function, that only touches y-parts of the two inner control-points
ty = #(define-music-function (parser location grob dy)(string?
number-or-list?)
; extract scheme-function from shape, to provide location of \ty
(let ((shape-fun (ly:music-function-extract shape)))
(shape-fun parser location grob
(if (list? dy)
(map (lambda (y) `((0 . 0)(0 . ,y)(0 . ,y)(0 . 0)) ) dy)
`((0 . 0)(0 . ,dy)(0 . ,dy)(0 . 0))
)
)))
\relative c'' {
\ty Tie #'.4 c1 ~ \ty Tie #'(0.4 0) c ~ \break c
}
--snip--
We can provide functions, where the control-point-modification is
calculated.
In this example, I use ly:music-function-extract to have a
scheme-function, that takes the location this shortcut happening. If you
use #{ \shape ... #}, any warnings will be shown for the inline code -
not the location where \ty (or whatever you call your function) is
called. This should be intended behaviour, but it is good to know.
Cheers, Jan-Peter
On 11.05.2012 00:50, Thomas Morley wrote:
Hi David,
I thought a while about your function.
I'd like to suggest some changes. In the attached file you can see:
- Elimination of `function' as argument of shape-curve and introducing
it as local variable.
- A new condition added in shape-curve at the siblings-variable: ly:spanner?
- In the music-function I added a new variable to specify the grob.
These give the advantage to define only one music-function.
Of course there is need to specify which grob should be applied.
But now it works for all curves:
Slur
PhrasingSlur
Tie
RepeatTie
LaissezVibrerTie
I didn't test it very widly, but what do you think?
Best,
Harm
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user