[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suppress NoteNames output on ties ?
From: |
Michael Ellis |
Subject: |
Re: Suppress NoteNames output on ties ? |
Date: |
Sun, 20 Mar 2011 15:19:14 -0400 |
On Sun, Mar 20, 2011 at 2:53 PM, Michael Ellis
<address@hidden> wrote:
> On Sun, Mar 20, 2011 at 9:42 AM, Gilles THIBAULT
> <address@hidden> 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
- Suppress NoteNames output on ties ?, Michael Ellis, 2011/03/17
- Re: Suppress NoteNames output on ties ?, Michael Ellis, 2011/03/18
- Re: Suppress NoteNames output on ties ?, Janek Warchoł, 2011/03/19
- Re: Suppress NoteNames output on ties ?, Gilles THIBAULT, 2011/03/20
- Re: Suppress NoteNames output on ties ?, Xavier Scheuer, 2011/03/20
- Re: Suppress NoteNames output on ties ?, Gilles THIBAULT, 2011/03/20
- Re: Suppress NoteNames output on ties ?, Michael Ellis, 2011/03/20
- Re: Suppress NoteNames output on ties ?,
Michael Ellis <=
- Re: Suppress NoteNames output on ties ?, Gilles THIBAULT, 2011/03/20
- Re: Suppress NoteNames output on ties ?, Gilles THIBAULT, 2011/03/20
- Re: Suppress NoteNames output on ties ?, Gilles THIBAULT, 2011/03/21
- Re: Suppress NoteNames output on ties ?, Marc Mouries, 2011/03/21
- Re: Suppress NoteNames output on ties ?, Carl Sorensen, 2011/03/21