4

I am using completion heads engraver and completion rest engraver as follows:

\new StaffGroup <<                                                                  
  \override StaffGroup.SystemStartBracket.stencil = ##f                             
  \new Staff \with {                                                                
    \remove "Note_heads_engraver"                                                   
    \consists "Completion_heads_engraver"                                           
    \remove "Rest_engraver"                                                         
    \consists "Completion_rest_engraver"                                            
  } \relative {                                                                     
    g'8 ais8 dis2                                                                   
  }                                                                                 
>>

This produces the following:

enter image description here

For some reason the stem of the tied note is not drawn. How to fix this?

1 Answer 1

4

The problem here is that usually NoteHeads are not created on Staff level, but on Voice level. And this has a good reason: Note head spacing needs to take into account voice information, and Beaming should happen only within one voice. We could just move everything from Voice to Staff

\new StaffGroup <<                                                                  
  \override StaffGroup.SystemStartBracket.stencil = ##f                             
  \new Staff \with {                                                                
    \remove "Note_heads_engraver"                                                   
    \consists "Completion_heads_engraver"                                           
    \remove "Rest_engraver"                                                         
    \consists "Completion_rest_engraver"
  } \relative {                      
    \time 2/4
    g'8 ais8 dis2                                                                   
  }                                                                                 
>>

\layout {
  \context {
    \Voice
    \remove Stem_engraver
    \remove Beam_engraver
    \remove Note_heads_engraver
    \remove Rest_engraver
    \remove Auto_beam_engraver
  }
  \context {
    \Staff
    \consists Stem_engraver
    \consists Beam_engraver
    \consists Note_heads_engraver
    \consists Rest_engraver
    \consists Auto_beam_engraver
  }
}

but you need to be aware that this would create the effect of having only a single voice. Much better would be to do this:

\layout {
  \context {
    \Voice
    \name CompletionVoice
    \alias Voice
    \remove "Note_heads_engraver"                                                   
    \consists "Completion_heads_engraver"                                           
    \remove "Rest_engraver"                                                         
    \consists "Completion_rest_engraver" 
  }
  \context {
    \Staff
    \accepts CompletionVoice
  }
}
                        
\new Staff \with {
  \defaultchild CompletionVoice
} \relative {  
  \time 2/4
  g'8 ais8 dis2                                                                   
}

\new Staff \with {
  \defaultchild CompletionVoice
} \relative {  
  \time 2/4
  <<
    {
      g'8 ais8 dis2 
    } \\
    {
      e,8 fis2 gis8
    }
  >>
}

which defines a new voice-style context CompletionVoice, which contains the necessary changes. Then we can already do \new CompletionVoice ..., and by setting the default child context of a staff from Voice to CompletionVoice we can set this as default behaviour for a whole Staff.

7
  • At this time my \layout block is inside \score. Shall I just replace it ? I got this: warning: cannot create default child context: CompletionVoice
    – kargirwar
    Commented Mar 24, 2023 at 9:55
  • @kargirwar It should not matter whether you specify this in a global layout or in a score layout (although if you need this more often it would make sense to have this in global layout that can be included on toplevel). The warning message you got should happen if you omit that \layout { \context { \Voice \name CompletionVoice ... } } stuff. Maybe you could produce a small failing piece of code so I can check if there is any mistake?
    – Lazy
    Commented Mar 24, 2023 at 10:29
  • @kargirwar And if you need this for only a single voice you can simply do \new Staff \new Voice \with { ... } ....
    – Lazy
    Commented Mar 24, 2023 at 10:40
  • I have just this inside \score <<>>: \new Staff \with { \defaultchild CompletionVoice } \relative { g'8 ais8 dis2 } and the \layout as above and \midi{}
    – kargirwar
    Commented Mar 24, 2023 at 10:57
  • 1
    @kargirwar Hm, the problem here is that \addlyrics appears to add a voice context. So instead of using \addlyrics you’d need to do << \new Staff \new CompletionVoice = "voiceID" ... \new Lyrics \lyricsto "voiceID" ... >>.
    – Lazy
    Commented Mar 25, 2023 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.