A barrel organ is a mechanical musical instrument consisting of bellows and one or more ranks of pipes housed in a case, usually of wood, and often highly decorated. The basic principle is the same as a traditional pipe organ, but rather than being played by an organist, the barrel organ is activated either by a person turning a crank, or by clockwork driven by weights or springs. The pieces of music are encoded onto wooden barrels (or cylinders), which are analogous to the keyboard of the traditional pipe organ.
The pieces of music (or tunes) are encoded onto the barrel using metal pins and staples. Pins are used for short notes, and staples of varying lengths for longer notes. Each barrel usually carried several different tunes. Pinning such barrels was something of an art form, and the quality of the music produced by a barrel organ is largely a function of the quality of its pinning. The size of the barrel will depend on the number of notes in the organ and the length of the tune to be played. The more notes, the longer the barrel. The longer the tune, the greater the diameter. Since the music is hard-coded onto the barrel, the only way for a barrel organ to play a different set of tunes is to replace the barrel with another one. While not a difficult operation, barrels are unwieldy and expensive.