lilypond-user
[Top][All Lists]
Advanced

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

Re: Lyric tie inside word?


From: Knut Petersen
Subject: Re: Lyric tie inside word?
Date: Fri, 16 Sep 2016 13:20:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

Am 06.05.2015 um 01:08 schrieb Thomas Morley:

I had a hard time to find that code, I needed some kind of tunable \undertie for Hugo Distler: Mausfallensprüchlein
I think that "ratio" should probably be tunable. Any idea why the code  has not already been
incorporated into lilypond?

cu,
 Knut

2015-05-06 1:02 GMT+02:00 Tobias Braun <address@hidden>:
Never mind. It's working now, thanks a lot!

Good night,
Tobias


Am 06.05.2015 um 00:51 schrieb Simon Albrecht <address@hidden>:

So sorry. I should’ve tested the code before posting…
You need to use \line { } instead of a simple string in "". See attachment.


Am 06.05.2015 um 00:41 schrieb Tobias Braun:
I got it to work in \lyricmode now, but it still won't work in the \markup section.

If I do it like you say below, I just get the code printed in the lyrics. If I end the string before \override and start a new one after "köñiglichen", it works, but then I get line breaks around "königlichen". Adding \markup doesn't improve things either.

What exactly do "\override #'(word-space . 0)" and "\tied-lyric" do? When using "\override #'(word-space . 0)" inside a \lyricmode _expression_, "~" won't create a lyric tie (with a blank) anymore, but just literally print "~". I have to explicitly use \tied-lyric then.
They are markup commands. \override (the markup command) takes two arguments: a pair and a markup. The pair consists of property and value, given in Scheme syntax: #'(word-space . 0). The markup is produced using \tied-lyric, which takes a string (a series of characters enclosed in "") as its argument, again prefixed with # to make it a Scheme _expression_. And in order to use them in \lyricmode, you have to enclose them in \markup explicitly.

I hope that makes it a little clearer. Ein weites Feld…
Good night, :-)
Simon
<koeniglichen.ly>

_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user
How about:


\version "2.19.18"

%% https://code.google.com/p/lilypond/issues/detail?id=3088
%% extended

%%FIXME: add `\undertie "undertied"' to regression/markup-commands.ly

%% FIXME: c&p from stencil.scm -- define-public and remove copy
#(define (make-bezier-sandwich-stencil coords thick xext yext)
  (let* ((command-list `(moveto
                        ,(car (list-ref coords 3))
                        ,(cdr (list-ref coords 3))
                        curveto
                        ,(car (list-ref coords 0))
                        ,(cdr (list-ref coords 0))
                        ,(car (list-ref coords 1))
                        ,(cdr (list-ref coords 1))
                        ,(car (list-ref coords 2))
                        ,(cdr (list-ref coords 2))
                        curveto
                        ,(car (list-ref coords 4))
                        ,(cdr (list-ref coords 4))
                        ,(car (list-ref coords 5))
                        ,(cdr (list-ref coords 5))
                        ,(car (list-ref coords 6))
                        ,(cdr (list-ref coords 6))
                        closepath)))
  (ly:make-stencil
    `(path ,thick `(,@' ,command-list) 'round 'round #t)
    xext
    yext)))

