lilypond-user
[Top][All Lists]
Advanced

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

Apply event function *within* music-function


From: Urs Liska
Subject: Apply event function *within* music-function
Date: Tue, 2 May 2017 08:29:12 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

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

-- 
address@hidden
https://openlilylib.org
http://lilypondblog.org

reply via email to

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