In music, a fugue (/fju?g/ FEWG) is a contrapuntal compositional technique in two or more voices, built on a subject (a musical theme) that is introduced at the beginning in imitation (repetition at different pitches) and which recurs frequently in the course of the composition. A fugue usually has three sections: an exposition, a development, and a final entry that contains the return of the subject in the fugues tonic key. Some fugues have a recapitulation. In the Middle Ages, the term was widely used to denote any works in canonic style; by the Renaissance, it had come to denote specifically imitative works. Since the 17th century, the term fugue has described what is commonly regarded as the most fully developed procedure of imitative counterpoint. Most fugues open with a short main theme, the subject, which then sounds successively in each voice (after the first voice is finished stating the subject, a second voice repeats the subject at a different pitch, and other voices repeat in the same way); when each voice has entered, the exposition is complete. This is often followed by a connecting passage, or episode, developed from previously heard material; further "entries" of the subject then are heard in related keys. Episodes (if applicable) and entries are usually alternated until the "final entry" of the subject, by which point the music has returned to the opening key, or tonic, which is often followed by closing material, the coda. In this sense, a fugue is a style of composition, rather than a fixed structure. The form evolved during the 18th century from several earlier types of contrapuntal compositions, such as imitative ricercars, capriccios, canzonas, and fantasias. The famous fugue composer Johann Sebastian Bach (1685–1750) shaped his own works after those of Johann Jakob Froberger (1616–1667), Johann Pachelbel (1653–1706), Girolamo Frescobaldi (1583–1643), Dieterich Buxtehude (c. 1637–1707) and others. With the decline of sophisticated styles at the end of the baroque period, the fugues central role waned, eventually giving way as sonata form and the symphony orchestra rose to a dominant position. Nevertheless, composers continued to write and study fugues for various purposes; they appear in the works of Wolfgang Amadeus Mozart (1756–1791) and Ludwig van Beethoven (1770–1827), as well as modern composers such as Dmitri Shostakovich (1906–1975).