information:highlighting
Composition

The opera was the culmination of a period of increasing involvement by Mozart with Schikaneder's theatrical troupe, which since 1789 had been the resident company at the Theater auf der Wieden. Mozart was a close friend of one of the singer-composers of the troupe, tenor Benedikt Schack (the first Tamino), and had contributed to the compositions of the troupe, which were often collaboratively written. Mozart's participation increased with his contributions to the 1790 collaborative opera Der Stein der Weisen (The Philosopher's Stone), including the duet ("Nun liebes Weibchen", K. 625/592a) among other passages. Like The Magic Flute, Der Stein der Weisen was a fairy-tale opera and can be considered a kind of precursor; it employed much the same cast in similar roles.

The libretto for The Magic Flute, written by Schikaneder, is thought by scholars to be based on many sources. Some works of literature current in Vienna in Schikaneder's day that may have served as sources include the medieval romance Yvain by Chrétien de Troyes, the novel Life of Sethos by Jean Terrasson, and the essay "On the mysteries of the Egyptians" by Ignaz von Born. The libretto is also a natural continuation of a series of fairy tale operas produced at the time by Schikaneder's troupe, including an adaptation of Sophie Seyler 's Singspiel Oberon as well as Der Stein der Weisen. Especially for the role of Papageno, the libretto draws on the Hanswurst tradition of the Viennese popular theatre. Many scholars also acknowledge an influence of Freemasonry.

The Magic Flute appears to have two references to the music of Antonio Salieri. The first is that the Papageno–Papagena duet is similar to the Cucuzze cavatina in Salieri's Prima la musica e poi le parole. Both are centred around musical-textual playfulness with humorous bird-like utterances of pseudo-Italian words. The Magic Flute also echoes Salieri's music in that Papageno's whistle is based on a motif borrowed from Salieri's Concerto for Clavicembalo in B-flat major.