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 09:35:25 +0100


Is it possible to tell the NoteNames engraver to print the name for
only the first note of a sequence of tied notes?

mymusic = { c'4 c' ~ c'2 }
\score {
<<
\new Voice \mymusic
\context NoteNames \mymusic
>>
}


Try that

%%%%%%%%%%%%%%%%%%%
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))
               (set! prev-was-tie? #f)
               (skip-of-length  evt))
           ((eq? name 'TieEvent)
               (set! prev-was-tie? #t)
               evt)
           (else
               (if (ly:music? elt) (ly:music-set-property! evt 'element
                                           (tied-note->skip elt)))
               (if (pair? elts) (ly:music-set-property! evt 'elements
                                          (map tied-note->skip elts)))
               evt))))
(tied-note->skip music)))

mymusic = { c'4 c' ~ c'2 }
\score {
<<
\new Voice \mymusic
\context NoteNames \tiedNoteToSkip \mymusic
>>
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%

Good Week-end.

Gilles




reply via email to

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