lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is the lyric tie tweakable?


From: Kieren MacMillan
Subject: Re: is the lyric tie tweakable?
Date: Mon, 24 Apr 2017 14:29:41 -0400

Hi David (et al.),

Is the built-in** lyric tie/elision tweakable?

There's no LyricTie grob, so no convenient way to tweak it.   You
could modify "tied-lyric" in scm/define-markup-commands.scm, since
that's what's engaged with the tilde.

I manually tweaked that function (see snippet, below), by adding an #:hspace -1.25 and #:hspace -1 as “[negative] padding”. The default gives

while the tweaked version gives the far more pleasing

But I can’t seem to figure out how to add left-pad and right-pad as properties (with default 0) — I keep getting “unbound variable” errors. If anyone could help, I’d appreciate it.

Thanks,
Kieren.

%%%  SNIPPET BEGINS
(define-markup-command (tied-lyric layout props str)
  (string?)
  #:category music
  #:properties ((word-space))
  "
@cindex simple text strings with tie characters

Like simple-markup, but use tie characters for @q{~} tilde symbols.

@lilypond[verbatim,quote]
\\markup \\column {
  \\tied-lyric #\"Siam navi~all'onde~algenti Lasciate~in abbandono\"
  \\tied-lyric #\"Impetuosi venti I nostri~affetti sono\"
  \\tied-lyric #\"Ogni diletto~e scoglio Tutta la vita~e~un mar.\"
}
@end lilypond"
  (define (replace-ties tie str)
    (if (string-contains str "~")
        (let*
            ((half-space (/ word-space 2))
             (parts (string-split str #\~))
             (tie-str (markup #:hspace half-space #:hspace -1.25
                              #:musicglyph tie
                              #:hspace half-space #:hspace -1))
             (joined  (list-join parts tie-str)))
          (make-concat-markup joined))
        str))

  (define short-tie-regexp (make-regexp "~[^.]~"))
  (define (match-short str) (regexp-exec short-tie-regexp str))

  (define (replace-short str mkp)
    (let ((match (match-short str)))
      (if (not match)
          (make-concat-markup (list
                               mkp
                               (replace-ties "ties.lyric.default" str)))
          (let ((new-str (match:suffix match))
                (new-mkp (make-concat-markup (list
                                              mkp
                                              (replace-ties "ties.lyric.default"
                                                            (match:prefix match))
                                              (replace-ties "ties.lyric.short"
                                                            (match:substring match))))))
            (replace-short new-str new-mkp)))))

  (interpret-markup layout
                    props
                    (replace-short str (markup))))
%%%%  SNIPPET ENDS
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: address@hidden


reply via email to

[Prev in Thread] Current Thread [Next in Thread]