Next: , Up: Piano music



4.10.1 Automatic staff changes

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

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

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

The autochanger switches on basis of pitch (central 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 Staff \context Voice = VA << \relative c' {
            g4 a  b c d r4 a g } >> }
       \context Staff = "down" {
            \clef bass
            s1*2
     } >> }

[picture of music]

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

See also

AutoChangeMusic (lilypond-internals).

Bugs

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

This page is for LilyPond-2.0.3 (stable-branch).
Report errors to <bug-lilypond@gnu.org>.