Deliberately by Chance:

Algorithmic Composition and the Significant Precursors of Cage.

John Harding Sonic Arts Research Centre Queens University Belfast


This document is intended to envelop, what the author deems as, significant and typically overlooked precursors of the seemingly post-modern art of algorithmic composition. Initial focus is placed upon the origins of the relationship between mathematics and music and the relative discovery of harmonic ratio apparent in musical harmony, which leads progressively through the early and more abstract examples of algorithmic composition in practice, particularly in the late 18th and early 19th century. This document is not intended to be a comprehensive review of the art of algorithmic composition but rather a focused overview of the early and typically overlooked examples of both algorithmic and chance composition of music.

Keywords: Algorithmic, Composition, Chance, Dice Music, Pythagoras.


From the music of John Cage featuring algorithmic processes taken from the ancient Chinese book I Ching, and the 1960’s experiments of Karlheinz Stockhausen into aleatoric composition, to the game scenarios outlined by Brian Eno for David Bowies’ album entitled; Outside, chance music appears on the surface to be an entirely post- modern practice. Whilst these artists amongst others have been notable and dedicated proponents of the practise they are by no means the pioneers of such, as we shall see: the dice have been rolling for a long time now. (Hamilton, 2002)


In sixth century BC cult followers of a Greek Mathematical genius named Pythagoras devised a musical tuning system which rules were characterised by their religious beliefs. In the reasoning of Pythagoras and his many followers celestial motion was mirrored in nature and in the harmony of sounds expressed as music. Music in this ancient world was not seen as a personal expression, but rather the reverberation of divine passage. (Young, 2002)

In the teachings of Pythagoras and his followers music and mathematics were inseparable entities and held as key components in the understanding of both their physical and spiritual universe. The applications of mathematical function derived from nature were the algorithms on which the ancient Grecians assembled their musical systems. (Maurer, 1999). According to Grout and Palisca (1996) a leading astronomer of the time; Ptolemy, believed that the mathematical laws that govern astrological movement, and the distances between planets corresponded directly to certain musical notes and modes. The algorithms formalised by both Pythagoras and Ptolemy were also closely echoed by Plato and arrived just as Greece was becoming overwhelmed by the new found enthusiasm for democracy, Young (2002) describes this as “...the first era of tyranny” and this movement provided inspiration to Pythagoras to change the dialogue of these newly liberated voices making public the connections between mathematics, numbers and sound.

The alleged discovery of Pythagoras as it pertains to musical harmony is legend; passing a blacksmiths’ one day Pythagoras noticed that the sounds of the various sized hammers, as they were propelled at speed into the cast iron anvils, produced tones which harmonised as if in ratio with one another, so he measured their weights and found their ratios to be 4:3, 3:2, 2:1 respectively, which inevitably led to our modern understanding of the mathematical relationship inherent in musical harmony. This legendary tale is celebrated in Händel’s piano piece entitled: The Harmonious Blacksmith. According to Burnyeat (2007) the anecdote, poetic and entertaining as it may be, is entirely false; the perceived pitch of sound created by blows do not vary proportionally to the weight of the instrument used. The majority of the alleged teachings of Pythagoras are also subject for some debate, and many experts in subjects ranging from Ancient History to Mathematics have shown that several of the findings attributed to Pythagoras can be traced back to Egyptian, Chinese and Babylonian civilisations extending almost 1000 years before his birth. (Swetz and Kao, 1977; Partch 1974; and Burkert, 1972).

It would be unwarranted to proselytise further about the correct attribution of the discovery of the mathematical relationship of musical harmony, leaving this for the experts, what is important to indicate however is the significance of this discovery, and to suggest that at the time of Pythagoras, without significant doubt, was the first period in human history in which mathematical functions of extra-human origin (in this case of natural origin) were proposed to be directly applicable to the creation of music, this process is what was later to be termed algorithmic composition. It should be noted however that the algorithms of the Pythagoreans remained theoretical for the most part and, according to Grout and Palisca (1996), the application of such is questionable since Greek music featured almost entirely improvisation.


