Jump to content

Manipulating slurs via 'positions and 'extra-offset: Difference between revisions

From LilyPond wiki
m Does not need full page layout
Tag: Reverted
Undo revision 6450 by Ksnortum (talk)
Tag: Undo
 
Line 3: Line 3:
<code>slurShift</code> shifts the slur exactly the amount you want without changing the shape, <code>slurShiftx</code> combines <code>slurShift</code> and <code>Slur.positions</code>.
<code>slurShift</code> shifts the slur exactly the amount you want without changing the shape, <code>slurShiftx</code> combines <code>slurShift</code> and <code>Slur.positions</code>.


<lilypond version="2.24">
<lilypond version="2.24" full>
\paper { tagline = ##f }
 
slurShift=
slurShift=
#(define-music-function (amount)
#(define-music-function (amount)

Latest revision as of 21:43, 12 March 2026

There is a command to change slurs, \override Slur.positions. Actually the influence of this command is limited, e.g. if you like the shape of the slur and you want to shift it a little bit,
\override Slur.positions does not exactly what you want.
slurShift shifts the slur exactly the amount you want without changing the shape, slurShiftx combines slurShift and Slur.positions.

\version "2.24"

\paper { tagline = ##f }

slurShift=
#(define-music-function (amount)
   (pair?)
   #{
     \once \override Slur.extra-offset = $amount
   #})

slurShiftx=
#(define-music-function (amount offsets)
   (pair? pair?)
   #{
     \once \override Slur.positions = $offsets
     \once \override Slur.extra-offset = $amount
   #})

\relative c, {
  \clef bass
  c8(-"default slur" g'' e' g, c g c g )
  \slurShift  #'(0 . 1)
  c,,8(-"slurShift #'(0 . 1)" g'' e' g, c g c g )
  \slurShiftx  #'(2 . 2) #'(0 . 6)
  c,,8(-"slurShiftx #'(2 . 2) #'(0 . 6)"
  g'' e' g, c g c g )
}