This article is about keyboards on musical instruments. For instruments referred to as "keyboards", see Keyboard instrument.
A musical keyboard is the set of adjacent depressible levers or keys on a musical instrument. Keyboards typically contain keys for playing the twelve notes of the Western musical scale, with a combination of larger, longer keys and smaller, shorter keys that repeats at the interval of an octave. Depressing a key on the keyboard causes the instrument to produce sounds, either by mechanically striking a string or tine (piano, electric piano, clavichord), plucking a string (harpsichord), causing air to flow through a pipe (organ), striking a bell (carillon), or, on electric and electronic keyboards, completing a circuit (Hammond organ, digital piano, synthesizer). Since the most commonly encountered keyboard instrument is the piano, the keyboard layout is often referred to as the "piano keyboard".
The twelve notes of the Western musical scale are laid out with the lowest note on the left; The longer keys (for the seven "natural" notes of the C majorscale: C, D, E, F, G, A, B) jut forward. Because these keys were traditionally covered in ivory they are often called the white notes or white keys. The keys for the remaining five notes—which are not part of the C major scale—(i.e., C♯/D♭, D♯/E♭, F♯/G♭, G♯/A♭, A♯/B♭) (see Sharp and Flat) are raised and shorter. Because these keys receive less wear, they are often made of black colored wood and called the black notes or black keys. The pattern repeats at the interval of an octave.
The arrangement of longer keys for C major with intervening, shorter keys for the intermediate semitones dates to the 15th century. Many keyboard instruments dating from before the nineteenth century, such as harpsichords and pipe organs, have a keyboard with the colours of the keys reversed: the white notes are made of ebony and the black notes are covered with softer white bone. A few electric and electronic instruments from the 1960s and subsequent decades have also done this; Vox's electronic organs of the 1960s, Farfisa's FAST portable organs, Hohner's Clavinet L, one version of Korg's Poly-800 synthesizer and Roland's digital harpsichords.
Some 1960s electronic organs used reverse colors or gray sharps or naturals to indicate the lower part(s) of a split keyboard: one divided into two parts, each of which produces a different registration or sound. Such keyboards allow melody and contrasting accompaniment to be played without the expense of a second manual and were a regular feature in Spanish and some English organs of the renaissance and baroque. The break was between middle C and C-sharp, or outside of Iberia between B and C. Broken keyboards reappeared in 1842 with the harmonium, the split occurring at E4/F4.
The reverse-colored keys on Hammond organs such as the B3, C3 and A100 are latch-style radio buttons for selecting pre-set sounds.
Size and historical variation
The chromatic compass of keyboard instruments has tended to increase. Harpsichords often extended over five octaves (61+ keys) in the 18th century, while most pianos manufactured since about 1870 have 88 keys. Some modern pianos have even more notes (a Bösendorfer 225 has 92 and a Bösendorfer 290 "Imperial" has 97 keys). While modern synthesizer keyboards commonly have either 61, 76 or 88 keys, small MIDI controllers are available with 25 notes. (Digital systems allow shifting octaves, pitch, and "splitting" ranges dynamically, reducing the need for dedicated keys.) Organs normally have 61 keys per manual, though some spinet models have 44 or 49. An organ pedalboard is a keyboard with long pedals that are played by the organist's feet. Pedalboards vary in size from 12 to 32 notes.
In a typical keyboard layout, black note keys have uniform width, and white note keys have uniform width and uniform spacing at the front of the keyboard. In the larger gaps between the black keys, the width of the natural notes C, D and E differ slightly from the width of keys F, G, A and B. This allows close to uniform spacing of 12 keys per octave while maintaining uniformity of seven "natural" keys per octave.
Over the last three hundred years, the octave span distance found on historical keyboard instruments (organs, virginals, clavichords, harpsichords, and pianos) has ranged from as little as 125 mm to as much as 170 mm. Modern piano keyboards ordinarily have an octave span of 164–165 mm; resulting in the width of black keys averaging 13.7 mm and white keys about 23.5 mm wide at the base, disregarding space between keys. Several reduced-size standards have been proposed and marketed. A 15/16 size (152 mm octave span) and the 7/8 DS Standard (140 mm octave span) keyboard developed by Christopher Donison in the 1970s and developed and marketed by Steinbuhler & Company. U.S. pianist Hannah Reimann has promoted piano keyboards with narrower octave spans and has a U.S. patent on the apparatus and methods for modifying existing pianos to provide interchangeable keyboards of different sizes.
There have been variations in the design of the keyboard to address technical and musical issues. The earliest designs of keyboards were based heavily on the notes used in Gregorian chant (the seven diatonic notes plus B-flat) and as such would often include B♭ and B♮ both as diatonic "white notes," with the B♮ at the leftmost side of the keyboard and the B♭ at the rightmost. Thus, an octave would have eight "white keys" and only four "black keys." The emphasis on these eight notes would continue for a few centuries after the "seven and five" system was adopted, in the form of the short octave: the eight aforementioned notes were arranged at the leftmost side of the keyboard, compressed in the keys between E and C (at the time, accidentals that low were very uncommon and thus not needed). During the sixteenth century, when instruments were often tuned in meantone temperament, some harpsichords were constructed with the G♯ and E♭ keys split into two. One portion of the G♯ key operated a string tuned to G♯ and the other operated a string tuned to A♭, similarly one portion of the E♭ key operated a string tuned to E♭, the other portion operating a string tuned to D♯. This type of keyboard layout, known as the enharmonic keyboard, extended the flexibility of the harpsichord, enabling composers to write keyboard music calling for harmonies containing the so-called wolf fifth (G-sharp to E-flat), but without producing aural discomfort in the listeners (see: Split sharp). The "broken octave," a variation of the aforementioned short octave, similarly used split keys to add accidentals left out of the short octave. Other examples of variations in keyboard design include the Jankó keyboard and the chromatic keyboard systems on the chromatic button accordion and bandoneón.
Simpler electronic keyboards have switches under each key. Depressing a key connects a circuit, which triggers tone generation. Most keyboards use a keyboard matrix circuit, in which eight rows and eight columns of wires cross — thus, 16 wires can provide (8x8=) 64 crossings, which the keyboard controller scans to determine which key was pressed. The problem with this system is that it provides only a crude binary on/off signal for each key. Better electronic keyboards employ two sets of switches for each key that are slightly offset. By determining the timing between the activation of the first and second switches, the velocity of a key press can be determined — greatly improving the performance dynamic of a keyboard. The best electronic keyboards have dedicated circuits for each key, providing polyphonic aftertouch.
Advanced electronic keyboards may provide hundreds of key touch levels  and have 88 keys, as most pianos do.
Despite their apparent similarity, keyboard instruments of different types require different techniques. The piano hammer mechanism produces a louder note the faster the key is pressed while the harpsichord's plectrum mechanism does not perceptibly vary the volume of the note with different touch on the keyboard. The pipe organ's volume and timbre are controlled by the flow of air from the bellows and the stops preselected by the player. Players of these instruments therefore use different techniques to color the sound. An arranger keyboard may be preset to produce any of a range of voices as well as percussion and other accompaniments that respond to chords played by the left hand.
Even though the keyboard layout is simple and all notes are easily accessible, playing requires skill. A proficient player has undertaken much training to play accurately and in tempo. Beginners seldom produce a passable rendition of even a simple piece due to lack of technique. The sequences of movements of the player's hands can be very complicated. Problems include wide-spanned chords, which can be difficult for people with small hands, chords requiring unusual hand positions that can initially be uncomfortable, and fast scales, trills and arpeggios.
Playing instruments with velocity sensitive (or dynamic) keyboards (i.e., that respond to varying playing velocity) may require finger independence, so that some fingers play "harder" while others play more softly; controlling touch velocity in this way is a technique often called "voicing" by pianists (though not to be confused by "voicing" done by a piano technician by modifying the hardness of the piano's string-striking hammers). Keyboardists speak of playing harder and softer, or with more or less force. This may accurately describe the player's experience—but in the mechanics of the keyboard, velocity controls musical dynamics. The faster the player depresses the key, the louder the note. Players must learn to coordinate two hands and use them independently. Most music is written for two hands; typically the right hand plays the melody in the treble range, while the left plays an accompaniment of bass notes and chords in the bass range. Examples of music written for the left hand alone include several of Leopold Godowsky's 53 Studies on Chopin's Etudes, Maurice Ravel's Piano Concerto for the Left Hand and Sergei Prokofiev's Piano Concerto No. 4 for the left hand. In music that uses counterpoint technique, both hands play different melodies at the same time.
A number of percussion instruments share the keyboard layout, although they are not keyboard instruments with levers that are depressed to sound the notes. Instead, the performer of instruments such as the xylophone, marimba, vibraphone, and glockenspiel strikes the separate-sounding tone bar of metal or wood for each note using a mallet. These bars are laid out in the same configuration as a common keyboard.
There are some examples of a musical keyboard layout used for non-musical devices. For example, some of the earliest printing telegraph machines used a layout similar to a piano keyboard.
Keyboards with alternative sets of keys
There are some rare variations of keyboards with more or fewer than 12 keys per octave, mostly used in microtonal music, after the discoveries and theoretical developments of musician and inventor Julián Carrillo (1875–1965).
Some free-reed instrument keyboards such as accordions and Indian harmoniums include microtones. Electronic music pioneer Pauline Oliveros plays one of these. Egyptian belly-dance musicians like Hassam Ramzy use custom-tuned accordions so they can play traditional scales. The small Garmon accordion played in the Music of Azerbaijan sometimes has keys that can play microtones when a "shift" key is pressed.
- Bond, Ann (1997). A Guide to the Harpsichord. Amadeus Press. ISBN 1-57467-063-8.
- KeyLess Online, Western notes & Carnatic swaras laid out on the keyboard
- A Piano Keyboard Layout by Piano Play It, a full layout of the piano keyboard with a piano tutorial
- Keyboard Magazine, selections from magazine, along with multimedia examples
- Electronic Keyboard News, news and reviews of keyboards, synthesizers and synth modules
- Keyboard Chords, chords for keyboards
- MathPages, mathematical discussion of the distribution of the keys
- The Keyboard of a Harpsichord
- Balanced Keyboard, A modified symmetrical layout of the standard keyboard. The website shows how to build your own.
- ^An exception is the hurdy-gurdy, whose crank is turned with the left hand.
- ^Reimann, Hannah: Patent claim #6,020,549, August 10, 1998
- ^Dave Dribin: "Keyboard Matrix Help", (June 24, 2000)
- ^Digital piano specs (100 pressure levels specified)
- ^George M. Phelps, U.S. Patent 0,026,003Improvement in Telegraphic Machines issued November 1, 1859
- ^The House Printing Telegraph (image)
Keyboard expression—often shortened to expression—is the ability of a keyboard musical instrument to respond to change tone or other qualities of the sound in response to velocity, pressure or other variations in how the performer depresses the keys of the musical keyboard. Expression types include:
- Velocity sensitivity—how fast or hard the keys are pressed
- Aftertouch, or pressure sensitivity—amount of force on held-down key
- Displacement sensitivity—distance that a key is pressed down
Keyboard instruments offer a range of expression types. Acoustic pianos, such as upright and grand pianos, are velocity-sensitive—the faster the key strike, the harder the hammer hits the strings. Baroque-style clavichords and professional synthesizers are after-touch-sensitive—applied force on the key after the initial strike produces effects such as vibrato or swells in volume. Tracker pipe organs and electronic organs are displacement-sensitive—partly depressing a key produces a quieter tone.
The piano, being velocity-sensitive, responds to the speed of the key-press in how fast the hammers strike the strings, which in turn changes the tone and volume of the sound. Several piano predecessors, such as the harpsichord, were not velocity-sensitive like the piano. Some confuse pressure-sensitive with velocity-sensitive. To avoid this confusion, pressure sensitivity is often, perhaps usually, called aftertouch. The MIDI standard supports both velocity and aftertouch.
In general, only high-end electronic keyboards implement true pressure sensitivity, while most professional-quality electronic keyboards support velocity sensitivity. Most inexpensive electronic keyboards, such as toy electronic keyboards and basic learning keyboards manufactured by Casio and Yamaha in the US$100 price range, do not have velocity sensitivity, but instead a manually-adjusted note volume.
Some manufacturers' advertising incorrectly uses the term "touch-sensitive" for velocity sensitivity. Even on a "touch-sensitive" keyboard, not all digital instrument sounds may incorporate velocity sensitivity into the sound's envelope. For example, the digital pipe organ sound often has no velocity-sensitive effects, in imitation of the real instrument. The manufacturers and distributors of some[which?] inferior keyboards incorrectly describe their purely velocity-sensitive instruments as pressure-sensitive.
Pressure sensitivity or aftertouch
The clavichord and some electronic keyboards also respond to the amount of force applied after initial impact—they are pressure-sensitive. This can be used by a skilled clavichord player to slightly correct the intonation of the notes when playing on a clavichord, and/or to play with a form of vibrato known as bebung. Unlike in a piano action, the tangent does not rebound from the string; rather, it stays in contact with the string as long as the key is held, acting as both the nut and as the initiator of sound. The volume of the note can be changed by striking harder or softer, and the pitch can also be affected by varying the force of the tangent against the string. When the key is released, the tangent loses contact with the string and the vibration of the string is silenced by strips of damping cloth.
By applying a rocking pressure up and down the key with the finger, a performer can slightly alter the vibrating length of the string itself, producing a vibrato quality known as bebung. While the vibrato on fretless string instruments such as the violin typically oscillates in pitch both above and below the nominal note, clavichord bebung only produce pitches above the note. Sheet music does not often explicitly indicate bebung. Composers generally let players apply bebung at their discretion. When sheet music does indicate bebung, it appears as a series of dots above or below a note; the number of dots indicates the number of finger movements.
On electronic keyboards and synthesizers, pressure sensitivity is usually called aftertouch. The vast majority of such instruments use only channel aftertouch: that is, one level of pressure is reported across the entire keyboard, which affects either all notes pressed (even ones not being pushed into aftertouch) or a subset of the active notes in some instruments that allow this level of control. A minority of instruments have polyphonic aftertouch, in which each individual note has its own sensor for pressure that enables differing usage of aftertouch for different notes. Aftertouch sensors detect whether the musician is continuing to exert pressure after the initial strike of the key. The aftertouch feature allows keyboard players to change the tone or sound of a note after it is struck, the way that singers, wind players, or bowed instrument players can do. On some keyboards, sounds or synth voices have a preset pressure sensitivity effect, such as a swell in volume (mimicking a popular idiomatic style of vocal performance with melodies) or the addition of vibrato. On some keyboards - a good example of such an instrument being Yamaha's richly-programmable cult-status synthesiser-workstation, the Yamaha EX5 - the player can select the effects to which aftertouch applies. This allows a performer to custom-tailor the effect that they desire. It may also facilitate the imitation of various non-keyboard instruments. For example, a keyboardist who wishes to imitate the sound of a heavy metal guitar solo could use a distortion guitar sound, and then set the aftertouch feature to apply a pitch bend to the note.
A third form of sensitivity is displacement sensitivity. Displacement-sensitive keyboards are often found on organs. Most mechanical organs, and some electrically actuated organs, are displacement-sensitive, i.e., when a key is partially pressed, the corresponding note (pipe, reed, etc.) in the organ produces a different, quieter sound than when the key is fully pressed. In some organs, the pitch or tone colour may also be altered. Small tabletop organs and accordions often respond similarly, with sound output increasing as keys are pressed further down. Even the small circular accompaniment ("one button chord") keys found on accordions and on some organs exhibit this phenomenon. Accordingly, some electrically actuated organs have retained this form of keyboard expression:
A 34-rank organ in the Swiss village of Ursy is equipped with hi-tech features from Syncordia, including what some erroneously claim is the first non-mechanical action that directly controls the opening of a pipe organ's pallets in direct proportion to key movement—ostensibly combining the virtues of electric action with the intimate control of tracker action. However, Vincent Willis' 1884 patent Floating Lever pneumatic action also had this capability. 
Other more sophisticated sensitivity forms are common in organ keyboards. Both the Pratt Reed and Kimber Allen 61-key (5-octave) keyboards have provision for up to nine rails so they can sense various amounts of displacement, as well as velocity in various regimes of distance from the top to the bottom of the key travel of each key. Some modern instruments, such as the Continuum, a MIDI controller for keyboards, have extremely sophisticated human interface schemes that provide dynamic control in three dimensions. In principle, displacement can be differentiated to get velocity, but the converse is not entirely practical, without some amount of baseline drift. Thus a displacement sensing keyboard may be better at providing both organ and piano feel in a single keyboard controller.
Most digital pianos implement a displacement-sensitive keyboard, in order to simulate the sound-stopping length of the note after the key is released. On an acoustic piano, releasing a key after being partially depressed will result in a quieter, shorter sound stopping. The displacement-sensitive keyboard on a digital piano were designed to simulate the similar effect.
Acoustic pianos have expression pedals that change the response or tone of the instrument.
On small upright pianos, the soft pedal moves the hammers closer to the strings. On grand pianos, the soft pedal moves the hammers sideways so each hammer strikes only part of its string group.
The sustain pedal prevents individual key dampers from lifting when the player releases the key. All notes played with the sustain pedal ring until the player releases the sustain pedal (or until the note completely decays). With the dampers not applied, octave, fifth, and other overtones vibrate sympathetically, producing a richer sound. Most electronic keyboards also have a sustain pedal that holds notes and chords, but only high-end digital keyboards reproduce the sympathetic vibration effect.
Electromechanical keyboards and electronic keyboards offer a range of other expression devices. Electromechanical keyboards such as the Hammond organ offer additional means of keyboard expression by modifying the starting, stopping, or speed of the rotating Leslie speaker or by engaging a variety of vibrato or chorus effects. Digital "clones" of Hammond organs offer recreations of these effects, along with other effects. The VK-9 digital organ, for example, offers a proximity-sensitive detector that triggers the Leslie speaker, a ring modulator, or other effects.
Some effect pedals used with electromechanical keyboards such as the Fender Rhodes electric piano or digital keyboards respond to loudness and so, indirectly, to key velocity. Examples include overdrive pedals, which produce a clean sound for softer notes, and a distortion effect for louder notes—and fixed wah-wah pedals that filter the audio signal based on loudness.