lilypond-user
[Top][All Lists]
Advanced

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

Re: Suppress NoteNames output on ties ?


From: Gilles THIBAULT
Subject: Re: Suppress NoteNames output on ties ?
Date: Sun, 20 Mar 2011 21:53:22 +0100

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" |
}

Oups, yes i see the problem. Some event like 'LineBreakEvent are integrated an EventCHord elements list

The failures are fixed if I change
(cond ((and prev-was-tie? (eq? name 'EventChord))

I have not tested but it propably list to errors messages if you use several several notes for each chord.
Here is an other workaround (well the code becomes a bit heavier)

%%%%%%%%%%%%%%%%%%%%%%ù
tiedNoteToSkip = #(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)
                 (pair? elts)
                 (ly:duration? (ly:music-property (car elts) 'duration)))
               (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)))

mymusic = { c'4 c' ~ \noBreak c'2 }

\score {
<<
\new Voice  \mymusic
\context NoteNames  \tiedNoteToSkip \mymusic
>>
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Gilles




reply via email to

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