Contrafact refers to the use (possibly also variation) of an existing melody with a new lyrics or an existing chord progression with a new melody. E.g., it was customary from Middle Ages to the Baroque period to subjugate secular songs with sacred texts. Often, contrafacts also serves as parodies. Today, one would speak of a kind of cover version. In Jazz and other modern musical styles, copying a harmony was a way to avoid copyright claims. — For the etymology, cf. counterfeit („fake“).
The concept of adapting music to suit certain purposes has been with us for a long time. The most common form of this activity is simply to set new words to an older tune. A piece constructed in that way is called a contrafactum. Sometimes small adjustments in the rhythm are needed to make the music flow nicely with the new text. A more aggressive approach is to move the tune from one culture into another by adapting the meter and rhythm to suit the new culture.1)
The best known contrafacts in jazz are the many versions of the Blues. The blues has no true „original“ melody: it is an eternally unfinished song form. … A quick look at recent Jazz releases shows that it's more common to cover a song than apply contrafactum. … Where jazz rarely asked permission to borrow even in its popular phase, hip-hop and pop are now constrained by law and economics.2)
The most intelligently composed contrafacts show new ways of creating melody and of subtly re-harmonizing a song which have been highly useful, especially as they are written down and can be studied. The use of new melody lines over familiar chord changes can bring a fresh perspective to improvising over these old tunes, which is desirable. But sometimes that’s also the problem, this perspective is almost entirely harmonic. … The best contrafacts are not counterfeit in any way, but the products of some of the most creative compositional minds music has known.3)
Melody with new text:
Harmony with new melody:
Ich komm aus fremden Landen her
Vom Himmel hoch, da komm ich her (Martin Luther)
Innsbruck, ich muß dich lassen
Nun ruhen alle Wälder (Paul Gerhardt)
I've Got Rhythm (George Gershwin)
Cotton Tail (Duke Ellington)
Embraceable You (George Gershwin)
Quasimodo (Charlie Parker)