lilypond-user
[Top][All Lists]
Advanced

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

Re: arpeggioArrowUp


From: Thomas Morley
Subject: Re: arpeggioArrowUp
Date: Fri, 16 Jan 2015 00:26:27 +0100

2015-01-15 15:02 GMT+01:00 tisimst <address@hidden>:
> On Wed, Jan 14, 2015 at 11:47 PM, Schneidy [via Lilypond] <[hidden email]>
> wrote:
>
> Hi Harm,
>
> 2015-01-15 3:22 GMT+01:00 Thomas Morley <[hidden email]>:
>
>>
>> foo =
>> #(define-music-function (parser location mus)(ly:music?)
>>   (music-map
>>     (lambda (m)
>>       (if (music-is-of-type? m 'arpeggio-event)
>>           (make-music
>>              'ArpeggioEvent
>>              'tweaks
>>              (list
>>                (cons 'arpeggio-direction
>>                      (ly:music-property m 'direction))))
>>           m))
>>     mus))
>>
>>
>> \foo
>> \relative c'' {
>>   \mark "sort of post-processing"
>>   <g b d g>4\arpeggio
>>   <g b d g>4^\arpeggio
>>   <g b d g>4_\arpeggio
>> }
>
>
> I like this one.
> Cheers,
> Pierre
>
>
> +1!
>
> However, I'd rather not have to use another function (\foo) to do this.
> Otherwise, I don't think there's any benefit over what is currently required
> with \arpeggioArrowUp. Can't it be put directly into a command that supports
> the direction indicators? I can't seem to find in the documentation where
> the post-fix syntax is described.
>
> -Abraham



The direction indicators _ and ^ are setting the 'direction, as their
name suggests ;).
Though the arpeggio-arrow is printed, if the _'arpeggio-direction_ is set!
Currently those are two different things. It may be discussable, if it
_should_ be this way, but it has some logic, if you think about it.
Nevertheless my 'foo'-function iterated through the music, setting
'arpeggio-direction to the value of 'direction.
This is not very cheap, maybe better to use an engraver for this duty:

\version "2.19.15"

direction-to-arpeggio-direction-engraver =
#(lambda (context)
 (let ((dir '()))
  `((listeners
     (arpeggio-event
       .
       ,(lambda (engraver event)
         ;; Not sure about following 'set!'
         ;; Is it save?
         (set! dir (ly:event-property event 'direction)))))
    (acknowledgers
     (arpeggio-interface
       .
       ,(lambda (engraver grob source-engraver)
          (set! (ly:grob-property grob 'arpeggio-direction) dir)
          (set! dir '())))))))

%%%%%%%%%%%%%%%%%%%%
%% EXAMPLE
%%%%%%%%%%%%%%%%%%%%

\layout {
  \context {
    \Score
    \consists #direction-to-arpeggio-direction-engraver
  }
}


Cheers,
  Harm



reply via email to

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