Thanks Harm, that does what I wanted to:
The voice named in the function argument gets an extender line, a tag is computed for all other voices and these don’t get an extender line, but only the syllable which serves as a second argument to the function.

Kudos, Simon

Am 26.10.2014 um 01:10 schrieb Thomas Morley:
2014-10-25 14:46 GMT+02:00 Simon Albrecht <simon.albre...@mail.de>:
Am 24.10.2014 um 21:48 schrieb Thomas Morley:

2014-10-24 21:19 GMT+02:00 Simon Albrecht <simon.albre...@mail.de>:
[...]
I tried to, but somehow an
extender line inside a music function body gives a syntax error and I’ve
got
no clue how to circumvent that. You’ll find the current function
attached.
Can anyone help, please?
No attachment ;)
Always the same mistakes… sorry ;-/
Yours, Simon
I'm not sure what you're aiming for, though I made your function work so far:


\version "2.19.12"

\paper { ragged-right = ##f }

ext =
#(define-scheme-function (parser location voice syl) (symbol? ly:music?)
   (let* ((s? (eq? voice 'S))
          (a? (eq? voice 'A))
          (t? (eq? voice 'T))
          (b? (eq? voice 'B))
          (others (cond
                    (s? '(A T B))
                    (a? '(S T B))
                    (t? '(S A B))
                    (b? '(S A T)))))

          #{
            \tag $voice
              $(let* ((dur (ly:music-property syl 'duration))
                      (txt (ly:music-property syl 'text))
                      (lyr (make-lyric-event txt dur)))
                (ly:music-set-property! lyr 'articulations
                                            (list (make-music 'ExtenderEvent)))
                lyr)
            \tag $others $syl
          #}))

music =
<<
\new Voice = "mel"
\relative c' { c( d) e f }

%% works both:
\addlyrics { \ext A Will it work? }
%\new Lyrics \lyricsto "mel" {
%        \ext A
%        Will it work?
%  }

\keepWithTag A \music
\keepWithTag B \music


HTH,
   Harm


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

Reply via email to