[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Apply event function *within* music-function
From: |
Urs Liska |
Subject: |
Re: Apply event function *within* music-function |
Date: |
Tue, 2 May 2017 17:30:21 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
Hi Jan-Peter
Am 02.05.2017 um 11:10 schrieb Jan-Peter Voigt:
> Hi Urs,
>
> Am 02.05.2017 um 10:53 schrieb Urs Liska:
> > ...
>> What I did *not* manage yet is at the end of the thing.
>> When I use
>>
>> test =
>> #(define-music-function (mus)(ly:music?)
>> #{
>> <>\startGroup
>> #mus
>> <>\stopGroup
>> #})
>>
>> {
>> \test { c' d' e' f' } g' a' b' c'
>> }
>>
>> the bracket includes the g' - or rather the zero-length chord
>> immediately before it.
>>
>> Do you have any suggestion how to do *this* in a convenient manner, i.e.
>> without splitting #mus into pieces and insert the \stopGroup before the
>> last element?
>
> this *is* kind of splitting the music, but just to show, where the
> closing articulation "NoteGroupingEvent" should be placed:
>
> \version "2.19.57"
>
> test =
> #(define-music-function (mus)(ly:music?)
> (let* ((elms (ly:music-property mus 'elements))
> ; first and last music-element ...
> (frst (first elms)) ; TODO test for list? and ly:music?
> (lst (last elms)) ; TODO test for list? and ly:music?
> (fartic (ly:music-property frst 'articulations '())) ; look
> for eventchords ...
> (lartic (ly:music-property lst 'articulations '()))
> )
> (ly:music-set-property! frst 'articulations `(,@fartic
> ,(make-music 'NoteGroupingEvent 'span-direction -1)))
> (ly:music-set-property! lst 'articulations `(,@lartic
> ,(make-music 'NoteGroupingEvent 'span-direction 1)))
> #{
> #mus
> #}))
>
> \new Staff \with {
> \consists "Horizontal_bracket_engraver"
> } {
> \test { c' d' e' f' } g' a' b' c''
> }
>
>
> HTH
Yes, it does. I don't think there's an even more straightforward
solution (like the <> for the first element) to this. I successfully
integrated it into my code.
But what would be the cases where the element is a list? instead of
ly:music? And what does the "eventchords" comment refer to?
Best
Urs
> Jan-Peter
>
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
--
address@hidden
https://openlilylib.org
http://lilypondblog.org
- Apply event function *within* music-function, Urs Liska, 2017/05/02
- Re: Apply event function *within* music-function, Thomas Morley, 2017/05/02
- Re: Apply event function *within* music-function, caagr98, 2017/05/02
- Re: Apply event function *within* music-function, Urs Liska, 2017/05/02
- Re: Apply event function *within* music-function, Thomas Morley, 2017/05/02
- Re: Apply event function *within* music-function, Urs Liska, 2017/05/02
- Re: Apply event function *within* music-function, Jan-Peter Voigt, 2017/05/02
- Re: Apply event function *within* music-function,
Urs Liska <=
- Re: Apply event function *within* music-function, Jan-Peter Voigt, 2017/05/02