In Latin, the word fuga means “to escape”, and listening to the beginning of Contrapunctus V (and as the word “fugue” means in French) one will get the impression that the melody is always flying away, like melodic fragments spread by the wind.
Origins of Fugue are in post-medieval vocal works, and in the Renaissance period (with the composer Giovanni Palestrina for example). This way of composing music developed in the XVIIth century, from its predecessor the Ricercar.
Based on the process of Canon, melodic imitation and motivic sequence, the Fugue is a polyphonic piece which is made of at least 3 independent melodic lines (to a maximum of 6). Note that 3 lines fugues are rather called Sinfonia, and 2 lines fugues Inventio. A short theme appears successively in each line, but the key in which it is played alternates between that of the tonic (at first) and (then) that of the dominant. Remark that this 4th or 5th interval between the tonic and the dominant fit perfectly with the distance between the bass and tenor register, and the alto and soprano. However, the fact that the theme itself is “transposed” or “rewritten” in the dominant key or another neighbor key (and in fact in most cases with some modifications) doesn’t necessarily imply that it got to be harmonized in that key.
Just after the main theme is played, in the same melodic line, a possible second additional theme may appear. And so this second theme is played at the same time as the other melodic line is now playing the main theme in its turn (in the other key). If there is a second theme, it should be possible to play it either above or underneath the main theme, because the soprano is the (only) highest melodic line.
After every line has played the theme, there is an intermediate section in which a melodic fragment of the main theme is used as a motivic sequence. In most cases, this section leads to another key (at first either the relative major key or the dominant key), in which the main theme will be played again in Canon, according to the same principles as the beginning.
The Canon of the theme can be played in several keys, subdominant keys being especially used near the end of the Fugue. Moreover, the main theme may be played in a “close” Canon (a… real Canon), meaning that each melodic line start playing the theme (or a fragment of it) before the previous has completed it. This possibility of a real Canon should be taken into account before the choice of the main theme!
Finally, the Fugue ends by a tonic pedal in the bass line, frequently preceded by a dominant pedal (in the same bass line).
The process of Fugue, imitation and Canon can be used in several musical forms (the so-called Fugato), even if it’s not a real complete Fugue as described above, especially in the Prelude of Baroque Suites.
Fugues can be found in the following forms: in Masses, French overtures, in the middle of the Concerto Grosso, in Cantatas, in the Classic Sonata… It is possible to find Fugues with 2 or 3 main themes…
What is interesting in the process of fugue is that an entire piece can be written from only a 2 measures melody. A short theme brings the entire structure, and so, a strong impression of unity emerges from this music.