Mozart’s Melody Machine

Music publishing was a thriving trade during the latter part of the 18th century in Europe. Publishers vied with one another to print the works of the latest “hot” composer. Many of them looked for novel ways to entice new customers into their music shops.

One such ploy was to publish systems that would allow any amateur to compose music without having to know the techniques or rules of composition. The London music publisher Welcker, for example, issued a “Tabular System whereby the Art of Composing Minuets is made so easy that any person, without the least Knowledge of Musick, may compose ten thousand, all different, and in the most pleasing and correct Manner.”

Many of these schemes involved using dice or other randomizers to select musical fragments from an array of choices. Composer Johann Philipp Kirnberger (1721–1783), a former pupil of Johann Sebastian Bach (1685–1750), suggested the use of dice for this purpose in his book The Ever-ready Composer of Polonaises and Minuets, published in 1757. About two decades later, Austrian composer Maximilian Stadler (1748–1833) put together a set of musical bars and tables for generating minuets and trios with the help of dice.

One well-known example of such a scheme is the “Musikalisches Würfelspiel” (Musical Dice Game), first published in 1792 in Berlin. Attributed by the publisher to Wolfgang Amadeus Mozart (1756–1791), it appeared a year after the composer’s death.

The idea was to compose a 16-measure “waltz” by rolling dice to decide which measures to select from a large pool of choices. In the “Musikalisches Würfelspiel,” the measures are numbered from 1 to 176, and the numbers are arranged in two charts, each consisting of 11 rows and eight columns. To select the first measure, a player would roll two dice, subtract 1 from the total, and look up the corresponding row in the first column of the first chart to determine the appropriate measure number. Subsequent rolls of the dice decide which measure to select from each successive column to complete the melody.

The resulting tunes, described by the publisher as waltzes, have a recognizably Mozartean flavor, and the pieces conform to the harmonic and compositional requirements of Viennese minuets of that period.

In principle, the system produces 1116 (or 45,949,729,863,572,161) possible waltzes. “The number is so large that any waltz you generate with the dice and actually play is almost certainly a waltz never heard before,” mathematical games columnist Martin Gardner once remarked in an article about automated music composition. “If you fail to preserve it, it will be a waltz that will probably never be heard again.”

Because many of the bars listed in the eighth column of each chart are identical, the number of different waltzes that the system generates is actually less than 1116. Indeed, the scheme is now sometimes simplified so that a player has only two choices for the eighth and 16th bars, determined by whether the dice toss is odd or even. In this case, there are 1114 x 22 (or 1,518,999,334,332,964) different versions.

Interestingly, because two six-sided dice are used, measures in certain rows of the chart come up more often than those in other rows. For example, because a roll of 7 has the highest probability, measures in row 6 would occur in a melody most often. It isn’t clear whether the original inventor of the scheme was aware of this skewing of the choices. You can overcome this bias and make each choice equally likely by instead using a 12-sided (or dodecahedral) die or some sort of random-number generator.

Most scholars reject the publisher’s claim that Mozart himself devised this particular scheme. Nonetheless, there are indications that Mozart enjoyed mathematical puzzles. He also had a lively sense of humor and was fond of playing around with names. And he had a passion for gambling–a major preoccupation at the time (along with drink) among the men of both Salzburg and Vienna.

One Mozart manuscript actually includes what might be considered a musical game, though not played with dice. On both sides of the sheet, Mozart wrote down long strings of measures, grouped into two-bar melodies, each labeled with a letter of the alphabet and a number (1 or 2). However, other than supplying a “worked-out” example at the end of each page, he gave no instructions on how to proceed.

Hideo Noguchi of Kobe, Japan, has tried to work out the game’s rules. He speculates that Mozart’s starting point was the name of an acquaintance, such as Francisca. The idea was to add “z” to the end of the name, rewrite the letters in alphabetical order, alternately assign the number 1 or 2 to each letter in succession (with certain refinements), then return to the original spelling: f1 r2 a1 n1 c2 i2 s1 c1 a1 z2. A player would then select the appropriate measures in the required order from the labeled groups to come up with a signature tune.

Hideo Noguchi describes his findings in a paper posted at http://www.asahi-net.or.jp/~rb5h-ngc/e/k516f.htm, which also includes facsimiles and transcriptions of the Mozart manuscript pages.

“Since there is no limit to the number of names and the number of letters one may choose, the number of [possible] compositions [is] infinite,” Hideo Noguchi remarks. He invites Mozart lovers throughout the world to play this musical game using their own names to hear from the music that results where they stand in the Mozartean realm.