lilypond-user
[Top][All Lists]
Advanced

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

Re: Thanks to David Nalesnik and Jan-Peter Voigt


From: Jay Vara
Subject: Re: Thanks to David Nalesnik and Jan-Peter Voigt
Date: Sun, 28 Sep 2014 23:46:36 +0100

Hi David,

Actually, your logic and reasoning were quite correct. Only, the format statement was before the measureLength was set. I moved the format statement after the context-set-property and it now shows that the engraver does successfully reset the meter.

I think the real problem is with the Completion_heads_engraver (probably a bug). To illustrate this, I added another line of simultaneous music - the only difference is the 4th note f - quarter note in one case and half note in the other.

Here is the what it prints out:

Inline image 1

In the top staff, the second measure should have one quarter note and it has a half note (which should have been split and tied). In the third measure it should have had two quarter notes - it has instead only one quarter note.

In the bottom staff, the second and third measure have the correct number of quarter notes. However, the a2 note in the third measure is split into two a4 notes and tied! 

It is looking more like a Completion_heads_engraver bug. 

Here is the program:

\version "2.18.0"

meter = #'((7 4) (1 4) (2 4))

#(define (to-moment arg)

(ly:make-moment (car arg) (cadr arg)))

alternateTiming =

#(lambda (sig)

(lambda (context)

(let ((last-bnum 0))

`((process-music

. ,(lambda (trans)

(let* ((bnum (ly:context-property context 'currentBarNumber))

(len (length sig)) ; how many terms in compound meter

(pos (modulo bnum len))

(pos (if (= 0 pos) len pos)) ; first bar in pattern, second...

(pos-in-list (1- pos)) ; because elements of list are numbered from 0

(desired-measure-len (to-moment (list-ref sig pos-in-list))))

(ly:context-set-property! context 'measureLength desired-measure-len)

(format #t "bnum = ~a len ~a pos ~a measurelength ~a ~%"

bnum len pos

(ly:context-property context 'measureLength))

(if (= pos-in-list 0)

(begin

(if (> bnum last-bnum)

(ly:context-set-property! context 'whichBar "||"))

(set! last-bnum bnum))))))))))

musicA = {

\compoundMeter #meter

\relative c' {c d e2 f4 g2 a b c4 b2 a g4 f2 e d c d e f g a b c d4}

}

musicB = {

\compoundMeter #meter

\relative c' {c d e2 f g2 a b c4 b2 a g4 f2 e d c d e f g a b c d4}

}

\score {

<<

\new Staff \musicA

\new Staff \musicB

>>

\layout {

\context {

\Score

\consists #(alternateTiming meter)

}

\context {

\Voice

\remove Note_heads_engraver

\remove Rest_engraver

\consists Completion_heads_engraver

\consists Completion_rest_engraver

}

}

}

 

On Sun, Sep 28, 2014 at 10:24 PM, David Nalesnik <address@hidden> wrote:
Hi Jay,


On Sun, Sep 28, 2014 at 3:29 PM, Jay Vara <address@hidden> wrote:
David,

If I use the compound meter which has a (1 4) as one of the moments, it does not work. It seems to be treated as a (2 4). Actually, I think the Completion_heads_engraver may be the one with a problem. I checked by varying the music and for situations where the Completion_heads_engraver did not  have to create a tie in the (1 4) measure, it was OK. 

meter = #'((7 4) (1 4) (2 4))


I
This makes my head hurt, and my reasoning may need straightening out...

Taking a shorter example:

 meter = #'((3 4) (2 4))

used with

music = {
  \compoundMeter #meter
  \relative c' {c1 c4}
}

suggests to me that the problem happens when the engraver doesn't successfully reset the meter.

The log for the above values is:
bnum = 1 measurelength #<Mom 5/4>
bnum = 2 measurelength #<Mom 3/4>
bnum = 2 measurelength #<mom 1/2>
bnum = 3 measurelength #<Mom 1/2>

So measureLength of the first bar is 5/4--that is, the sum of the terms of the compound meter, which is what was assigned by \compoundMeter #meter. The meter has not been reset.

There needs to be a second note within the proposed first division of 3/4 for the new meter to take effect.

meter = #'((3 4) (2 4))

\relative c' {c2 c2}

The log shows that the measureLength of the first measure is reset:

bnum = 1 measurelength #<Mom 5/4>
bnum = 1 measurelength #<Mom 3/4>
bnum = 2 measurelength #<Mom 3/4>
bnum = 2 measurelength #<mom 1/2>

At the moment, my head is too tangled up to do something positive with this information.  I hope it will help, in any case.

--David. 




reply via email to

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