lilypond-devel
[Top][All Lists]
Advanced

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

Re: AccidentalCautionary in NullVoice


From: Dan Eble
Subject: Re: AccidentalCautionary in NullVoice
Date: Sat, 23 Aug 2014 16:16:22 -0400

On Aug 23, 2014, at 08:03 , Dan Eble <address@hidden> wrote:

>> I’ve gotten really close by interposing a context between Staff and Voice 
>> and putting the Accidental_engraver there.  This generates a lot of 
>> warnings, though.
> 
> No good.  When I tried it on a real piece, it was immediately obvious that 
> there are too many note heads.

I think I’m really close (again!) to getting modern-voice-cautionary 
accidentals with combined-part stems by defining a new accidental style that 
disregards the part combiner’s voices.  Unfortunately, the solution is thwarted 
by behavior that seems to disagree with the internals reference. 

  autoCautionaries (list)

    List similar to autoAccidentals, but it controls cautionary
    accidentals rather than normal ones. Both lists are tried, and the
    one giving the most accidentals wins. In case of draw, a normal
    accidental is typeset.

It appears that in some cases both a cautionary and a normal accidental are 
typeset.  If just the normal accidentals were typeset, the output of the 
following example would be exactly what I want.  Is this a bug?

Thanks,
— 
Dan

\version "2.18.0"
\language "english"

soprano = \relative c' { cs4-\mf e g e8( f) | cs4 cs c'2 |
                         cs4 cs c2 | c4 g c2 | c4 b8( c) d4 c | }
alto = \relative c' { a4-\f cs ef cs | a a'' c,,8 d( e) f |
                      a'4 a c,,2 | c4. bf8 c2 | g'4 g a g | }
words = \lyricmode { _ _ _ _ _ _ _ _ _ _ Glo -- ri -- a }

\layout {
  \context {
    \Staff
    \accidentalStyle modern-voice-cautionary
  }
}

AddDynamicEngravers = \with {
    \consists "Dynamic_engraver"
    \consists "Dynamic_align_engraver"
}

RemoveDynamicEngravers = \with {
    \remove "Dynamic_engraver"
    \remove "Dynamic_align_engraver"
}

UndoOmitAccidentals = \with {
  \remove "Pitch_squash_engraver"
  \undo \omit Accidental
  \undo \omit AccidentalCautionary
}

colorAccidentals =
#(define-music-function
  (parser location color)
  (color?)
#{
  \override Accidental.color = #color
  \override AccidentalCautionary.color = #color
  \override AccidentalSuggestion.color = #color
  \override Accidental.layer = #2
  \override AccidentalCautionary.layer = #2
  \override AccidentalSuggestion.layer = #2
#})

\score {
  \new Staff <<
    \set Staff.instrumentName = "<< \\\\ >>"
    \dynamicUp \soprano
    \\
    \dynamicDown \alto
  >>
}

\score {
  \new Staff <<
    \set Staff.instrumentName = "partcombine"
    \partcombine \soprano \alto
  >>
}

#(define-public ((make-limited-accidental-rule required-context-name octaveness 
laziness) context pitch barnum measurepos)
  (if (equal? required-context-name (ly:context-name context))
   ((make-accidental-rule octaveness laziness) context pitch barnum measurepos)
   (cons #f #f)))

\score {
  <<
    \new Staff <<
      \set Staff.instrumentName = "NullVoice"

      #(set-accidentals-properties #f
        `(Voice ,(make-limited-accidental-rule 'NullVoice 'same-octave 0))
        `(Voice ,(make-limited-accidental-rule 'NullVoice 'any-octave 0)
                ,(make-limited-accidental-rule 'NullVoice 'same-octave 1)
          Staff ,(make-accidental-rule 'same-octave 0)
                ,(make-accidental-rule 'any-octave 0)
                ,(make-accidental-rule 'same-octave 1))
        'Staff)

      \new Voice = "one" \with { \RemoveDynamicEngravers } {}
      \new Voice = "shared" \with { \RemoveDynamicEngravers } {}
      \new Voice = "two" \with { \RemoveDynamicEngravers } {}
      \partcombine \soprano \alto

      \new NullVoice = "soprano" \with {
        \UndoOmitAccidentals
        \colorAccidentals #red
        \AddDynamicEngravers    
        \dynamicUp
      } {
        \soprano
      }

      \new NullVoice = "alto" \with {
        \UndoOmitAccidentals
        \colorAccidentals #blue
        \AddDynamicEngravers
        \dynamicDown
      } {
        \alto
      }

      \new Lyrics { \lyricsto "soprano" \words }
    >>
  >>
}




reply via email to

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