lilypond-user
[Top][All Lists]
Advanced

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

Re: autoChange creating extra staff


From: Jean Abou Samra
Subject: Re: autoChange creating extra staff
Date: Fri, 17 Mar 2023 19:45:02 +0100
User-agent: Evolution 3.46.4 (3.46.4-1.fc37)

Le vendredi 17 mars 2023 à 11:35 -0700, Alexandre Loomis a écrit :

Hi, I'm running into an issue using \autoChange. I'd like CrossStaff to share the lower staff (and upper with another voice, but that doesn't seem to cause any issues), but it's creating its own.

\version "2.24.0"

CrossStaff = \autoChange f {
  \relative c' {
    c2 c,
  }
}

VoiceTwo = \relative { \clef "bass" c,1 }

\new PianoStaff <<
  \new Staff = "up" {
    \new Voice \CrossStaff
  }
  \new Staff = "down" {
    \new Voice \VoiceTwo
  }

Try

\version "2.24.1"

CrossStaff = \autoChange f {
  \relative c' {
    c2 c,
  }
}

VoiceTwo = \relative { \clef "bass" c,1 }

\new PianoStaff <<
  \new Staff = "up" {
    \new Voice \CrossStaff
  }
  \context Staff = "down" {
    \new Voice \VoiceTwo
  }
>>

As you can see in the examples in the documentation, \autoChange is designed to create two staves at once if not already created. In this case, when \autoChange is seen by LilyPond at the start of the music, there is no "down" staff yet, so it's created, and then you create another one with \new. By using \context instead of new (see Creating and referencing contexts), you insert your \VoiceTwo inside the same context rather than creating a new one.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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