lilypond-user
[Top][All Lists]
Advanced

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

printKeyCancellation, a way to never show key cancellations?


From: Paul Morris
Subject: printKeyCancellation, a way to never show key cancellations?
Date: Sun, 2 Dec 2012 12:38:41 -0500

Hi everyone,  I am using
  \set Staff.printKeyCancellation = ##f  
to not show the key cancellation when you change keys[1].  But I found that 
this does not hide the key cancellation when you change back to C major or A 
minor[2] (presumably since that would leave no indication of a key change at 
all).

But I am using non-standard key signatures that make all key cancellations 
unnecessary, so I want to never show them, even when changing to C major / A 
minor.  


JUST A THOUGHT
For greater flexibility, would it make sense for PrintKeyCancellation to have 3 
options instead of 2?

  1. show key cancellations
  2. hide key cancellations, except C major / A minor
  3. hide all key cancellations


OR A DOCUMENTATION SUGGESTION
In any case it would be helpful to mention this C major / A minor exception on 
the page documenting this option.[1]  Something like:

"(Note that setting the Staff context property printKeyCancellation to #f does 
_not_ remove cautionary accidentals when changing to a key with no sharps or 
flats (C major / A minor), since that would leave no indication of a key 
change.)"

Also, the example on that page concludes with: "With these overrides only the 
accidentals before the notes remain to indicate the change of key."  ...which 
is not completely true, unless you add something like "(unless you have just 
changed to C major / A minor)".  


A WORKAROUND FROM THE ARCHIVES (ALMOST)
So I searched the lilypond-user archives and found a few instances where this 
has come up, and a suggested workaround[3]:

  \once \override Staff.KeyCancellation #'stencil = ##f

This works!  ...except it does not seem to work when using a custom key 
signature engraver.  Here is a tiny example that just shows a circle as a 
custom key signature (of course, this is not what I actually use).

\version "2.16.1"

#(define Custom_key_engraver
  (make-engraver
    (acknowledgers
      ((key-signature-interface engraver grob source-engraver)
        (ly:grob-set-property! grob 'stencil (make-circle-stencil .7 .3 #f))))))

music = \relative c' {
  \time 1/4
  \key a \major  
  d4
  \key f \major
  d 

  \set Staff.printKeyCancellation = ##f
  \key a \major  
  d
  \key f \major
  d
  \key a \major
  d 
  \key c \major
  d

  \override Staff.KeyCancellation #'stencil = ##f
  \override CustomStaff.KeyCancellation #'stencil = ##f 
  \key a \major
  d 
  \key c \major
  d
}

\score 
{
  <<
  \new Staff { \music }
  \new Staff \with { \consists \Custom_key_engraver } { \music }
  >>
  \layout { }
} 

The problem can be seen in the last measure where two circles are printed, one 
for the key cancellation and one for the key of C, whereas no key cancellation 
is printed on the standard staff.

I realize I am off in the land of non-standard customizations, but does anyone 
have any suggestions?  Is there a way to get such a custom key signature 
engraver to recognize and follow this override?

Cheers,
-Paul 

[1] See "Visibility of cautionary accidentals" section:
http://www.lilypond.org/doc/v2.16/Documentation/notation/visibility-of-objects#special-considerations

[2] 
\version "2.16.1"
\relative c' {
  \time 1/4
  \key a \major  
  d4
  \key f \major
  d
  \set Staff.printKeyCancellation = ##f
  \key a \major  
  d
  \key f \major
  d
  \key a \major
  d 
  \key c \major
  d
}

[3] http://lists.gnu.org/archive/html/lilypond-user/2012-05/msg00749.html


reply via email to

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