The late part of the 15th century gave birth to a new form of musical expression built upon algorithmic function; referred to as the Canon. Deriving from the Greek word kanon, meaning rule or law, canon refers to a strict form of musical counterpoint in which one voice is forced to emulate the rhythm, and or the substance of another voice (Ziehn, 1977). According to the author, in order to qualify as a canon three main conditions must be met; firstly the second voice, also referred to as the follower, should be a repetition or a derivation of the first voice, referred to as the leader, and this voice must enter at a time later than that of the first. The second voice may not deviate from the first voice or its contrapuntal variations. Therefore, the second voice is thought to be expressly generated by the first. These rules can be considered as “algorithmic”, since the performers create additional voices by adhering to a defined mathematical structure which dictates both the variation of voicing, such as “inversion” and “retrograde” for example, as well as the starting point of following voices which is also dictated to a degree by mathematical rule (Ziehn, 1977). In opposition to Pythagorean examples, in canonic composition the composer is responsible for creation of a single voice or section of the composition from which abstractions of such are created, a process which continues in repetition to construct an entire composition§. At this period in history we see for the first time a clear separation of the composer from significant components of the compositional process.

One would be forgiven for making the observation that Canonic composition is relatively simple to compose, since its abstractions are relative to previously composed voices. According to Ziehn, (1977) however nothing could be further from the truth, with even the simplest forms of the practice offering significant challenges for even the most capable musician. The author goes on to state that Johann Sebastian Bach (b.1685 – 1750) was a master of the art of Canonic composition, often employing not only the constraints of contrary motion (which involves the general movement of two melodic lines in opposite directions), augmentation (a process of lengthening or widening of the rhythmical melodic structure and intervals), and retrograde motion (a process in which the order of notes is reversed), but in many cases the simultaneous employment of more than one canonic rule (Ziehn, 1977). In no other early work is the canonic composition more deeply explored than Johann Sebastian Bach’s: Musical Offering which features no less than ten canons.

§ There are various categories of Canonic functions, for full reviews of these issues please refer to Smith; 1996 and Ziehn; 1977.


Beginning in the mid 18th century and progressively through to the early part of the 19th century algorithmic composition was subject to a significant progression in Europe. This progression, which included a practice referred to as dice music or collective termed dice games: a process of composition whereby prefabricated musical voices are combined in a fashion dictated by chance operations. The creation of dice music, for the first time in history, made it possible for any individual, regardless of their musical ability, to write original compositions (Hedges, 1978). According to the author no fewer than twenty dice games were created during the period 1757 to 1812 each of which owe their existence to the great interest in mathematics which existed during the period. The author goes on to state that the separation and codification of the musical voices that made dice games feasible were possible only due to the simple and symmetrical nature of Roccoco music of the time.

Johann Phillip Kirnberger (b.1721 – 1783) is responsible for the first published example of the algorithmic practice, which served as a subsequent model for many of the musical dice games of the time. The writing entitled Der allezeit fetige Menuettenund Polonoisenkomponist, roughly translated as Minuet Composer, allowed the user to compose either a Polonaise** or a Minuet†† and Trio‡‡ by throwing two dice (Hedges, 1978). According to the author the publication included two tables of numbers, one table for the polonaises and one for the minuet and trios. The document also contained various notated voices, in bar length sections, within the last 29 pages of the publication which were cut up into a deck of playing cards with one bar of music per card. The user tossed two dice and consulted the appropriate table. Starting from the top, the user then moved downward through the table to find the line which corresponded to the compositional bar in question. The user would then move, from left to right, across the various columns by a number equal to the dice number thrown. Following this the user would merely find the card that bears the same number and hence transfer the notated music on that card to the composition notation (Hedges 1978). According to the author the variables of the Minuet Composer exist entirely in the creation of melody, with key signatures remaining fixed between D-major for the minuet and D-minor for the trio voices, a function which allows the user to arrive at consonant results, however, this factor does not signify that the game would be susceptible to repetition, as the author states, since possible combinations of melodic lines in the Minuet Composer arrive at a figure approaching one-trillion.