%% FIXME: rewrite generic wrt axes and replace make-parenthesis-stencil
#(define (make-bow-stencil width height thickness angularity)
 "Create a bow stencil.
 @var{width} is the width of the bow markup.
 @var{thickness} is the thickness of the bow.
 @var{height} is the heigth of the bow.
 The higher the value of number @var{angularity},
 the more angular the shape of the bow."
   (let* ((line-width 0.1)
          (base-x (if (< width 0) (- width) 0))
          (base-y (if (< height 0) (- height) 0))
          (x-extent (ordered-cons 0 width))
          (y-extent (ordered-cons 0 height))
          (left-x (interval-start x-extent))
          (right-x (interval-end x-extent))
          (inner-y 0)
          (outer-y height)
          (left-end-point (cons left-x inner-y))
          (right-end-point (cons right-x inner-y))
          (outer-control-y (+ inner-y (* 4/3 outer-y)))
          (inner-control-y (+ outer-control-y
                             (if (< height 0) thickness (- thickness))))
          ;; keeping angularity allows for refactoring and
          ;; merging with make-parenthesis-stencil
          (offset-index (- (* 0.6 angularity) 0.8))
          (left-control-x (interval-index x-extent offset-index))
          (right-control-x (interval-index x-extent (- offset-index)))
          (left-outer-control-point
             (cons left-control-x outer-control-y))
          (right-outer-control-point
             (cons right-control-x outer-control-y))
          (right-inner-control-point
             (cons right-control-x inner-control-y))
          (left-inner-control-point
             (cons left-control-x inner-control-y)))

   (make-bezier-sandwich-stencil
     (list right-inner-control-point
           left-inner-control-point
           left-end-point
           right-end-point
           left-outer-control-point
           right-outer-control-point
           right-end-point
           left-end-point)
     line-width
     x-extent
     y-extent)))

%% FIXME: replace make-parenthesis-stencil by this:
#(define (make-parenthesis-stencil height width thick angularity)
  (ly:stencil-rotate-absolute
    (make-bow-stencil height width thick angularity)
    -90 0 0))

%% FIXME: c&p from bezier-bow.cc
#(define (F0_1 x) (* (/ 2 PI) (atan (* PI x 0.5))))
#(define (slur-height w h_inf r_0)
   (F0_1 (* (/ (* w r_0) h_inf) h_inf)))

#(define (make-tie-stencil width thickness direction)
  (let* ((height-limit 1)
         (ratio 0.25)
         (angularity 0.5)
         (height (slur-height width height-limit ratio)))
  (make-bow-stencil width (* direction height) thickness angularity)))

#(define-markup-command (undertie layout props arg)
  (markup?)
#:category font
#:properties ((thickness 1)
              (offset 2)
              (direction DOWN)
              (adjust-length 0)
              (adjust-x-pos 0))
"
@cindex undertie-ing text

Undertie @var{arg}. Looks at @code{thickness} to determine line
thickness, and @code{offset} to determine line y-offset.

@lilypond[verbatim,quote]
\\markup \\line {
\\undertie \"undertied\"
\\override #'(offset . 5)
\\override #'(thickness . 1)
\\undertie \"undertied\"
\\override #'(offset . 1)
\\override #'(thickness . 5)
\\undertie \"undertied\"
}
@end lilypond"
  (let* ((line-thickness (ly:output-def-lookup layout 'line-thickness))
         (thick (* thickness line-thickness))
         (markup (interpret-markup layout props arg))
         (x1 (car (ly:stencil-extent markup X)))
         (x2 (cdr (ly:stencil-extent markup X)))
         (y2 (cdr (ly:stencil-extent markup Y)))
         (w (- x2 x1 adjust-length (* 2 line-thickness)))
         (y (if (positive? direction)
                (+ line-thickness offset -2 y2)
                (* line-thickness (- offset))))
         (tie (ly:stencil-translate
                (make-tie-stencil w thick direction)
                (cons (+ line-thickness adjust-x-pos) y))))
  (ly:stencil-add markup tie)))

%%%%%%%%%%%%%%%
%% Examples
%%%%%%%%%%%%%%%

\paper { indent = 0 }

\markup {
  \fill-line {
    \fontsize #3 \bold \underline "toplevel Markup: "
     \column {
       \vspace #0.5
       \line { \bold "2."
         \column {
              \line {
                   Er ging aus der Kammer sein, /
                   dem
                   \override #'(adjust-x-pos . 0.5)
                   \override #'(adjust-length . 7.7)
                   \undertie königlichen Saal so rein, /
              }
                 "Gott von Art und Mensch, ..."
         }
      }
      \vspace #2
     }
  }
}


\markup \fontsize #3 \bold \underline "new Lyrics: "

\new Lyrics
\lyricmode {
  Er ging aus der Kammer sein, dem
  \markup
  \override #'(adjust-x-pos . 0.5)
  \override #'(adjust-length . 8.6)
  \undertie königlichen Saal so rein,
  Gott von Art und Mensch,
}


Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user



reply via email to

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