A key is a component of a musical instrument, the purpose and function of which depends on the instrument. However, the term is most often used in the context of keyboard instruments, in which case it refers to the exterior part of the instrument that the player physically interacts in the process of sound production.
On instruments equipped with tuning machines such as guitars or mandolins, a key is part of a tuning machine. It is a worm gear with a key shaped end used to turn a cog, which, in turn, is attached to a post which winds the string. The key is used to make pitch adjustments to a string.
With other instruments, zithers and drums, for example, a key is essentially a small wrench used to turn a tuning machine or lug.
On woodwind instruments such as a flute or saxophone, keys are finger operated levers used to open or close tone holes, the operation of which effectively shortens or lengthens the resonating tube of the instrument. By doing so, the player is able to physically manipulate the range of resonating sound frequencies capable of being produced by the tubes that has been altered into various “effective” lengths, based on specific key configurations. The keys on the keyboard of a pipe organ also open and close various mechanical valves. However, rather than directed influencing the paths the airflow takes within the same tube, the configuration of these valves instead determines through which of the numerous separate organ pipes, each of which tuned for a specific note, the air stream flows through. The keys of an accordion direct the air flow from manually operated bellows across various tuned vibrating reeds.
On other keyboard instruments, a key may be a lever which mechanically triggers a hammer to strike a group of strings, as on a piano, or an electric switch which energizes an audio oscillator as on an electronic organ or a synthesizer.