[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with Scheme engraver please
From: |
Thomas Morley |
Subject: |
Re: Help with Scheme engraver please |
Date: |
Sun, 4 Sep 2016 08:28:48 +0200 |
2016-09-03 19:29 GMT+02:00 Thomas Morley <address@hidden>:
> I've put some work on it. See attached duration-as-markup-5b-harm.ly
> The general work should be clear from comments and descriptions.
> There's some ugly code in it, although it works so far, wide room for
> improvements still there.
> Nevertheless it works now even in polyphonic.
Please replace the coding in `stop-translation-timestep' with:
((stop-translation-timestep translator)
; (format 1 "~16a: (stop-translation-timestep)\n" (t->m translator))
;; needs to be here, otherwise the moments are not completely collected
(let* (;; The last note-events may start at the same time-step, but
;; may have different durations. Thus we need to select the
;; one with the longest duration, to detemine which
;; duration-string should be used for make-note-markup in tab
(last-notes-amount
(length (car ((@@ (lily) split-at-predicate) equal? m-n))))
(longest-last-ev
(last
(sort
(take ev last-notes-amount)
(lambda (e1 e2)
(ly:duration<?
(ly:event-property e1 'duration)
(ly:event-property e2 'duration))))))
(moments-diffs
(moments-diff-list (reverse m-n)))
(moment-diff-strings
(append
(map
(lambda (x) (moment->duration-string x '()))
moments-diffs)
(list
(ly:duration->string
(ly:event-property longest-last-ev 'duration))))))
(for-each
(lambda (g strg)
(if (string-null? strg)
(ly:grob-suicide! g)
(begin
(ly:grob-set-property! g 'direction UP)
(ly:grob-set-property! g 'text
(markup #:override '(style . mensural) #:note strg UP)))))
(reverse grobs)
(replace-adjacent-duplicates moment-diff-strings '()))))
This will cure a bug with last notes starting at some moment, but with
different durations.
Cheers,
Harm
- Re: Help with Scheme engraver please, Simon Albrecht, 2016/09/01
- Re: Help with Scheme engraver please, Trevor Daniels, 2016/09/02
- Re: Help with Scheme engraver please, Thomas Morley, 2016/09/02
- Re: Help with Scheme engraver please, Trevor Daniels, 2016/09/02
- Re: Help with Scheme engraver please, Thomas Morley, 2016/09/03
- Re: Help with Scheme engraver please,
Thomas Morley <=
- Re: Help with Scheme engraver please, Trevor Daniels, 2016/09/07
- Re: Help with Scheme engraver please, Thomas Morley, 2016/09/09
- Re: Help with Scheme engraver please, Trevor Daniels, 2016/09/17
- Re: Help with Scheme engraver please, Trevor Daniels, 2016/09/19