Am 13. April 2015 04:05:56 MESZ, schrieb Urs Liska <u...@openlilylib.org>: >Hi David, > >thank you for your head start. >See my attached results. I'd be grateful for any comments to improve >the >coding.
In particular I am quite sure that the nesting of (list (list is quite clumsy and maybe even "wrong". >One basic question is if it will be possible to extend it with other >types (dynamic text spanners etc.) without having to write another >engraver with duplicating code. >And unfortunately the attached file compiles, while applying it to a >real-world file I get an error: > >In procedure ly:grob-set-property! in expression (ly:grob-set-property! > >(car equal-hairpins) (quote color) ...): > >/home/uliska/git/bfsc/fried/das-trunkne-lied/library/ly/to-lilylib/remove-double-hairpins-engraver.ily:91:19 > ><1>: Wrong type argument in position 1 (expecting Grob): (#<Grob >Hairpin > > #<Grob Hairpin >) > > >Looks quite similar to the problems I had during development, but I >don't see yet what is actually wrong with it. > >Best >Urs > >Am 11.04.2015 um 16:07 schrieb David Nalesnik: >> >> >> On Sat, Apr 11, 2015 at 9:01 AM, David Nalesnik >> <david.nales...@gmail.com <mailto:david.nales...@gmail.com>> wrote: >> >> Hi Urs, >> >> On Sat, Apr 11, 2015 at 3:31 AM, Urs Liska <u...@openlilylib.org >> <mailto: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 _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user