On Sat, Apr 11, 2015 at 9:01 AM, David Nalesnik <david.nales...@gmail.com>
wrote:

> Hi Urs,
>
> On Sat, Apr 11, 2015 at 3:31 AM, Urs Liska <u...@openlilylib.org> wrote:
>
>> Hi,
>>
>> this is related to my previous thread and particularly to the file
>> attached to
>> http://lists.gnu.org/archive/html/lilypond-user/2015-04/msg00263.html
>>
>> If I have a Scheme engraver listening to TextScript-s I can get a list of
>> entries at the same timestep and then compare them for equality.
>> This even works without changes for DynamicText because that also has a
>> 'text property. But if i have spanners such as hairpins it's not that
>> simple anymore. So I'm asking myself if I can access the starting and
>> ending timesteps of hairpins that are present in such a list. Of course I
>> can collect hairpins in a list like I can collect TextScripts (currently
>> I'm listening for line-interface). But is it possible to retrieve the start
>> *and* end position of such items?
>>
>> The goal is to iterate over the list and find matching hairpins to remove
>> duplicate ones.
>>
>>
> A simple way to determine when a hairpin starts and ends is by using an
> acknowledger and an end-acknowledger:
>
>  myEngraver =
> #(lambda (context)
>      (make-engraver
>
>       (acknowledgers
>        ((hairpin-interface engraver grob source-engraver)
>         (format #t "My start is at ~a~%" (ly:context-current-moment
> context))))
>
>       (end-acknowledgers
>        ((hairpin-interface engraver grob source-engraver)
>         (format #t "My end is at ~a~%" (ly:context-current-moment
> context))))
>      ))
>
> \layout {
>   \context {
>     \Score
>     \consists \myEngraver
>   }
> }
>
> {
>   c''1~\<
>   c''1\!
>   c''2.\< c''4\!
>   c''1~\>
>   \break
>   c''2~ c''\!
> }
>
>
> If you're collecting the hairpins for processing later, you could find the
> timings of beginnings and endings through the columns at their bounds:
>
> myEngraver =
> #(lambda (context)
>    (let ((hairpins '()))
>      (make-engraver
>       (acknowledgers
>        ((hairpin-interface engraver grob source-engraver)
>         (set! hairpins (cons grob hairpins))))
>
>       ((finalize trans)
>        (for-each
>         (lambda (hp)
>           (format #t "BEGINNING ~a END: ~a~%"
>


Not that you will use this method, but the following two lines ought to be


            (grob::when (ly:spanner-bound hp LEFT))
            (grob::when (ly:spanner-bound hp RIGHT))))

            (grob::when (ly:item-get-column (ly:spanner-bound hp LEFT)))
>             (grob::when (ly:item-get-column (ly:spanner-bound hp RIGHT)))))
>         hairpins))
>       )))
>
>
DN
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to