lilypond-user
[Top][All Lists]
Advanced

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

Re: Apply event function *within* music-function


From: caagr98
Subject: Re: Apply event function *within* music-function
Date: Tue, 2 May 2017 10:08:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0

Wouldn't the <>\stopGroup extend the group one note too far?

On 05/02/17 10:06, Thomas Morley wrote:
2017-05-02 8:29 GMT+02:00 Urs Liska <address@hidden>:
Hi all,

I'm trying to apply event functions to music passed into a music function
like that:

\version "2.19.57"

test =
#(define-music-function (mus)(ly:music?)
    #{
      #mus \startGroup
    #})

{
   \test c' d' e' f' \stopGroup
}


(of course this is not what I ultimately want to achieve, but the nucleus
from which I'll be able to continue on my own).

This fails with "error: syntax error, unexpected EVENT_IDENTIFIER". I think
it is because the #mus expression is somehow already complete (differently
from when used in regular input) and I have to somehow *apply* the
\startGroup event function to the #mus argument.

 From \displayMusic I can see that it is added as a NoteGroupingEvent to the
note's articulations, but I'd like to ask if there's a more straightforward
way to attach the event to the music than rebuilding the music expression in
Scheme.
OTOH I will want to do that for the first *and last* element in a music
expression (in order to apply the start and stop command to a sequence of
notes), so I may *have* to extract the Scheme representation anyway?

TIA
Urs



\layout {
   \context {
     \Voice
     \consists "Horizontal_bracket_engraver"
   }
}

test =
#(define-music-function (mus)(ly:music?)
    #{
       <>\startGroup
       $mus
       <>\stopGroup
    #})

{
   \test { c' d' e' f' }
}

Should do the trick.

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]