lilypond-user
[Top][All Lists]
Advanced

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

Re: Using \startTextSpan and \stopTextSpan in separate music functions


From: Thomas Morley
Subject: Re: Using \startTextSpan and \stopTextSpan in separate music functions
Date: Fri, 16 Sep 2016 23:49:24 +0200

2016-09-16 23:20 GMT+02:00 Abraham Lee <address@hidden>:
> All,
>
> Going off the of the thread here:
>
> http://lists.gnu.org/archive/html/lilypond-user/2016-09/msg00374.html
>
> and some personal email exchanges, I tried out a few things (found a working
> solution, though not ideal) and ran into something curious. I'd like to do
> something like the following, but it doesn't seem to work:
>
> %%%%%%%%%
>
> \version "2.19.36"
>
> myStartTextSpan = #(define-music-function (mus) (ly:music?)
> #{
>   \once \override TextSpanner.bound-details.left.text = "rit."
>   $mus \startTextSpan
> #})
>
> myStopTextSpan = #(define-music-function (mus) (ly:music?)
> #{
>   $mus \stopTextSpan
>   <>^\markup \italic "a tempo"
> #})
>
> \relative c' {
>   \myStartTextSpan b'1
>   c1
>   \myStopTextSpan e,1
>   g1
> }
>
> %%%%%%%%%
>
> This results in "unexpected EVENT_IDENTIFIER" errors at both
>
>   $mus \startTextSpan
>
> and
>
>   $mus \stopTextSpan
>
> When I put everything into a single expression without using music
> functions, it works as expected:
>
> %%%%%%%%%
>
> \version "2.19.36"
>
> \relative c' {
>   \override TextSpanner.bound-details.left.text = "rit."
>   b'1\startTextSpan
>   c1
>   e,1\stopTextSpan
>   <>^\markup \italic "a tempo"
>   g1
> }
>
> %%%%%%%%%
>
> This is just a simple example. The real use-case has numerous other
> \override statements that should occur prior to \startTextSpan, but the
> general idea is the same.
>
> Anyone know what's going on here?
>
> Best,
> Abraham


Your function doesn't integrate \start/stopTextSpan into the
'articulations of the music-arg, which is needed.
A most boiled down example would be:

mus = c'1
{ \mus \tenuto }


Would be probably nice to have it work, but I seem to remember there
are some problems, forgot what exactly though.

Your function could be done at the lines of:

myStartTextSpan = #(define-music-function (mus) (ly:music?)
  (ly:music-set-property! mus 'articulations
     (cons #{ \startTextSpan #}
       (ly:music-property mus 'articulations)))
  #{
    \override TextSpanner.color = #red
    #mus
  #})

\relative c' {
  \myStartTextSpan b'1
  c \stopTextSpan
}

Cheers,
  Harm



reply via email to

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