2.2.1 Common notation for keyboards

This section discusses notation issues that may arise for most keyboard instruments.


References for keyboards

Keyboard instruments are usually notated with Piano staves. These are two or more normal staves coupled with a brace. The same notation is also used for other keyed instruments. Organ music is normally written with two staves inside a PianoStaff group and third, normal staff for the pedals.

The staves in keyboard music are largely independent, but sometimes voices can cross between the two staves. This section discusses notation techniques particular to keyboard music.

Several common issues in keyboard music are covered elsewhere:

See also

Learning Manual: Real music example, Other uses for tweaks.

Notation Reference: Grouping staves, Instrument names, Collision resolution, Writing music in parallel, Fingering instructions, List of articulations, Grid lines, Ties, Arpeggio, Tremolo repeats.

Internals Reference: PianoStaff.

Snippets: Keyboards.


Changing staff manually

Voices can be switched between staves manually, using the command

\change Staff = staffname

The string staffname is the name of the staff. It switches the current voice from its current staff to the staff called staffname. Typical values for staffname are "up" and "down", or "RH" and "LH".

The staff to which the voice is being switched must exist at the time of the switch. If necessary, staves should be “kept alive”, see Keeping contexts alive.

Cross-staff notes are beamed automatically:

\new PianoStaff <<
  \new Staff = "up" {
    <e' c'>8
    \change Staff = "down"
    g8 fis g
    \change Staff = "up"
    <g'' c''>8
    \change Staff = "down"
    e8 dis e
    \change Staff = "up"
  }
  \new Staff = "down" {
    \clef bass
    % keep staff alive
    s1
  }
>>

[image of music]

If the beaming needs to be tweaked, make any changes to the stem directions first. The beam positions are then measured from the center of the staff that is closest to the beam. For a simple example of beam tweaking, see notation Fixing overlapping notation.

Overlapping notation can result when voices cross staves:

\new PianoStaff <<
  \new Staff = "up" {
    \voiceOne
    % Make space for fingering in the cross-staff voice
    \once\override DynamicLineSpanner #'staff-padding = #3.4
    e''2\p\< d''\>
    c''1\!
  }
  \new Staff = "down" <<
    {
      \clef bass
      s4. e,8\rest g,2\rest
      c1
    } \\ {
      c8\( g c'
      \change Staff = "up"
      e' g' b'-3 a' g'\)
      f'1
    }
  >>
>>

[image of music]

The stem and slur overlap the intervening line of dynamics because automatic collision resolution is suspended for beams, slurs and other spanners that connect notes on different staves, as well as for stems and articulations if their placement is affected by a cross-staff spanner. The resulting collisions must be resolved manually, where necessary, using the methods in Fixing overlapping notation.

See also

Learning Manual: Fixing overlapping notation.

Notation Reference: Stems, Automatic beams, Keeping contexts alive.

Snippets: Keyboards.

Internals Reference: Beam, ContextChange.

Known issues and warnings

Beam collision avoidance does not work for automatic beams that end right before a change in staff. In this case use manual beams.


Changing staff automatically

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

\autochange …music

This will create two staves inside the current staff group (usually a PianoStaff), called "up" and "down". The lower staff will be in the bass clef by default. The autochanger switches on the basis of the pitch (middle C is the turning point), and it looks ahead skipping over rests to switch in advance.

\new PianoStaff {
  \autochange {
    g4 a b c'
    d'4 r a g
  }
}

[image of music]

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

If additional control is needed over the individual staves, they can be created manually with the names "up" and "down". The \autochange command will then switch its voice between the existing staves.

Note: If staves are created manually, they must be named "up" and "down".

For example, staves must be created manually in order to place a key signature in the lower staff:

\new PianoStaff <<
  \new Staff = "up" {
    \new Voice = "melOne" {
      \key g \major
      \autochange \relative c' {
        g8 b a c b d c e
        d8 r fis, g a2
      }
    }
  }
  \new Staff = "down" {
    \key g \major
    \clef bass
  }
>>

[image of music]

See also

Notation Reference: Changing staff manually.

Snippets: Keyboards.

Internals Reference: AutoChangeMusic.

Known issues and warnings

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

Chords will not be split across the staves; they will be assigned to a staff based on the first note named in the chord construct.


Staff-change lines

Whenever a voice switches to another staff, a line connecting the notes can be printed automatically:

\new PianoStaff <<
  \new Staff = "one" {
    \showStaffSwitch
    c1
    \change Staff = "two"
    b2 a
  }
  \new Staff = "two" {
    \clef bass
    s1*2
  }
>>

[image of music]

Predefined commands

\showStaffSwitch, \hideStaffSwitch.

See also

Snippets: Keyboards.

Internals Reference: Note_head_line_engraver, VoiceFollower.


Cross-staff stems

Chords that cross staves may be produced using the Span_stem_engraver. Care must be taken to ensure that automatic beams do not beam the notes on one staff when it’s not required on the other.

\layout {
  \context {
    \PianoStaff
    \consists #Span_stem_engraver
  }
}

{
  \new PianoStaff <<
    \new Staff {
      <b d'>4 r d'16\> e'8. g8 r\!
      e'8 f' g'4 e'2
    }
    \new Staff {
      \clef bass
      \voiceOne
      \autoBeamOff
      \crossStaff { <e g>4 e, g16 a8. c8} d
      \autoBeamOn
      g8 f g4 c2
    }
  >>
}

[image of music]

For the time being, this engraver can not be specified by its name in double quotes, but rather prefixing its name with a hash symbol #, due to the way it is implemented.

Selected Snippets

Indicating cross-staff chords with arpeggio bracket

An arpeggio bracket can indicate that notes on two different staves are to be played with the same hand. In order to do this, the PianoStaff must be set to accept cross-staff arpeggios and the arpeggios must be set to the bracket shape in the PianoStaff context.

(Debussy, Les collines d’Anacapri, m. 65)

\new PianoStaff <<
  \set PianoStaff.connectArpeggios = ##t
  \override PianoStaff.Arpeggio #'stencil = #ly:arpeggio::brew-chord-bracket
  \new Staff {
    \relative c' {
      \key b \major
      \time 6/8
      b8-.(\arpeggio fis'-.\> cis-. e-. gis-. b-.)\!\fermata^\laissezVibrer
      \bar "||"
    }
  }
  \new Staff {
    \relative c' {
      \clef bass
      \key b \major
      <<
        {
          <a e cis>2.\arpeggio
        }
        \\
        {
          <a, e a,>2.
        }
      >>
    }
  }
>>

[image of music]

See also

Snippets: Keyboards.

Internals Reference: Stem.


Other languages: deutsch, español, français, italiano, 日本語.
About automatic language selection.

LilyPond — Notation Reference