[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grace synchronization
From: |
Reinhold Kainhofer |
Subject: |
Re: grace synchronization |
Date: |
Sat, 27 Aug 2011 01:25:39 +0200 |
User-agent: |
KMail/1.13.6 (Linux/2.6.38-10-generic; KDE/4.7.0; i686; ; ) |
Am Friday, 26. August 2011, 22:59:47 schrieb Hans Aberg:
> My impression is that there is a mixture of code, sometimes putting the
> grace-note before the bar, and sometimes after.
>
> A fix might allow one to fine-tune that.
Actually, lilypond's handling is way more abstract. There are no checks for
grace notes or whether something should come before or after a barline.
Rather, lilypond simply sorts every music event (note, time sig, barline,
etc.) according to when they appear (their "moment"). Events that are between
notes (like a time signature change, a clef, a barline etc. are assigned to
the begin of the moment of the next note. LilyPond then simply goes through
all the events in time order.
Now, the problem with grace notes is that they introduce a second counter ("an
8th before the beat", "a 16th before the beat" etc.). LilyPond still goes
through everything in the correct order, grace notes will simply be handled
before the actual beat.
However, things start going wrong if one voice has a grace note, while another
one does not.
Let us look at the following very simple example (remember, in lilypond the
first beat is numbered 0, not 1!):
-) Voice 1: c4 c4
In voice 1, the first c4 is at the moment 0/4, the second at 1/4. The grace
moment of each is 0 (i.e. no grace, at the beat).
-) Voice 2: c4 \grace e8 c4
In voice 2, the first c4 is again at moment 0/4, grace moment 0. The grace e8
belongs the second quarter, so it's moment is 1/4, but the grace moment is
-1/8 (i.e. 1/8 grace before the second quarter). The c4 is again at 1/4.
-) Voice 3: c4 \clef "bass" c4
c4 is at 0 (grace 0), the clef at 1/4 (grace 0) (same moment as the following
c4), the c4 is at 1/4 (grace 0)
-) Voice 4: c4 \clef "bass" \grace e8 c4
c4 is at 0 (grace 0). As I wrote above, all events between notes are assigned
the time of the next note, which for the \clef is the grace. The grace has a
moment of 1/4 (grace -1/8) like in voice 2. So the clef also has a moment of
1/4 (grace -1/8).
Now, all four voices separately give correct results. However, if you combine
them in one score, you see that in voice 3 you have a clef at moment 1/4
(grace 0), while in voice 4 you have a clef at moment 1/4 (grace -1/8). So,
you have two clef changes at two different times! That's exactly what LilyPond
observes, and in most cases it will really duplicate stuff, once before and
once after the grace.
Cheers,
Reinhold
PS: If you think the problem can easily be solved by simply handling all
events between notes before the next following note rather than together with
the next noted, please think though Voice 3 from above with
-) Voice 5: c4 \grace e8 \clef "bass" c4
--
------------------------------------------------------------------
Reinhold Kainhofer, address@hidden, http://reinhold.kainhofer.com/
* Financial & Actuarial Math., Vienna Univ. of Technology, Austria
* http://www.fam.tuwien.ac.at/, DVR: 0005886
* LilyPond, Music typesetting, http://www.lilypond.org
Re: grace synchronization, Jonathan Wilkes, 2011/08/26
Re: grace synchronization, David Kastrup, 2011/08/26