Wolfgang Amadeus Mozart (b.1756 – 1791) used a similar system to that of Kirnberger in his 1787 piece entitled Musikalisches Würfelspiel, roughly translated as Dice Music§§ and is often credited, as a consequence, as being the creator of musical dice games. According to Hedges (1978) however this attribution is entirely inaccurate, the author also offers written reference to several published works which predate that of Mozarts Dice Music.

** Consisting of one soprano part one bass part in 3⁄4 time, and consisting of one six-bar period and one eight-bar period (Dwight, 1865).

†† Consisting of one soprano part one bass part in 3⁄4 time, each eight-bars in length (Dwight, 1865).

‡‡ Consisting of two solo soprano parts and bass part which is played continuously throughout a piece, each eight-bars in legnth (Dwight, 1865). 

§§ For a modern interactive implementation of Mozarts Musikalisches Würfelspiel please refer to:

4.1 Alternate Methods of the Period

In 1751 an Oxford Professor of Music named William Hayes wrote a rare satirical pamphlet entitled; ‘The Art of Composing Music by Method Entirely New, Suited to the meanest Capacity. Whereby all Difficulties are removed, and a person who has made never so little Progress before, may, with some small Application, be enabled to excel’. This piece was originally intended by the author to ridicule Barnabus Gunn; an organist of Birmingham Cathedral who had succeeded Hayes’s chief of the time. In the paper Hayes pretends to be writing as Banabus Gunn, and in entirely ridiculous fashion explains the methods of composing music by means of what he terms ‘Spruzzarino’: “Take a Gallipot, put therein Ink of what Colour you please; lay a Sheet of ruled Paper on your Harpischord or Table; then dip the Spruzzarino into the Gallipot; when you take it out again shake off the superfluous Liquid; then take the fibrous or hairy Part betwixt the Forefinger and Thumb of your left-hand, pressing them close together, and hold it to the Lines and Spaces you intend to Sprinkle; then draw the Forefinger of your Right-hand gently over the Ends thereof, and you will see a Multiplicity of Spots on the Paper; this repeat as often as you have Occasion, still beginning where you left off. This done...take your pen and proceed to the placing the Cliffs or Keys at the Beginning, marking the Bars, and forming the Spots into Crotches, Quavers, &c. as your Fancy shall prompt you, first the Treble, then the Bass; observing a proportional Quantity in the latter to suit with the former; this done, season it with Flats and Sharps to your Taste.” (Deutsch, 1952)

Although the process outlined in this paper is intended to be entirely satirical in nature, it would no doubt fall into the category of algorithmic or chance composition and the application of such may indeed lead to original and possibly outlandish results. This paper does, however, seem to indicate a certain annoyance of serious composers of the time towards the process of algorithmic composition, such early examples often being dismissed as frivolous; for instance the instructions are written with capital letters clearly defining each item and process, which on the surface appears satirical in itself, patronisingly written as if to be read by the complete imbecile. It may be assumed that this annoyance and general disregard on the part of the ‘serious composer’ plays a part in the withdrawal from the art of algorithmic composition which seemingly appears during the early part of the 18th century. Algorithmic composition seems to lie dormant for some significant time as a consequence, as if waiting for forward thinking post- modern artists to explore.


