[Top][All Lists]

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

Re: Non-standard octave-limited key signature does not persist

From: Neil Puttock
Subject: Re: Non-standard octave-limited key signature does not persist
Date: Thu, 11 Dec 2008 17:23:50 +0000

2008/12/11 Trevor Daniels <address@hidden>:

> In this example the F# and Ab are notated correctly only in bar 1.  A Bb
> does not
> appear until bar 3, when it is notated correctly, but is incorrect in bar 4.
> \relative c' {
>  \set Staff.keySignature = #`(((0 . 3) . ,SHARP)
>                              ((0 . 5) . ,FLAT)
>                              ((0 . 6) . ,FLAT))
>  fis fis aes aes
>  fis fis aes aes
>  fis aes bes bes
>  fis aes bes bes
> }

Unfortunately, an alist entry in keySignature of the form ((octave .
pitch) . alteration) is swallowed up by localKeySignature since it
looks the same as a generated entry (which must include the octave,
otherwise most accidental rules would break).  Consider this
simplified version of your snippet:

\relative c' {
  \set Staff.keySignature = #`(((0 . 3) . ,SHARP))

In the first bar, localKeySignature is identical to keySignature:

(((0 . 3) . 1/2))

By the time the Accidental_engraver checks whether the fis in the
second bar needs an accidental, the time signature entry in
localKeySignature has disappeared, replaced by the entry automatically
generated for the second note:

(((0 . 3) 1/2 1 . #<Mom 1>))

As you can see, the key signature has the same alist key (0 . 3) as
the new entry and is replaced by the new value.  Compare this with the
output output using octaveless keySignature entries, where the key
signature is present at the end of the list:

(((0 . 3) 1/2 1 . #<Mom 1>) (3 . 1/2))

The simplest way around this would be to pass both localKeySignature
and keySignature to check_pitch_against_signature () and use both when
extracting from_key_signature; currently this code only uses the pitch
as an alist key, since it assumes that any entry of the form (pitch .
alteration) comes from the key signature.

SCM from_key_signature = ly_assoc_get (scm_from_int (n),
key_signature, SCM_BOOL_F);

A patch is on its way. :)


reply via email to

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