Next: , Up: Piano music



3.10.1 Automatic staff changes

Voices can switch automatically between the top and the bottom staff. The syntax for this is

          \autochange \context Voice { ...music... }
     

The two staves of the piano staff must be named up and down.

A \relative section that is outside of \autochange has no effect on the pitches of music, so, if necessary, put \relative inside \autochange like

          \autochange \relative ... \new Voice ...
     

The autochanger switches on basis of pitch (middle C is the turning point), and it looks ahead skipping over rests to switch in advance. Here is a practical example

     \score { \notes \context PianoStaff <<
       \context Staff = "up" {
         \autochange \new Voice \relative c' {
            g4 a  b c d r4 a g } }
       \context Staff = "down" {
            \clef bass
            s1*2
     } >> }

[image of music]

In this example, spacer rests are used to prevent the bottom staff from terminating too soon.

See also

In this manual: Manual staff switches.

Program reference: AutoChangeMusic.

Bugs

The staff switches often do not end up in optimal places. For high quality output, staff switches should be specified manually.

\autochange cannot be inside \times.

Internally, the \partcombine interprets both arguments as Voices named one and two, and then decides when the parts can be combined. Consequently, if the arguments switch to differently named Voice contexts, the events in those will be ignored.

Read comments on this page, or add one.

This page is for LilyPond-2.2.6 (stable-branch).

Report errors to <bug-lilypond@gnu.org>.