When one thinks about chance music, of the post-modern era, the name John Cage tends to be the first to spring to mind. Although John Cage was a huge proponent of the practices he was not without modern precursors when he became interested in algorithmic or chance composition in the 1940’s. According to Hamilton (2002) French composer and pianist Erik Satie (b.1866 – 1925) was one such artist who favored deliberate deployment of accident in his compositions. In his 1914 piano pieces collectively entitled; Sports Et Divertissements, Satie employs extensive use of graphical notation. Each of the 21 short voices which collectively make up Sports Et Divertissements span no more than four lines long, each of which is accompanied by a equally short poem. In this example Satie combines four distinct elements; drawing, music, poetry, and calligraphic art in a unique and personal way. In his earlier 1894 piece Prelude De La Porte Heroique Du Ciel, roughly translated as Prelude of the heroic door of heaven, Satie employs a mosaic technique, whereby recordings of the voices of the piece are repeated until one of preference is found, and according to Hamilton (2002) this may account for the strangely indeterminate succession of unrelated chords which are apparent in the piece. This composition originates from what is typically referred to as Satie’s Rose + Croix period in the 1890’s, a period, according to Hamilton (2002), when Satie was of the belief that his work was being directed “...from beyond the grave by a fanatically pious medieval cleric.” (Hamilton, 2002). While the creation of these pieces featured significant chance operations they remain mainly fixed for the performer.

Charles Ives (b. 1874 - 1954) went further into chance than Satie and, in certain scores, offered the performers themselves significant alternatives whilst often imposing upon them impossible demands through unrealisable notations. (Hamilton, 2002) Charles Ives’; The Fourth of July *** , is a prime example of this, charged with elements of polymeter, polytonality and dense layering of seemingly independent elements. On the surface this piece appears to comprise of a combination of incoherent and dissonant ideas, however, according to Nelson (1984) analyses of Ives’ technique and indeed his philosophies indicate that the work features many diverse elements each of which are integrated within a tightly constrained structural framework. Charles Ives was a huge advocate of Transcendentalism, a belief of personal state that 'transcends' the physical state, realised through perception, rather than the principles of religion, and at the core of this philosophy was the belief that man holds within him an innate goodness and that this is manifested at its greatest during periods of communal activity. (Nelson, 1984) The title of the piece, as it directly refers to a communal activity, is clear indication of the application of these philosophies in his music. With The Fourth of July Charles Ives attempts to replicate the ‘feeling’ of Independence Day Celebrations; gradually building rhythmical sections which build with tension towards a representation of exploding fireworks. The two musical “explosions” in the piece consist of dense section of non- synchronous materials and fragmented voices in various keys. According to Nelson (1984) Ives explores various algorithmic techniques in this piece: Four separate voices begin in the same key, each of which shift out of key by up/down one semitone at precisely timed and differing intervals, a process which results in tonal and metric changes which are intended, according to the author, to be analogous to two separate bands attempting, and failing, to play in unison with one another. In addition to the key changes in this piece Ives shifts one section of the orchestra to 7/8 meter for one bar while the other voices maintain 4/4 meter. Following one bar the first section returns to 4/4 meter resulting in beats that occur in succession with the off beats of the other voices. There are many further examples of elegant algorithmic functions apparent in The Fourth of July†††, however rather than list these in succession it is seemingly more important to indicate that in this case we see; a very early, if not the first, example of a composer attempting to apply algorithmic function to a composition with the express intention of replicating an acoustic phenomenon.


Pre-computer algorithmic composition continues through the [unmentioned] twelve-tone serialism of Schoenberg, for who the interpreter is the servant of the work, to the Dada and Surrealism of Duchamp, for who the compositions are entities of their own, on to Cage, who arguably took the concept of chance composition much further than any other before him by calling for a total uprooting of Western musical tradition, to the total serial control of sound sought by Pierre Boulez. The most notable pre-computer expressions of algorithmic compositions which assumingly inspired the aforementioned artists, Schoenburg; Duchamp; Cage; Boulez, are outlined in this document, a process which serves to educate the modern musician in the origins of algorithmic and chance operations and to enthuse the professional commentary of such.

*** The third movement of the four movement symphony by Charles Ives entitled: Holiday Symphony (1913).


