[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Timing of events in the beginning of bars
From: |
Han-Wen Nienhuys |
Subject: |
Timing of events in the beginning of bars |
Date: |
Wed, 26 May 2004 20:38:06 +0200 |
address@hidden writes:
>
> Does this sound sensible to you developers? If it does I'll add it to the bug
> cvs as a wish.
No, it doesn't sound sensible. suppose you have item A that should be
at grace = -inf and an item B that should be at grace = 0. What do you
do when you get
{ .. B A .. }
B must be processed before A, but A happens earlier.
The grace code works more abstract than what you're describing. The
real problem is as follows. Grace is interpreted at sequential level
(in sequential-iterator.cc). Assume that you have
<<{ c2 \grace e16 c2 }
{ c2 d2 }>>
then, the ds and cs should be aligned. To achieve this, the 1st half
note should start at t = 0, and the second at t = 1/2. Hence, the
grace note should start before t = 1/2, at (t=1/2, grace=-1/16), and
consequently, the 1st c2 in the 1st voice, should also _end_ at
(t=1/2, grace=-1/16). To achieve this, Sequential_iterator maintains a
Grace_fixup: a substitution that says:
Items ending at t=1/2 really end at 1/2, grace=-1/16.
This means that in
{ c2 \bar "|:" \grace e16 c2 }
the "|:" also happens at 1/2,-1/16.
At present, the grace substitution is done per voice. So, in the
example above, in the 2nd voice
{ c2 d2 }
the 2 simply starts at t=1/2, and in
{ c2 \bar "|:" d2 }
the |: happens at t=1/2, which causes all the problems with grace
notes and clefs.
The solution that I see is to insert an implicit
\grace s16
in any voice without a grace, just before any element with non-zero duration
when there is another voice with grace notes. In other words
{ c2 \bar "|:" d2 }
is interpreted as
{ c2 \bar "|:" \grace *as-much-grace-as-any-other-voice*
d2 }
However, I don't see how I can get this to work. Bear in mind that
getting grace notes to work correctly is pretty hard. Getting
{ c2 \grace e16 d2 }
to work is not so hard, but the problem is that it's recursive. In a
construction like
{ {
c2 \bar "|:"
}
<< { \grace e16 d2 }
{ \grace e32 d4 }
>>
}
the c2 should still end at t=1/2,g=-1/16, and the |: should happen
together with the grace notes.
Grace notes seem to be working now, but it was the hardest thing I
ever did in Lily, and I still only understand half of how and why it
works.
--
Han-Wen Nienhuys | address@hidden | http://www.xs4all.nl/~hanwen