This section needs additional citations for verification
. (September 2016)
, librettist of Die Zauberflöte
, shown performing in the role of Papageno. The object on his back is a birdcage; see below.
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. For detailed discussion of sources see Branscombe 1991, as well as Libretto of The Magic Flute.
In composing the opera, Mozart evidently kept in mind the skills of the singers intended for the premiere, which included both virtuoso and ordinary comic actors asked to sing for the occasion. Thus, the vocal lines for Papageno—sung by Schikaneder himself—and Monostatos (Johann Joseph Nouseul) are often stated first in the strings so the singer can find his pitch, and are frequently doubled by instruments. In contrast, Mozart's sister-in-law Josepha Hofer, who premiered the role of the Queen of the Night, evidently needed little such help: this role is famous for its difficulty. In ensembles, Mozart skillfully combined voices of different ability levels.
The vocal ranges of two of the original singers for whom Mozart tailored his music have posed challenges for many singers who have since recreated their roles. Both arias of the Queen of the Night, "O zittre nicht, mein lieber Sohn" and "Der Hölle Rache kocht in meinem Herzen" require high F6, rare in opera. At the low end, the part of Sarastro, premiered by Franz Xaver Gerl, includes a conspicuous F2 in a few locations.