|
From: | Jay Vara |
Subject: | Re: Thanks to David Nalesnik and Jan-Peter Voigt |
Date: | Sun, 28 Sep 2014 23:46:36 +0100 |
\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
}
}
}
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))IThis makes my head hurt, and my reasoning may need straightening out...Taking a shorter example:meter = #'((3 4) (2 4))used withmusic = {\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.
[Prev in Thread] | Current Thread | [Next in Thread] |