On Sun, Mar 20, 2011 at 2:53 PM, Michael Ellis
<michael.f.el...@gmail.com> wrote:
> On Sun, Mar 20, 2011 at 9:42 AM, Gilles THIBAULT
> <gilles.thiba...@free.fr> wrote:
>> #(define-music-function (parser location music) (ly:music?)
>> (let ((prev-was-tie? #f))
>>  (define (tied-note->skip evt)
>>    (let ((elt (ly:music-property evt 'element))
>>          (elts (ly:music-property evt 'elements))
>>          (name (ly:music-property evt 'name)))
>>     (cond ((and prev-was-tie? (eq? name 'EventChord))
>>               (set! prev-was-tie? #f)
>>               (skip-of-length  evt))
>>           ((eq? name 'TieEvent)
>>               (set! prev-was-tie? #t)
>>               #f) ;; all tie events will be deleted
>>           (else
>>               (if (ly:music? elt) (ly:music-set-property! evt 'element
>>                                       (tied-note->skip elt)))
>>               (if (pair? elts) (ly:music-set-property! evt 'elements
>>                                       (filter-map tied-note->skip elts)))
>>               evt))))
>> (tied-note->skip music)))
>
> Thank you, Gilles. This is very nice and works almost perfectly.  I've
> found one case where it isn't yet quite right.
>
> I was copying a part from Bernstein's Chichester Psalms.  In Movement
> I,  there is a section in 7/4 with dashed bars in each measure after
> beat 4.  To save typing, I had created a variable thus:
>
> bdash = { \noBreak \bar "dashed" }
>
> The \noBreak is necessary to prevent system breaks at the dashed bar.
> I noticed that the function was not suppressing the NoteNames output
> for notes tied across the dashed bar lines.  It appears that the
> \noBreak is the culprit.
>
> mymusic = {
>    \time 7/4
>    c'2 c'2 ~ \bar "dashed" c'2.^"ok"  |
>    c'2 c'2 ~ { \noBreak \bar "dashed" } c'2.^"fail" |
>    c'2 c'2 ~ \noBreak  c'2.^"fail" |
> }
>

The failures are fixed if I change

(cond ((and prev-was-tie? (eq? name 'EventChord))

to

(cond ((and prev-was-tie? (eq? name 'NoteEvent))

This seems to work perfectly for single line music without chords.
I'm going to push a little farther and see if I can get it to handle
tied chords correctly.   At present the logic cancels itself after the
first note of the chord and the subsequent ones are not suppressed.

Cheers,
Mike

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to