[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Añadir marcas de tiempo a glissandos largos ] | [ Up : Expressive marks ] | [ Ajustar la forma de las subidas y caídas de tono > ] |
Adjusting slur positions vertically
Using \override Slur.positions
it is possible to set the
vertical position of the start and end points of a slur to absolute
values (or rather, forcing LilyPond’s slur algorithm to consider these
values as desired). In many cases, this means a lot of trial and error
until good values are found. You probably have tried the
\offset
command next just to find out that it doesn’t work for
slurs, emitting a warning instead.
The code in this snippet allows you to tweak the vertical start and end
positions by specifying relative changes, similar to
\offset
.
Syntax: \offsetPositions #'(dy1 . dy2)
offsetPositions = #(define-music-function (offsets) (number-pair?) #{ \once \override Slur.control-points = #(lambda (grob) (match-let ((((_ . y1) _ _ (_ . y2)) (ly:slur::calc-control-points grob)) ((off1 . off2) offsets)) (set! (ly:grob-property grob 'positions) (cons (+ y1 off1) (+ y2 off2))) (ly:slur::calc-control-points grob))) #}) \relative c'' { c4(^"default" c, d2) \offsetPositions #'(0 . 1) c'4(^"(0 . 1)" c, d2) \offsetPositions #'(0 . 2) c'4(^"(0 . 2)" c, d2) \bar "||" g4(^"default" a d'2) \offsetPositions #'(1 . 0) g,,4(^"(1 . 0)" a d'2) \offsetPositions #'(2 . 0) g,,4(^"(2 . 0)" a d'2) }
[ << Expressive marks ] | [Top][Contents] | [ Repeats >> ] |
[ < Añadir marcas de tiempo a glissandos largos ] | [ Up : Expressive marks ] | [ Ajustar la forma de las subidas y caídas de tono > ] |