From the Babylonian, Chinese and Egyptian civilizations emerges knowledge of a relationship between mathematics and music which is seized by Pythagoreans and unleashed upon human awareness in the form of algorithmic composition. The continuation of the art is notable in the creation and expression of both Canonic Functions and the subsequent Dice Games of the late 18th and early 19th century. These methods are further advanced during this period, in the form of Spruzzarino, processes which are made satirical in the same breath by those apposed to the process which assumingly leads to a decline in its use as a serious compositional tool. During the early 20th century algorithmic composition features an assumed regeneration, brought upon by forward thinking artists such as Satie and Ives who seem themselves to be inspired by the aforementioned precursors. This is not to imply a comprehensive overview^ on my part; on the contrary, this paper is intended to overview what is personally deemed to be the most important and often overlooked origins of the algorithmic practice. And above all, it is hoped, to inspire the advance of such procedures.

^ For a full review please refer to Nelson, (1984).


Burket, W. (1972) Lore and Science in Ancient Pythagoreanism. USA, Harvard University Press.

Burnyeat, M. F. (2007) The Truth About Pythagoras: Other Lives. [online] Available from: [Accessed date: 17/04/2008].

Deutsch, O. E. (1952) Ink-Pot and Squirt Gun: or ‘The Art of Composing Music in the New-Style’. The Musical Times, September Issue, PP. 401-403.

Dwight, J. S. (1865) Dwight's Journal of Music: A Paper of Art and Literature. Place of Publication and Publisher Unknown.

Grout, D. J. and Palisca, C. V. (1996) A History of Western Music, Fifth Edition. USA, W. W. Norton & Company.

Hamilton, A. (2002) The Music of Chance. In Young, R. (Eds.), Under-currents: The Hidden Wiring of Modern Music. USA, The Wire Publishing.

Hedges, S. A. (1978) Dice Music of the Eighteenth Century. Music and Letters, Vol. 59, No. 2, Oxford University Press.

Maurer, A. J. (1999) A Brief History of Algorithmic Composition. [online] Available from: [Accessed date: 01/03/2008].

Nelson, M. D. (1984) Beyond Mimesis: Transcendentalism and Process of Analogy in Charles Ives’ “The Fourth of July”. Perspectives of New Music, Volume 22, PP. 353 – 384.

Partch, H. (1974) A Genesis of Music: An Account of a Creative Work, Its Roots and Its Fulfillments, Second Edition. New York, USA, Da Capro Press.

Smith, T. A. (1996) Anatomy of a Canon. [online] Available from: [Accessed date: 17/04/2008].

Swetz, F. J. and Kao, T. I. (1977) Was Pythagoras Chinese? London, UK, The Pennsylvania State University Press.

Whiting, S. M. (1999) Satie the Bohemian: From Cabaret to Concert Hall. Oxford University Press.

Young, R. (2002) Slapping Pythagoras: The Battle for the Music of the Spheres. In Young, R. (Eds.), Under-currents: The Hidden Wiring of Modern Music. USA, The Wire Publishing.

Ziehn, B. (1977) Canonic Studies: A New Technique in Composition. New York, USA, Crescendo Publications.



Bach, J. S. (1747) Musical Offering. [online] Description available from: [Accessed date: 17/04/2008].

Händel, G. F. (1720) The Harmonious Blacksmith: Fourth movement of Suite No. 5 in E major. Movement also entitled: Air and Variations. [online] Description available from: [Accessed date: 17/04/2008].

Ives, C. (1911 – 1913) The Fourth of July: Third Movement of the Holiday Symphony [online] Description available from: [Accessed date: 17/04/2008].

Mozart, W. A. (1787) Musikalisches Würfelspiel. [online] Description available from: [Accessed date: 17/04/2008].

Satie, E. (1914) Sports Et Divertissements. [online] Description available from: et-divertissements-sports-and-diversions-pieces-21-for-piano?cat=entertainment [Accessed date: 17/04/2008].

Satie, E. (1894) Prelude De La Porte Heroique Du Ciel. [online] Description available from: [Accessed date: 17/04/2008].