lilypond-user
[Top][All Lists]
Advanced

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

Re: chord with notes of different duration


From: David Kastrup
Subject: Re: chord with notes of different duration
Date: Fri, 08 Oct 2010 16:19:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> "Marc Mouries" <address@hidden> writes:
>
>> Tim Rowe <address@hidden> wrote:
>>>
>>> You've made the whole thing look like a quarter-note to Lilypond, but
>>> persuaded it to show *you* the top note as a half-note. As far as
>>> Lilypond is concerned, it's still a quarter note but printed "wrongly"
>>> so it looks like a half-note. It still only occupies the time duration
>>> of a quarter note, so the bar would be missing a quarter note without
>>> the skip.
>>>
>>> Marc's suggestion is to do it the other way around and make the whole
>>> thing look to Lilypond like a half-note, so the timing is all just
>>> fine, but tell it to print the /lower/ notes "wrongly" so they look
>>> like quarter-notes.
>>
>>> Does that make it clearer?
>>
>>
>> Yes I got it but both ways are like a hack. It would be so much better
>> and logical if lilypond would allow to enter individual duration for
>> each note of a chord.  This would deserve to be added to the doc.
>
> You mean, you'd like something like the following to work:
>
> < <<c4 e4 g2>> >
>
> But actually, something like
> \new Voice { << g'4 c''4 e''2 >> }
> works just fine modulo nonsensical warnings:
>
> /tmp/junk.ly:1:25: warning: adding note head to incompatible stem (type = 4)
> \new Voice { << g'4 c''4 
>                          e''2 >> }
> /tmp/junk.ly:1:25: warning: maybe input should specify polyphonic voices
> \new Voice { << g'4 c''4 
>                          e''2 >> }
>
> Of course, the stems are perfectly compatible.

With regard to the error messages, the following example is actually
even more funny:

\new Voice { << g'\longa c''2 e'' >> << g'\breve c''1 >> }

I think it would be saner if the message specified (type = 1/4), then it
could say (type = 2) for a \breve.

Anyway, the following patch (untested!) would appear to reduce the
warnings to those cases where they actually make sense.  It does not
touch the garbled warning message in the case of breve/longa.

diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc
index d09e3b9..21e8536 100644
--- a/lily/stem-engraver.cc
+++ b/lily/stem-engraver.cc
@@ -134,7 +134,20 @@ Stem_engraver::acknowledge_rhythmic_head (Grob_info gi)
   if (!stem_)
     make_stem (gi);
 
-  if (Stem::duration_log (stem_) != d->duration_log ())
+  int ds = Stem::duration_log (stem_);
+  int dc = d->duration_log ();
+  // Longa, half notes and quarter notes all have compatible stems
+  if (ds < -1 || ds == 2)
+    ds = 4;
+  if (dc < -1 || dc == 2)
+    dc = 4;
+  // whole notes and brevis both have no stems
+  if (ds == -1)
+    ds = 0;
+  if (dc == -1)
+    dc = 0;
+
+  if (ds != dc) 
     {
       // FIXME: 
       gi.event_cause ()->origin ()->warning (_f ("adding note head to 
incompatible stem (type = %d)",



-- 
David Kastrup




reply via email to

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